From aad0caaa631bbf049405fcaf8351a25c8962d875 Mon Sep 17 00:00:00 2001 From: Ben Cressey Date: Thu, 19 Sep 2024 18:45:17 +0000 Subject: [PATCH] github: use the build-all target for workflows Rather than building each variant in a separate job, build them all at once. Signed-off-by: Ben Cressey --- .github/actions/list-variants/action.yml | 24 ----------------- .github/workflows/build.yml | 33 +++++++----------------- .github/workflows/weekly.yml | 33 +++--------------------- 3 files changed, 13 insertions(+), 77 deletions(-) delete mode 100644 .github/actions/list-variants/action.yml diff --git a/.github/actions/list-variants/action.yml b/.github/actions/list-variants/action.yml deleted file mode 100644 index a6e800c7610..00000000000 --- a/.github/actions/list-variants/action.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: "List active variants" -description: "Dynamically determines current Bottlerocket variants based on repo contents." -outputs: - variants: - description: A list of all variants defined in the repo - value: ${{ steps.get-variants.outputs.variants }} - aarch-enemies: - description: Variants that should not run for aarch64 - value: ${{ steps.get-variants.outputs.aarch-enemies }} -runs: - using: "composite" - steps: - - uses: actions/checkout@v4 - - id: get-variants - name: Determine variants - shell: bash - run: | - cd variants - output="variants=$(ls -d */ | cut -d'/' -f 1 | grep -vE '^(shared|target)$' | sort | awk '$0 != x "-nvidia" && NR>1 {print x} {x=$0} END {print}' | jq -R -s -c 'split("\n")[:-1]')" - echo $output - echo $output >> $GITHUB_OUTPUT - output="aarch-enemies=$(ls -d */ | cut -d'/' -f 1 | grep -E '(^(metal|vmware)|\-dev$)' | jq -R -s -c 'split("\n")[:-1] | [ .[] | {"variant": ., "arch": "aarch64"}]')" - echo $output - echo $output >> $GITHUB_OUTPUT diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b6e8bfd924..e0beb388985 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,33 +23,17 @@ concurrency: cancel-in-progress: true jobs: - list-variants: - # This needs to be its own job since the build job needs its output before - # it can initialize - if: github.repository == 'bottlerocket-os/bottlerocket' - name: "Determine variants" - runs-on: ubuntu-latest - outputs: - variants: ${{ steps.get-variants.outputs.variants }} - aarch-enemies: ${{ steps.get-variants.outputs.aarch-enemies }} - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/list-variants - id: get-variants - build: - needs: list-variants + if: github.repository == 'bottlerocket-os/bottlerocket' runs-on: group: bottlerocket labels: bottlerocket_ubuntu-latest_32-core continue-on-error: true strategy: matrix: - variant: ${{ fromJson(needs.list-variants.outputs.variants) }} arch: [x86_64, aarch64] - exclude: ${{ fromJson(needs.list-variants.outputs.aarch-enemies) }} fail-fast: false - name: "Build ${{ matrix.variant }}-${{ matrix.arch }}" + name: "Build ${{ matrix.arch }}" steps: - name: Random delay run: | @@ -60,11 +44,12 @@ jobs: - name: Preflight step to set up the runner uses: ./.github/actions/setup-node - run: rustup component add rustfmt - - run: cargo make -e BUILDSYS_VARIANT=${{ matrix.variant }} unit-tests - - run: cargo make -e BUILDSYS_VARIANT=${{ matrix.variant }} check-fmt - - run: cargo make -e BUILDSYS_VARIANT=${{ matrix.variant }} check-clippy - - run: cargo make -e BUILDSYS_VARIANT=${{ matrix.variant }} check-shell + - run: cargo make unit-tests + - run: cargo make check-fmt + - run: cargo make check-clippy + - run: cargo make check-shell - run: | - cargo make -e BUILDSYS_VARIANT=${{ matrix.variant }} \ + cargo make \ -e BUILDSYS_ARCH=${{ matrix.arch }} \ - -e BUILDSYS_JOBS=12 + -e BUILDSYS_JOBS=12 \ + build-all diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml index 125e554f3a7..4b0ba5904ea 100644 --- a/.github/workflows/weekly.yml +++ b/.github/workflows/weekly.yml @@ -18,48 +18,23 @@ env: GOPROXY: direct jobs: - list-variants: - # This needs to be its own job since the build job needs its output before - # it can initialize - if: github.repository == 'bottlerocket-os/bottlerocket' - name: "Determine variants" - runs-on: ubuntu-latest - outputs: - variants: ${{ steps.get-variants.outputs.variants }} - aarch-enemies: ${{ steps.get-variants.outputs.aarch-enemies }} - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/list-variants - id: get-variants - build: - needs: list-variants + if: github.repository == 'bottlerocket-os/bottlerocket' runs-on: group: bottlerocket labels: bottlerocket_ubuntu-latest_32-core continue-on-error: false strategy: matrix: - variant: ${{ fromJson(needs.list-variants.outputs.variants) }} arch: [x86_64, aarch64] - exclude: ${{ fromJson(needs.list-variants.outputs.aarch-enemies) }} fail-fast: false - name: "Build ${{ matrix.variant }}-${{ matrix.arch }}" + name: "Build ${{ matrix.arch }}" steps: - uses: actions/checkout@v4 - name: Preflight step to set up the runner uses: ./.github/actions/setup-node - - if: contains(matrix.variant, 'nvidia') - run: | - cat <<-EOF > Licenses.toml - [nvidia] - spdx-id = "LICENSE-LicenseRef-NVIDIA-Customer" - licenses = [ - { path = "NVIDIA", license-url = "https://www.nvidia.com/en-us/drivers/nvidia-license/" } - ] - EOF - run: | - cargo make -e BUILDSYS_VARIANT=${{ matrix.variant }} \ + cargo make -e \ -e BUILDSYS_ARCH=${{ matrix.arch }} \ -e BUILDSYS_JOBS=12 \ - -e BUILDSYS_UPSTREAM_LICENSE_FETCH="${{ contains(matrix.variant, 'nvidia') }}" + build-all