From e762e46b4bd930d8ad437d19c2367f8a8ebb1394 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Tue, 30 May 2023 00:11:32 +0200 Subject: [PATCH] ci: merge test workflow to build one Signed-off-by: CrazyMax --- .github/workflows/build.yml | 56 ++++++++++++++++++++----- .github/workflows/test.yml | 81 ------------------------------------- 2 files changed, 45 insertions(+), 92 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4edce420..aa1769ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,10 +27,34 @@ env: jobs: test: runs-on: ubuntu-22.04 + env: + TESTFLAGS: "-v --parallel=6 --timeout=30m" + TESTFLAGS_DOCKER: "-v --parallel=1 --timeout=30m" + GOTESTSUM_FORMAT: "standard-verbose" + strategy: + fail-fast: false + matrix: + worker: + - docker + - docker-container + - remote + pkg: + - ./tests + typ: + - integration + include: + - pkg: ./... + skip-integration-tests: 1 steps: - name: Checkout uses: actions/checkout@v3 + - + name: Expose GitHub Runtime + uses: crazy-max/ghaction-github-runtime@v2 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -40,19 +64,29 @@ jobs: buildkitd-flags: --debug - name: Test - uses: docker/bake-action@v3 + run: | + export TEST_REPORT_SUFFIX=-${{ github.job }}-$(echo "${{ matrix.pkg }}-${{ matrix.skip-integration-tests }}-${{ matrix.worker }}" | tr -dc '[:alnum:]-\n\r' | tr '[:upper:]' '[:lower:]') + ./hack/test ${{ matrix.typ }} + env: + TEST_DOCKERD: "${{ (matrix.worker == 'docker' || matrix.worker == 'docker-container') && '1' || '0' }}" + TESTFLAGS: "${{ (matrix.worker == 'docker' || matrix.worker == 'docker-container') && env.TESTFLAGS_DOCKER || env.TESTFLAGS }} --run=//worker=${{ matrix.worker }}$" + TESTPKGS: "${{ matrix.pkg }}" + SKIP_INTEGRATION_TESTS: "${{ matrix.skip-integration-tests }}" + - + name: Generate annotations + if: always() + uses: crazy-max/.github/.github/actions/gotest-annotations@1a64ea6d01db9a48aa61954cb20e265782c167d9 with: - targets: test - set: | - *.cache-from=type=gha,scope=test - *.cache-to=type=gha,scope=test + directory: ./bin/testreports - - name: Upload coverage - uses: codecov/codecov-action@v3 + name: Upload test reports + if: always() + uses: actions/upload-artifact@v3 with: - directory: ${{ env.DESTDIR }}/coverage + name: test-reports + path: ./bin/testreports - prepare: + prepare-binaries: runs-on: ubuntu-22.04 outputs: matrix: ${{ steps.platforms.outputs.matrix }} @@ -73,11 +107,11 @@ jobs: binaries: runs-on: ubuntu-22.04 needs: - - prepare + - prepare-binaries strategy: fail-fast: false matrix: - platform: ${{ fromJson(needs.prepare.outputs.matrix) }} + platform: ${{ fromJson(needs.prepare-binaries.outputs.matrix) }} steps: - name: Prepare diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index dad6f7d1..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: test - -on: - workflow_dispatch: - push: - branches: - - 'master' - - 'v[0-9]*' - tags: - - 'v*' - pull_request: - paths-ignore: - - '.github/releases.json' - - 'README.md' - - 'docs/**' - -env: - SETUP_BUILDX_VERSION: "latest" - SETUP_BUILDKIT_IMAGE: "moby/buildkit:latest" - TESTFLAGS: "-v --parallel=6 --timeout=30m" - TESTFLAGS_DOCKER: "-v --parallel=1 --timeout=30m" - GOTESTSUM_FORMAT: "standard-verbose" - -jobs: - test: - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - worker: - - docker - - docker-container - - remote - pkg: - - ./tests - typ: - - integration - # already run as part of build.yml - # include: - # - pkg: ./... - # skip-integration-tests: 1 - steps: - - - name: Checkout - uses: actions/checkout@v3 - - - name: Expose GitHub Runtime - uses: crazy-max/ghaction-github-runtime@v2 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - version: ${{ env.SETUP_BUILDX_VERSION }} - driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} - buildkitd-flags: --debug - - - name: Test - run: | - export TEST_REPORT_SUFFIX=-${{ github.job }}-$(echo "${{ matrix.pkg }}-${{ matrix.skip-integration-tests }}-${{ matrix.worker }}" | tr -dc '[:alnum:]-\n\r' | tr '[:upper:]' '[:lower:]') - ./hack/test ${{ matrix.typ }} - env: - TEST_DOCKERD: "${{ (matrix.worker == 'docker' || matrix.worker == 'docker-container') && '1' || '0' }}" - TESTFLAGS: "${{ (matrix.worker == 'docker' || matrix.worker == 'docker-container') && env.TESTFLAGS_DOCKER || env.TESTFLAGS }} --run=//worker=${{ matrix.worker }}$" - TESTPKGS: "${{ matrix.pkg }}" - SKIP_INTEGRATION_TESTS: "${{ matrix.skip-integration-tests }}" - - - name: Generate annotations - if: always() - uses: crazy-max/.github/.github/actions/gotest-annotations@1a64ea6d01db9a48aa61954cb20e265782c167d9 - with: - directory: ./bin/testreports - - - name: Upload test reports - if: always() - uses: actions/upload-artifact@v3 - with: - name: test-reports - path: ./bin/testreports