From 8f8cfde359d006036ebe28069117865a67b6dd4a Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Fri, 3 Feb 2023 16:33:28 +0100 Subject: [PATCH] Let CI use parallel builds Signed-off-by: Tom Wieczorek --- .../workflows/autopilot-branch-to-latest.yaml | 2 +- .../workflows/build-airgap-image-bundle.yml | 2 +- .github/workflows/build-docs.yml | 4 +-- .github/workflows/build-k0s.yml | 6 ++-- .github/workflows/check-network.yaml | 4 +-- .github/workflows/go.yml | 30 +++++++++---------- .github/workflows/lint.yaml | 6 ++-- .github/workflows/ostests-e2e.yaml | 8 ++--- .github/workflows/publish-docs-manual.yml | 2 +- .github/workflows/publish-docs.yml | 2 +- .github/workflows/release.yml | 24 +++++++-------- .github/workflows/sbom-upload.yml | 2 +- vars.sh | 3 ++ 13 files changed, 49 insertions(+), 46 deletions(-) diff --git a/.github/workflows/autopilot-branch-to-latest.yaml b/.github/workflows/autopilot-branch-to-latest.yaml index cfaabd4e37f7..e8d9296ae5bf 100644 --- a/.github/workflows/autopilot-branch-to-latest.yaml +++ b/.github/workflows/autopilot-branch-to-latest.yaml @@ -53,7 +53,7 @@ jobs: - name: Build Tool run: | cd hack/tool - make + make -j - name: Save Build Tool Image run: | diff --git a/.github/workflows/build-airgap-image-bundle.yml b/.github/workflows/build-airgap-image-bundle.yml index d257d0b62b01..85fc57945527 100644 --- a/.github/workflows/build-airgap-image-bundle.yml +++ b/.github/workflows/build-airgap-image-bundle.yml @@ -63,4 +63,4 @@ jobs: run: | mkdir -p "embedded-bins/staging/$TARGET_OS/bin" make --touch airgap-images.txt - make "airgap-image-bundle-$TARGET_OS-$TARGET_ARCH.tar" + make -j "airgap-image-bundle-$TARGET_OS-$TARGET_ARCH.tar" diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 17fbd1ae9753..89a3a2587ee1 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -39,7 +39,7 @@ jobs: - name: Generate docs env: GH_TOKEN: ${{ github.token }} - run: make -C docs docs + run: make -j -C docs docs - name: Upload site/ uses: actions/upload-artifact@v3 @@ -55,4 +55,4 @@ jobs: uses: actions/checkout@v3 - name: Build docs dev container - run: make -C docs .docker-image.serve-dev.stamp + run: make -j -C docs .docker-image.serve-dev.stamp diff --git a/.github/workflows/build-k0s.yml b/.github/workflows/build-k0s.yml index b4b183ba104e..743c73ecd3bd 100644 --- a/.github/workflows/build-k0s.yml +++ b/.github/workflows/build-k0s.yml @@ -68,9 +68,9 @@ jobs: - name: "Build :: k0s" run: | - make bindata + make -j bindata make --touch codegen - make build + make -j build - name: "Upload :: k0s" uses: actions/upload-artifact@v3 @@ -82,7 +82,7 @@ jobs: - name: "Build :: Airgap image list" if: inputs.target-os != 'windows' - run: make airgap-images.txt && cat airgap-images.txt + run: make -j airgap-images.txt && cat airgap-images.txt - name: "Upload :: Airgap image list" if: inputs.target-os != 'windows' diff --git a/.github/workflows/check-network.yaml b/.github/workflows/check-network.yaml index 390fd54a4eb2..de690c9b0adc 100644 --- a/.github/workflows/check-network.yaml +++ b/.github/workflows/check-network.yaml @@ -96,7 +96,7 @@ jobs: - name: Build k0s Binary id: k0s_build run: | - make build + make -j build KUBERNETES_VERSION="$(./vars.sh kubernetes_version)" echo KUBERNETES_VERSION="$KUBERNETES_VERSION" >> $GITHUB_OUTPUT working-directory: ./ @@ -143,7 +143,7 @@ jobs: ./k0sctl kubeconfig > $KUBECONFIG - name: Run Sonobuoy - run: make check-network + run: make -j check-network working-directory: ./inttest - name: Terraform Destroy diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index ff7c8220500d..1465a2637e0f 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -97,7 +97,7 @@ jobs: - name: Generate SBOM run: | - make bindata + make -j bindata mkdir -p sbom && chmod 777 sbom make sbom/spdx.json @@ -140,12 +140,12 @@ jobs: env: EMBEDDED_BINS_BUILDMODE: none run: | - make bindata + make -j bindata make --touch codegen - make check-unit + make -j check-unit - name: Validate OCI images manifests - run: make check-image-validity + run: make -j check-image-validity unittests-k0s-windows-amd64: name: "Unit tests :: windows-amd64" @@ -195,9 +195,9 @@ jobs: GO_ENV: '' run: | make --touch .k0sbuild.docker-image.k0s go.sum - make bindata + make -j bindata make --touch codegen - make check-unit + make -j check-unit smoketests: strategy: @@ -254,7 +254,7 @@ jobs: echo Airgap image bundle file missing! exit 1 } - make -C inttest ${{ matrix.smoke-suite }} + make -j -C inttest ${{ matrix.smoke-suite }} - name: Collect k0s logs and support bundle if: failure() @@ -317,7 +317,7 @@ jobs: - name: Run inttest run: | - make -C inttest check-ap-ha3x3 K0S_UPDATE_FROM_BIN="../k0s-$K0S_VERSION" + make -j -C inttest check-ap-ha3x3 K0S_UPDATE_FROM_BIN="../k0s-$K0S_VERSION" - name: Collect k0s logs and support bundle if: failure() @@ -390,9 +390,9 @@ jobs: - name: Build run: | - make bindata + make -j bindata make --touch codegen - make build + make -j build - name: Upload compiled executable uses: actions/upload-artifact@v3 @@ -401,16 +401,16 @@ jobs: path: k0s - name: Unit tests - run: make check-unit + run: make -j check-unit - name: k0s sysinfo run: ./k0s sysinfo - name: Run smoketest - run: make check-basic + run: make -j check-basic - name: Create airgap image list - run: make airgap-images.txt + run: make -j airgap-images.txt - name: Cache airgap image bundle id: cache-airgap-image-bundle @@ -423,12 +423,12 @@ jobs: - name: Create airgap image bundle if not cached if: steps.cache-airgap-image-bundle.outputs.cache-hit != 'true' - run: make airgap-image-bundle-linux-${{ matrix.arch }}.tar + run: make -j airgap-image-bundle-linux-${{ matrix.arch }}.tar - name: Run airgap test run: | make --touch airgap-image-bundle-linux-${{ matrix.arch }}.tar - make check-airgap + make -j check-airgap - name: Collect k0s logs and support bundle if: failure() diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 11a0227d3285..abcf37d7e771 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -49,17 +49,17 @@ jobs: ~/.cache/golangci-lint - name: Check go.mod/go.sum to be consistent - run: make --always-make go.sum && git diff --exit-code + run: make -j --always-make go.sum && git diff --exit-code - name: Check generated code to be consistent - run: make codegen EMBEDDED_BINS_BUILDMODE=none && git diff --exit-code + run: make -j codegen EMBEDDED_BINS_BUILDMODE=none && git diff --exit-code - name: Run linter env: EMBEDDED_BINS_BUILDMODE: none GOLANGCI_LINT_FLAGS: --out-format=github-actions run: | - make lint + make -j lint validate-os-tests: name: Validate OS tests diff --git a/.github/workflows/ostests-e2e.yaml b/.github/workflows/ostests-e2e.yaml index de7bc35c494b..9b0c3ee45f42 100644 --- a/.github/workflows/ostests-e2e.yaml +++ b/.github/workflows/ostests-e2e.yaml @@ -152,7 +152,7 @@ jobs: env: E2E_CONCURRENCY_LEVEL: ${{ inputs.e2e-concurrency-level }} run: | - make bin/sonobuoy + make -j bin/sonobuoy bin/sonobuoy run -p e2e --wait=120 \ --kubernetes-version=v"$KUBERNETES_VERSION" \ --plugin-env=e2e.E2E_PARALLEL=true \ @@ -165,7 +165,7 @@ jobs: if: steps.e2e-run-parallel.conclusion != 'skipped' working-directory: inttest run: | - sonobuoyTarGz="$(make --silent get-conformance-results)" + sonobuoyTarGz="$(make -j --silent get-conformance-results)" mv -- "$sonobuoyTarGz" sonobuoy-e2e-parallel.tar.gz - name: "e2e tests :: Clear parallel run" @@ -180,7 +180,7 @@ jobs: working-directory: inttest timeout-minutes: 180 # three hours run: | - make bin/sonobuoy + make -j bin/sonobuoy bin/sonobuoy run -p e2e --wait=120 \ --kubernetes-version=v"$KUBERNETES_VERSION" \ --plugin-env=e2e.E2E_FOCUS="$E2E_FOCUS" \ @@ -190,7 +190,7 @@ jobs: id: e2e-retrieve-serial working-directory: inttest run: | - sonobuoyTarGz="$(make --silent get-conformance-results)" + sonobuoyTarGz="$(make -j --silent get-conformance-results)" mv -- "$sonobuoyTarGz" sonobuoy-e2e-serial.tar.gz - name: "Terraform :: Destroy" diff --git a/.github/workflows/publish-docs-manual.yml b/.github/workflows/publish-docs-manual.yml index f9ea8cf79709..a9c39ac42ca1 100644 --- a/.github/workflows/publish-docs-manual.yml +++ b/.github/workflows/publish-docs-manual.yml @@ -55,7 +55,7 @@ jobs: - name: Generate docs env: GH_TOKEN: ${{ github.token }} - run: make -C docs docs clean-k0s + run: make -j -C docs docs clean-k0s - name: git config run: | diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index ac56536eca88..4a163e1283cc 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -42,7 +42,7 @@ jobs: - name: Generate docs env: GH_TOKEN: ${{ github.token }} - run: make -C docs docs clean-k0s + run: make -j -C docs docs clean-k0s - name: git config run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index acf9469afd66..fe6ba0c9490f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,7 +63,7 @@ jobs: run: .github/workflows/prepare-build-env.sh - name: Build - run: make EMBEDDED_BINS_BUILDMODE=docker + run: make -j EMBEDDED_BINS_BUILDMODE=docker env: VERSION: ${{ needs.release.outputs.tag_name }} @@ -73,10 +73,10 @@ jobs: go-version: ${{ env.GO_VERSION }} - name: Run basic smoke test - run: make check-basic + run: make -j check-basic - name: Create airgap image bundle - run: make airgap-image-bundle-linux-amd64.tar + run: make -j airgap-image-bundle-linux-amd64.tar - name: Collect smoke test logs if: failure() @@ -164,7 +164,7 @@ jobs: uses: actions/checkout@v3 - name: Build - run: make EMBEDDED_BINS_BUILDMODE=docker k0s.exe + run: make -j EMBEDDED_BINS_BUILDMODE=docker k0s.exe env: VERSION: ${{ needs.release.outputs.tag_name }} @@ -238,7 +238,7 @@ jobs: working-directory: ./ - name: Build - run: make EMBEDDED_BINS_BUILDMODE=docker + run: make -j EMBEDDED_BINS_BUILDMODE=docker env: VERSION: ${{ needs.release.outputs.tag_name }} @@ -262,10 +262,10 @@ jobs: go-version: ${{ env.GO_VERSION }} - name: Run basic smoke test - run: make check-basic + run: make -j check-basic - name: Create airgap image bundle - run: make airgap-image-bundle-linux-arm64.tar + run: make -j airgap-image-bundle-linux-arm64.tar - name: Collect smoke test logs if: failure() @@ -342,7 +342,7 @@ jobs: working-directory: ./ - name: Build - run: make EMBEDDED_BINS_BUILDMODE=docker + run: make -j EMBEDDED_BINS_BUILDMODE=docker env: VERSION: ${{ needs.release.outputs.tag_name }} @@ -379,10 +379,10 @@ jobs: echo ::endgroup:: - name: Run basic smoke test - run: make check-basic + run: make -j check-basic - name: Create airgap image bundle - run: make airgap-image-bundle-linux-arm.tar + run: make -j airgap-image-bundle-linux-arm.tar - name: Collect smoke test logs if: failure() @@ -628,12 +628,12 @@ jobs: ./k0sctl kubeconfig > $KUBECONFIG - name: Run Full Conformance Check - run: make check-conformance + run: make -j check-conformance working-directory: ./inttest - name: Retrieve Sonobuoy Results run: | - make get-conformance-results + make -j get-conformance-results working-directory: ./inttest - name: Upload conformance test result to Release Assets diff --git a/.github/workflows/sbom-upload.yml b/.github/workflows/sbom-upload.yml index bf4b919c3e12..b9ec36d16e7f 100644 --- a/.github/workflows/sbom-upload.yml +++ b/.github/workflows/sbom-upload.yml @@ -21,7 +21,7 @@ jobs: COSIGN_KEY: ${{ secrets.COSIGN_KEY }} COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} run: | - make bindata + make -j bindata mkdir -p sbom && chmod 777 sbom echo $COSIGN_KEY | base64 -d > cosign.key make sign-sbom diff --git a/vars.sh b/vars.sh index 28d189c32902..dac7eb4574ca 100755 --- a/vars.sh +++ b/vars.sh @@ -2,6 +2,9 @@ set -eu +# Don't deal with recursive make stuff here! +unset -v MAKEFLAGS MAKELEVEL + from= var=