From bb8d1be300da8a610864b48098e51a08a8491e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Fri, 15 Sep 2023 13:26:40 +0200 Subject: [PATCH] ci: static-checks: Move kernel config check to its own job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It doesn't make sense to run this for all the bits of the matrix, neither it's demanding enough to require running this in one of our Azure sponsored runners. Fixes: #7974 -- part 0 Signed-off-by: Fabiano FidĂȘncio (cherry picked from commit 75c974c8024d931e085ffd214be4717e046b6640) --- .github/workflows/static-checks.yaml | 37 +++++++++++++++++----------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/.github/workflows/static-checks.yaml b/.github/workflows/static-checks.yaml index cb113bfb04..ff952623c2 100644 --- a/.github/workflows/static-checks.yaml +++ b/.github/workflows/static-checks.yaml @@ -12,6 +12,28 @@ concurrency: name: Static checks jobs: + check-kernel-config-version: + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Ensure the kernel config version has been updated + run: | + kernel_dir="tools/packaging/kernel/" + kernel_version_file="${kernel_dir}kata_config_version" + modified_files=$(git diff --name-only origin/$GITHUB_BASE_REF..HEAD) + if git diff --name-only origin/$GITHUB_BASE_REF..HEAD "${kernel_dir}" | grep "${kernel_dir}"; then + echo "Kernel directory has changed, checking if $kernel_version_file has been updated" + if echo "$modified_files" | grep -v "README.md" | grep "${kernel_dir}" >>"/dev/null"; then + echo "$modified_files" | grep "$kernel_version_file" >>/dev/null || ( echo "Please bump version in $kernel_version_file" && exit 1) + else + echo "Readme file changed, no need for kernel config version update." + fi + echo "Check passed" + fi + static-checks: runs-on: garm-ubuntu-2004 strategy: @@ -48,21 +70,6 @@ jobs: uses: actions/setup-go@v3 with: go-version: 1.19.3 - - name: Check kernel config version - run: | - cd "${{ github.workspace }}/src/github.com/${{ github.repository }}" - kernel_dir="tools/packaging/kernel/" - kernel_version_file="${kernel_dir}kata_config_version" - modified_files=$(git diff --name-only origin/main..HEAD) - if git diff --name-only origin/main..HEAD "${kernel_dir}" | grep "${kernel_dir}"; then - echo "Kernel directory has changed, checking if $kernel_version_file has been updated" - if echo "$modified_files" | grep -v "README.md" | grep "${kernel_dir}" >>"/dev/null"; then - echo "$modified_files" | grep "$kernel_version_file" >>/dev/null || ( echo "Please bump version in $kernel_version_file" && exit 1) - else - echo "Readme file changed, no need for kernel config version update." - fi - echo "Check passed" - fi - name: Set PATH if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} run: |