|
| 1 | +name: Run generic kdevops CI runner workflow |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '**' |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - '**' |
| 10 | + workflow_dispatch: # Add this for manual triggering of the workflow |
| 11 | + |
| 12 | +jobs: |
| 13 | + run-kdevops: |
| 14 | + name: Run kdevops CI on Self-hosted Runner |
| 15 | + runs-on: [self-hosted, Linux, X64] |
| 16 | + steps: |
| 17 | + - name: Configure git |
| 18 | + run: | |
| 19 | + git config --global --add safe.directory '*' |
| 20 | +
|
| 21 | + - name: Checkout kdevops |
| 22 | + run: | |
| 23 | + rm -rf kdevops |
| 24 | + git clone /mirror/kdevops.git kdevops |
| 25 | +
|
| 26 | + - name: Checkout custom branch with delta on kdevops/linux |
| 27 | + run: | |
| 28 | + LINUX_TREE="https://github.com/${{ github.repository }}" |
| 29 | + LINUX_TREE_REF="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}" |
| 30 | + cd kdevops |
| 31 | + git clone $LINUX_TREE --reference /mirror/linux.git/ --depth=5 linux |
| 32 | + cd linux |
| 33 | + git fetch origin $LINUX_TREE_REF |
| 34 | + git checkout $LINUX_TREE_REF |
| 35 | + git log -1 |
| 36 | +
|
| 37 | + - name: Run a quick Linux kernel defconfig build test |
| 38 | + run: | |
| 39 | + cd kdevops/linux |
| 40 | + make defconfig |
| 41 | + make -j$(nproc) |
| 42 | +
|
| 43 | + - name: Make sure our repo kdevops defconfig exists |
| 44 | + run: | |
| 45 | + KDEVOPS_DEFCONFIG=$(echo $(basename ${{ github.repository }})) |
| 46 | + cd kdevops |
| 47 | + if [[ ! -f defconfigs/$KDEVOPS_DEFCONFIG ]]; then |
| 48 | + echo "kdevops lacks a defconfig for this repository, expected to find: defconfigs/$KDEVOPS_DEFCONFIG" |
| 49 | + exit 1 |
| 50 | + fi |
| 51 | +
|
| 52 | + - name: Run kdevops make defconfig-repo |
| 53 | + run: | |
| 54 | + LINUX_TREE="https://github.com/${{ github.repository }}" |
| 55 | + LINUX_TREE_REF="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}" |
| 56 | + KDEVOPS_DEFCONFIG=$(echo $(basename ${{ github.repository }})) |
| 57 | + KDEVOPS_HOSTS_PREFIX="$(echo ${LINUX_TREE_REF:0:4})" |
| 58 | + echo Going to use defconfig-$(basename ${{ github.repository }}) |
| 59 | +
|
| 60 | + echo "Linux tree: $LINUX_TREE" |
| 61 | + echo "Linux ref: $LINUX_TREE_REF" |
| 62 | + echo "Runner ID: ${{ github.run_id }}" |
| 63 | + echo "kdevops host prefix: $KDEVOPS_HOSTS_PREFIX" |
| 64 | +
|
| 65 | + KDEVOPS_ARGS="KDEVOPS_HOSTS_PREFIX=$KDEVOPS_HOSTS_PREFIX LINUX_TREE=$LINUX_TREE LINUX_TREE_REF=$LINUX_TREE_REF defconfig-$KDEVOPS_DEFCONFIG" |
| 66 | + echo Going to run: |
| 67 | + echo make $KDEVOPS_ARGS |
| 68 | +
|
| 69 | + cd kdevops |
| 70 | + make $KDEVOPS_ARGS |
| 71 | +
|
| 72 | + - name: Run kdevops make |
| 73 | + run: | |
| 74 | + cd kdevops |
| 75 | + make -j$(nproc) |
| 76 | +
|
| 77 | + - name: Run kdevops make bringup |
| 78 | + run: | |
| 79 | + cd kdevops |
| 80 | + ls -ld linux |
| 81 | + make bringup |
| 82 | +
|
| 83 | + - name: Build linux and boot test nodes on test kernel |
| 84 | + run: | |
| 85 | + cd kdevops |
| 86 | + make linux |
| 87 | +
|
| 88 | + - name: Build required ci tests |
| 89 | + run: | |
| 90 | + cd kdevops |
| 91 | + make ci-build-test |
| 92 | +
|
| 93 | + - name: Run CI tests |
| 94 | + run: | |
| 95 | + cd kdevops |
| 96 | + make ci-test |
| 97 | +
|
| 98 | + - name: Get the defined CI test results for this repository |
| 99 | + if: always() # This ensures the step runs even if previous steps failed |
| 100 | + run: | |
| 101 | + cd kdevops |
| 102 | + make journal-dump |
| 103 | + make ci-results > results.txt |
| 104 | + sed -i 's|^|kdevops/|' results.txt |
| 105 | + cat results.txt |
| 106 | +
|
| 107 | + - name: Read results.txt and set environment variable |
| 108 | + if: always() # This ensures the step runs even if previous steps failed |
| 109 | + run: | |
| 110 | + FILE_PATHS=$(cat kdevops/results.txt | tr '\n' '\n') |
| 111 | + echo "FILE_PATHS<<EOF" >> $GITHUB_ENV |
| 112 | + echo "$FILE_PATHS" >> $GITHUB_ENV |
| 113 | + echo "EOF" >> $GITHUB_ENV |
| 114 | +
|
| 115 | + - name: Upload files listed in results.txt as artifacts |
| 116 | + if: always() # This ensures the step runs even if previous steps failed |
| 117 | + uses: actions/upload-artifact@v4 |
| 118 | + with: |
| 119 | + name: kdevops-ci-results |
| 120 | + path: ${{ env.FILE_PATHS }} |
| 121 | + |
| 122 | + # Ensure make destroy always runs, even on failure |
| 123 | + - name: Run kdevops make destroy |
| 124 | + if: always() # This ensures the step runs even if previous steps failed |
| 125 | + run: | |
| 126 | + cd kdevops |
| 127 | + make destroy |
| 128 | + cd .. |
| 129 | + rm -rf kdevops |
0 commit comments