Skip to content

adding ci files

adding ci files #98

Workflow file for this run

name: Run generic kdevops CI runner workflow
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
workflow_dispatch: # Add this for manual triggering of the workflow
jobs:
run-kdevops:
name: Run kdevops CI on Self-hosted Runner
runs-on: [self-hosted, Linux, X64]
steps:
- name: Configure git
run: |
git config --global --add safe.directory '*'
- name: Set Linux kdevops development path
run: echo "LINUX_KDEVOPS_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Checkout kdevops
run: |
rm -rf kdevops
git clone /mirror/kdevops.git kdevops
- name: Make sure our repo kdevops defconfig exists
run: |
cd kdevops
KDEVOPS_DEFCONFIG=$(basename ${{ github.repository }})
if [[ "${{ github.event.inputs.defconfig }}" == "all profiles" ]] || [[ "${{ github.event.inputs.defconfig }}" == "" ]]; then
KDEVOPS_DEFCONFIG=$(basename ${{ github.repository }})
else
KDEVOPS_DEFCONFIG="${{ github.event.inputs.defconfig }}-cli"
fi
if [[ ! -f defconfigs/$KDEVOPS_DEFCONFIG ]]; then
echo "kdevops lacks a defconfig for this repository, expected to find: defconfigs/$KDEVOPS_DEFCONFIG"
exit 1
fi
echo "KDEVOPS_DEFCONFIG=$KDEVOPS_DEFCONFIG" >> $GITHUB_ENV
- name: Checkout custom branch with delta on kdevops/linux
run: |
LINUX_TREE="https://github.com/${{ github.repository }}"
LINUX_TREE_REF="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"
cd kdevops
git clone $LINUX_TREE --reference /mirror/linux.git/ --depth=5 linux
cd linux
git fetch origin $LINUX_TREE_REF
git checkout $LINUX_TREE_REF
git log -1
- name: Initialize CI metadata for kdevops-results-archive for linux
run: |
cd kdevops/linux
echo "$(basename ${{ github.repository }})" > ../ci.trigger
# Check if the last commit modified .github directory.
# This lets you merge the .github changes either before a patch
# series as kernel-patch-daemon does, or if you want to keep your
# git commit IDs from an existing development tree, at the end.
# You would merge the changes which add the .github directory for
# example if you want to test an existing development tree.
#
# If the last commit was not the one which added .github directory
# use the last commit message. This is for example how
# kernel-patch-daemon pushes changes, the last commit is the last
# patch from series posted and picked up from patchwork.
if git diff-tree --no-commit-id --name-only --diff-filter=A -r HEAD | grep -q "^\.github/"; then
git log -2 --skip=1 --pretty=format:"%s" -1 > ../ci.subject
git describe --exact-match --tags HEAD^ 2>/dev/null || git rev-parse --short HEAD^ > ../ci.ref
else
git log -1 --pretty=format:"%s" > ../ci.subject
git describe --exact-match --tags HEAD 2>/dev/null || git rev-parse --short HEAD > ../ci.ref
fi
# Start out pessimistic
echo "not ok" > ../ci.result
echo "Nothing to write home about." > ../ci.commit_extra
- name: Run a quick Linux kernel defconfig build test
run: |
cd kdevops/linux
make defconfig
make -j$(nproc)
- name: Run kdevops make defconfig-repo
run: |
LINUX_TREE="https://github.com/${{ github.repository }}"
LINUX_TREE_REF="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"
KDEVOPS_HOSTS_PREFIX="$(echo ${LINUX_TREE_REF:0:4})"
echo Going to use defconfig-${{ env.KDEVOPS_DEFCONFIG }}
echo "Linux tree: $LINUX_TREE"
echo "Linux trigger ref: $LINUX_TREE_REF"
echo "Linux ref: $(cat ../ci.ref)"
echo "Runner ID: ${{ github.run_id }}"
echo "kdevops host prefix: $KDEVOPS_HOSTS_PREFIX"
echo "kdevops defconfig: defconfig-${{ env.KDEVOPS_DEFCONFIG }}"
KDEVOPS_ARGS="KDEVOPS_HOSTS_PREFIX=$KDEVOPS_HOSTS_PREFIX LINUX_TREE=$LINUX_TREE LINUX_TREE_REF=$LINUX_TREE_REF defconfig-${{ env.KDEVOPS_DEFCONFIG }}"
echo Going to run:
echo make $KDEVOPS_ARGS
cd kdevops
make $KDEVOPS_ARGS
- name: Run kdevops make
run: |
cd kdevops
make -j$(nproc)
- name: Run kdevops make bringup
run: |
cd kdevops
ls -ld linux
make bringup
- name: Build linux and boot test nodes on test kernel
run: |
cd kdevops
make linux
- name: Build required ci tests
run: |
cd kdevops
make ci-build-test
- name: Run CI tests
run: |
cd kdevops
make ci-test
echo "ok" > ci.result
- name: Get systemd journal files
if: always() # This ensures the step runs even if previous steps failed
run: |
cd kdevops
make journal-dump
- name: Start SSH Agent
if: always() # Ensure this step runs even if previous steps failed
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Build our kdevops archive results
if: always() # This ensures the step runs even if previous steps failed
run: |
cd kdevops
make ci-archive
- name: Upload our kdevops results archive
if: always() # This ensures the step runs even if previous steps failed
uses: actions/upload-artifact@v4
with:
name: kdevops-ci-results
path: ${{ env.LINUX_KDEVOPS_PATH }}/kdevops/archive/*.zip
# Ensure make destroy always runs, even on failure
- name: Run kdevops make destroy
if: always() # This ensures the step runs even if previous steps failed
run: |
cd kdevops
make destroy
cd ..
rm -rf kdevops