|
| 1 | +# SPDX-License-Identifier: GPL-2.0 |
| 2 | +--- |
| 3 | +name: Setup kdevops |
| 4 | +description: Setup kdevops workspace |
| 5 | + |
| 6 | +inputs: |
| 7 | + dir: |
| 8 | + description: 'Directory' |
| 9 | + required: true |
| 10 | + default: 'workdir' |
| 11 | + kernel_tree: |
| 12 | + required: false |
| 13 | + type: string |
| 14 | + default: 'linux' |
| 15 | + kernel_ref: |
| 16 | + required: false |
| 17 | + type: string |
| 18 | + default: 'master' |
| 19 | + ci_workflow: |
| 20 | + required: false |
| 21 | + type: string |
| 22 | + default: 'demo' |
| 23 | + |
| 24 | +runs: |
| 25 | + using: "composite" |
| 26 | + steps: |
| 27 | + - name: Create workspace directory |
| 28 | + shell: bash |
| 29 | + run: | |
| 30 | + pwd |
| 31 | + rm --recursive --force --verbose ${{ inputs.dir }} |
| 32 | + mkdir --parent --verbose ${{ inputs.dir }} |
| 33 | + find . |
| 34 | +
|
| 35 | + - name: Configure git |
| 36 | + shell: bash |
| 37 | + run: | |
| 38 | + git config --global --add safe.directory '*' |
| 39 | + git config --global user.name "kdevops" |
| 40 | + git config --global user.email "kdevops@lists.linux.dev" |
| 41 | +
|
| 42 | + - name: Checkout kdevops |
| 43 | + working-directory: ${{ inputs.dir }} |
| 44 | + shell: bash |
| 45 | + run: | |
| 46 | + rm --recursive --force --verbose kdevops/ |
| 47 | + git clone https://github.com/dkruces/kdevops.git --branch ci-workflow kdevops |
| 48 | +
|
| 49 | + - name: Checkout custom branch with delta on kdevops/linux |
| 50 | + working-directory: ${{ inputs.dir }}/kdevops |
| 51 | + shell: bash |
| 52 | + run: | |
| 53 | + set -euxo pipefail |
| 54 | + LINUX_TREE="/mirror/${{ inputs.kernel_tree }}.git" |
| 55 | + LINUX_TREE_REF="${{ inputs.kernel_ref }}" |
| 56 | + git clone $LINUX_TREE linux |
| 57 | + cd linux |
| 58 | + git checkout $LINUX_TREE_REF |
| 59 | + git log -1 |
| 60 | +
|
| 61 | + - name: Make sure our repo kdevops defconfig exists |
| 62 | + id: defconfig |
| 63 | + working-directory: ${{ inputs.dir }}/kdevops |
| 64 | + shell: bash |
| 65 | + run: | |
| 66 | + set -euxo pipefail |
| 67 | + if [[ -z "${{ inputs.kdevops_defconfig }}" ]]; then |
| 68 | + KDEVOPS_DEFCONFIG=${{ inputs.ci_workflow }} |
| 69 | + else |
| 70 | + KDEVOPS_DEFCONFIG="${{ inputs.kdevops_defconfig }}" |
| 71 | + fi |
| 72 | +
|
| 73 | + if [[ ! -f defconfigs/$KDEVOPS_DEFCONFIG ]]; then |
| 74 | + echo "kdevops lacks a defconfig for this repository, expected to find: defconfigs/$KDEVOPS_DEFCONFIG" |
| 75 | + exit 1 |
| 76 | + fi |
| 77 | +
|
| 78 | + "${{ github.workspace }}/scripts/github_output.sh" KDEVOPS_DEFCONFIG "$KDEVOPS_DEFCONFIG" |
| 79 | +
|
| 80 | + - name: Initialize CI metadata for kdevops-results-archive for linux |
| 81 | + id: metadata |
| 82 | + working-directory: ${{ inputs.dir }}/kdevops/linux |
| 83 | + shell: bash |
| 84 | + run: | |
| 85 | + set -euxo pipefail |
| 86 | + echo "${{ inputs.kernel_tree }}" > ../ci.trigger |
| 87 | + echo "testing" > ../ci.subject |
| 88 | + echo "${{ inputs.kernel_ref }}" > ../ci.ref |
| 89 | +
|
| 90 | + RELEVANT_GIT_TAG=$(cat ../ci.ref) |
| 91 | + RELEVANT_GIT_REF=$(git rev-parse --short=12 $RELEVANT_GIT_TAG) |
| 92 | +
|
| 93 | + "${{ github.workspace }}/scripts/github_output.sh" LINUX_GIT_REF "$RELEVANT_GIT_REF" |
| 94 | + "${{ github.workspace }}/scripts/github_output.sh" LINUX_GIT_TAG "$RELEVANT_GIT_TAG" |
| 95 | +
|
| 96 | + # Start out pessimistic |
| 97 | + echo "unknown" > ../ci.result |
| 98 | + echo "Nothing to write home about." > ../ci.commit_extra |
| 99 | +
|
| 100 | + - name: Run a quick Linux kernel defconfig build test |
| 101 | + working-directory: ${{ inputs.dir }}/kdevops/linux |
| 102 | + env: |
| 103 | + LINUX_GIT_TAG: ${{ steps.metadata.outputs.LINUX_GIT_TAG }} |
| 104 | + shell: bash |
| 105 | + run: | |
| 106 | + set -euxo pipefail |
| 107 | + git reset --hard "$LINUX_GIT_TAG" |
| 108 | + make defconfig |
| 109 | + make -j$(nproc) |
| 110 | +
|
| 111 | + - name: Run kdevops make defconfig-repo |
| 112 | + working-directory: ${{ inputs.dir }}/kdevops |
| 113 | + env: |
| 114 | + LINUX_GIT_TAG: ${{ steps.metadata.outputs.LINUX_GIT_TAG }} |
| 115 | + LINUX_GIT_REF: ${{ steps.metadata.outputs.LINUX_GIT_REF }} |
| 116 | + KDEVOPS_DEFCONFIG: ${{ steps.defconfig.outputs.KDEVOPS_DEFCONFIG }} |
| 117 | + shell: bash |
| 118 | + run: | |
| 119 | + LINUX_TREE="/mirror/${{ inputs.kernel_tree }}.git" |
| 120 | + LINUX_TREE_REF="$LINUX_GIT_TAG" |
| 121 | +
|
| 122 | + # We make the compromise here to use a relevant git tag for the |
| 123 | + # host prefix so that folks can easily tell what exact kernel tree |
| 124 | + # is being tested by using the relevant git ref. That is, if you |
| 125 | + # pushed a tree with the .github/ directory as the top of the tree, |
| 126 | + # that commit will not be used, we'll use the last one as that is |
| 127 | + # the relevant git ref we want to annotate a test for. |
| 128 | + # |
| 129 | + # The compromise here is that we expect no two same identical tests |
| 130 | + # on the same self-hosted server. We could extend this with something |
| 131 | + # like github.run_id but its not yet clear if we can have kdevops |
| 132 | + # hosts with a bundled prefix ID like that ref-runid-testname. Tests |
| 133 | + # have been done with the full lenght sha1sum though and we know that |
| 134 | + # does work. |
| 135 | + KDEVOPS_HOSTS_PREFIX="$LINUX_GIT_REF" |
| 136 | +
|
| 137 | + echo "Going to use defconfig-$KDEVOPS_DEFCONFIG" |
| 138 | +
|
| 139 | + echo "Linux tree: $LINUX_TREE" |
| 140 | + echo "Linux trigger ref: $LINUX_TREE_REF" |
| 141 | + echo "Linux tag: $LINUX_GIT_TAG" |
| 142 | + echo "Runner ID: ${{ github.run_id }}" |
| 143 | + echo "kdevops host prefix: $KDEVOPS_HOSTS_PREFIX" |
| 144 | + echo "kdevops defconfig: defconfig-$KDEVOPS_DEFCONFIG" |
| 145 | +
|
| 146 | + KDEVOPS_ARGS="\ |
| 147 | + KDEVOPS_HOSTS_PREFIX=$KDEVOPS_HOSTS_PREFIX \ |
| 148 | + LINUX_TREE=$LINUX_TREE \ |
| 149 | + LINUX_TREE_REF=$LINUX_TREE_REF \ |
| 150 | + ANSIBLE_CFG_CALLBACK_PLUGIN="debug" \ |
| 151 | + defconfig-$KDEVOPS_DEFCONFIG" |
| 152 | + echo "Going to run:" |
| 153 | + echo "make $KDEVOPS_ARGS" |
| 154 | +
|
| 155 | + make $KDEVOPS_ARGS |
| 156 | +
|
| 157 | + - name: Run kdevops make |
| 158 | + working-directory: ${{ inputs.dir }}/kdevops |
| 159 | + shell: bash |
| 160 | + run: | |
| 161 | + make -j$(nproc) |
| 162 | +
|
| 163 | + - name: Run kdevops make bringup |
| 164 | + working-directory: ${{ inputs.dir }}/kdevops |
| 165 | + shell: bash |
| 166 | + run: | |
| 167 | + ls -ld linux |
| 168 | + make destroy |
| 169 | + make bringup |
| 170 | +
|
| 171 | + - name: Build linux and boot test nodes on test kernel |
| 172 | + working-directory: ${{ inputs.dir }}/kdevops |
| 173 | + shell: bash |
| 174 | + run: | |
| 175 | + make linux |
| 176 | +
|
| 177 | + - name: Build required ci tests |
| 178 | + working-directory: ${{ inputs.dir }}/kdevops |
| 179 | + shell: bash |
| 180 | + run: | |
| 181 | + make ci-build-test CI_WORKFLOW=${{ inputs.ci_workflow }} |
0 commit comments