agent-snapshots-deployed #743
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
| # This workflow will build a Java / Kotlin project with Maven, and cache/restore any dependencies to improve the workflow execution time | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | |
| name: Build | |
| on: | |
| repository_dispatch: | |
| types: [agent-snapshots-deployed] | |
| push: | |
| pull_request: | |
| types: [ opened, synchronize, reopened ] | |
| # Required for dorny/test-reporter to create check runs | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| # The pom targets Java 21 bytecode but the toolchain builds on 21 through 25. | |
| # Testing on both proves that stays true; 25 is the JDK the container image runs. | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| java: ['21', '25'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK ${{ matrix.java }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ matrix.java }} | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Configure Testcontainers | |
| run: | | |
| mkdir -p /home/runner | |
| echo "testcontainers.reuse.enable=true" > /home/runner/.testcontainers.properties | |
| - name: Configure Maven Settings | |
| uses: s4u/maven-settings-action@v2.8.0 | |
| with: | |
| servers: ${{secrets.EMBABEL_ARTIFACTORY}} | |
| # Compile first - fail fast on compilation errors | |
| # -U forces update of SNAPSHOT dependencies | |
| - name: Compile | |
| run: mvn -U -B compile test-compile | |
| # Run tests with JaCoCo coverage | |
| - name: Test with Coverage | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_DUMMY_KEY }} | |
| run: mvn -U -B test | |
| # Generate JaCoCo coverage report | |
| - name: Generate Coverage Report | |
| if: always() | |
| run: mvn -U -B jacoco:report | |
| continue-on-error: true | |
| # Publish test results as check run annotations. | |
| # Only from the 25 leg - two legs would race to create the same check run. | |
| - name: Publish Test Results | |
| uses: dorny/test-reporter@v1 | |
| if: always() && github.ref == 'refs/heads/main' && matrix.java == '25' | |
| with: | |
| name: Test Results | |
| path: target/surefire-reports/*.xml | |
| reporter: java-junit | |
| fail-on-error: false | |
| # Upload test reports as artifacts | |
| - name: Upload Test Reports | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-reports-java${{ matrix.java }} | |
| path: | | |
| target/surefire-reports/ | |
| target/site/jacoco/ | |
| retention-days: 14 | |
| # Upload coverage to Codecov (optional - requires CODECOV_TOKEN secret). | |
| # One leg only - both produce identical coverage. | |
| - name: Upload Coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| if: always() && matrix.java == '25' | |
| continue-on-error: true | |
| with: | |
| files: target/site/jacoco/jacoco.xml | |
| fail_ci_if_error: false | |
| # Build Failure Notification | |
| notify: | |
| needs: [build] | |
| if: failure() && github.ref == 'refs/heads/main' | |
| uses: embabel/embabel-build/.github/workflows/discord-notify.yml@main | |
| secrets: inherit | |
| #Build Recovery ( if prior build failed ) Notification | |
| notify-recovery: | |
| needs: [build] | |
| if: success() && github.ref == 'refs/heads/main' | |
| uses: embabel/embabel-build/.github/workflows/notify-recovery.yml@main | |
| with: | |
| branch: main | |
| caller_run_id: ${{ github.run_id }} | |
| secrets: inherit |