Repository navigation
Merge unit and smoke-test coverage in CI #1353
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Open Integration Engine | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| # Every job builds the same Dockerfile, so this must match across jobs or they | |
| # miss each other's build cache. | |
| env: | |
| GRADLE_BUILD_ARGS: ${{ github.ref != 'refs/heads/main' && '-PdisableSigning=true -Pcoverage=true' || '' }} | |
| COVERAGE: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| configurations: ${{ steps.configurations.outputs.names }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: List smoke-test configurations | |
| id: configurations | |
| run: | | |
| names=$(basename -s .compose.yml ci/configurations/*.compose.yml | jq -Rsc 'split("\n") - [""]') | |
| echo "names=$names" >> "$GITHUB_OUTPUT" | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 | |
| - name: Expose GitHub Actions runtime for buildx cache | |
| uses: crazy-max/ghaction-github-runtime@04d248b84655b509d8c44dc1d6f990c879747487 # v4.0.0 | |
| - name: Build and run tests | |
| run: | | |
| rm -rf docker-build-output | |
| docker buildx build \ | |
| --progress=plain \ | |
| --build-arg "GRADLE_BUILD_ARGS=${GRADLE_BUILD_ARGS}" \ | |
| --cache-from type=gha,scope=oie-build \ | |
| --cache-to type=gha,scope=oie-build,mode=max \ | |
| --target build-output-export \ | |
| --output type=local,dest=docker-build-output \ | |
| . | |
| - name: Package distribution | |
| run: tar czf openintegrationengine.tar.gz -C docker-build-output/app/server setup --transform 's|^setup|openintegrationengine/|' | |
| - name: Create artifact | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: oie-build | |
| path: openintegrationengine.tar.gz | |
| - name: Upload unit coverage | |
| if: env.COVERAGE == 'true' | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: coverage-unit | |
| path: docker-build-output/app/build/coverage | |
| - name: Stage Test Results | |
| if: (!cancelled()) | |
| run: | | |
| mkdir -p aggregate-test-results | |
| cp -r --parents docker-build-output/app/client/build/test-results aggregate-test-results/ | |
| cp -r --parents docker-build-output/app/command/build/test-results aggregate-test-results/ | |
| cp -r --parents docker-build-output/app/donkey/build/test-results aggregate-test-results/ | |
| cp -r --parents docker-build-output/app/server/build/test-results aggregate-test-results/ | |
| - name: Upload Test Results | |
| if: (!cancelled()) | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: Test Results (unit) | |
| path: | | |
| aggregate-test-results/**/*.xml | |
| integration-test: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| configuration: ${{ fromJSON(needs.build.outputs.configurations) }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 | |
| - name: Expose GitHub Actions runtime for buildx cache | |
| uses: crazy-max/ghaction-github-runtime@04d248b84655b509d8c44dc1d6f990c879747487 # v4.0.0 | |
| - name: Download JaCoCo agent | |
| if: env.COVERAGE == 'true' | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| name: coverage-unit | |
| path: coverage-unit | |
| # Read-only: the build job populates this cache, and concurrent writers | |
| # from the matrix would just fight over the same scope. | |
| - name: Run integration tests | |
| env: | |
| EXTRA_BUILDX_ARGS: --cache-from type=gha,scope=oie-build | |
| JACOCO_AGENT: ${{ env.COVERAGE == 'true' && 'coverage-unit/jacocoagent.jar' || '' }} | |
| run: ci/runtests.sh ${{ matrix.configuration }} | |
| - name: Upload smoke-test coverage | |
| if: (!cancelled()) && env.COVERAGE == 'true' | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: coverage-smoke-${{ matrix.configuration }} | |
| path: ci/coverage/*.exec | |
| - name: Upload Test Results | |
| if: (!cancelled()) | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: Test Results (${{ matrix.configuration }}) | |
| path: | | |
| ci/test-results/**/*.xml | |
| test-results: | |
| needs: [build, integration-test] | |
| if: (!cancelled()) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Upload Event File | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: Event File | |
| path: ${{ github.event_path }} | |
| - name: Merge Test Results | |
| uses: actions/upload-artifact/merge@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: Test Results | |
| pattern: Test Results (*) | |
| delete-merged: true | |
| coverage: | |
| needs: [build, integration-test] | |
| if: (!cancelled()) && needs.build.result == 'success' && github.ref != 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Download build | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| name: oie-build | |
| path: artifacts | |
| - name: Download coverage data | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| pattern: coverage-* | |
| path: artifacts | |
| # Lay the artifacts out as a local build would leave them. | |
| - name: Merge unit and smoke-test coverage | |
| run: | | |
| mkdir -p server build ci/coverage | |
| tar xzf artifacts/openintegrationengine.tar.gz -C server --transform 's|^openintegrationengine/|setup/|' | |
| cp -r artifacts/coverage-unit build/coverage | |
| cp artifacts/coverage-smoke-*/*.exec ci/coverage/ | |
| ci/coverage-report.sh | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: Coverage Report | |
| path: build/coverage/report |