Merge pull request #10 from MarketDataApp/10_options_resource #10
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: Main | |
| # Runs only on push to main (i.e. when a PR is merged or someone pushes | |
| # directly). This is where the full forward-compat JDK matrix runs and | |
| # where we publish the canonical coverage snapshot that Codecov uses as | |
| # the base for PR diffs. | |
| on: | |
| push: | |
| branches: ['main'] | |
| permissions: | |
| contents: read | |
| # Don't cancel main runs against each other — we want every merge to | |
| # produce a coverage baseline. Sequential is fine; main pushes are rare. | |
| concurrency: | |
| group: main | |
| cancel-in-progress: false | |
| jobs: | |
| verify: | |
| name: Verify (JDK ${{ matrix.java }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| # Don't cancel siblings: if JDK 21 fails, we still want to know | |
| # whether 17 and 25 pass. | |
| fail-fast: false | |
| matrix: | |
| # ADR-002: tests run on JDK 17, 21, 25 to catch forward-compat | |
| # regressions. Compilation is always pinned to --release 17. | |
| java: ['17', '21', '25'] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # Install both the matrix JDK (test execution) and JDK 17 (compile + | |
| # Gradle daemon runtime). Order matters: setup-java sets JAVA_HOME | |
| # to the LAST entry, and Gradle 8.12 only supports JDKs up to 23 as | |
| # its own runtime — so JDK 17 must be last for matrix.java = 25. | |
| # setup-java still exports JAVA_HOME_<version>_<arch> for both, and | |
| # setup-gradle registers them as toolchain candidates. | |
| - name: Set up JDKs (test=${{ matrix.java }}, compile/daemon=17) | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: | | |
| ${{ matrix.java }} | |
| 17 | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Build, test, lint, coverage | |
| run: ./gradlew build -PtestJdk=${{ matrix.java }} --stacktrace | |
| - name: Upload test reports on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-reports-jdk${{ matrix.java }} | |
| path: | | |
| build/reports/tests/ | |
| build/test-results/ | |
| retention-days: 14 | |
| # The JDK 17 entry of the matrix is the canonical run for coverage: | |
| # its JaCoCo XML is uploaded to Codecov and becomes the base that | |
| # subsequent PR runs compare against (see codecov.yml). | |
| - name: Upload coverage to Codecov (JDK 17 only) | |
| if: success() && matrix.java == '17' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: build/reports/jacoco/test/jacocoTestReport.xml | |
| fail_ci_if_error: true | |
| # SDK requirements §13: integration tests run mandatorily on every push | |
| # to main (release-pipeline gate) on the full forward-compat matrix. | |
| # On PRs they're triggered on demand instead — see | |
| # pr-integration-on-demand.yml. | |
| integration-tests: | |
| name: Integration tests (live API, JDK ${{ matrix.java }}) | |
| runs-on: ubuntu-latest | |
| needs: verify | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| java: ['17', '21', '25'] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up JDKs (test=${{ matrix.java }}, compile/daemon=17) | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: | | |
| ${{ matrix.java }} | |
| 17 | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Run integration tests against live API | |
| env: | |
| MARKETDATA_TOKEN: ${{ secrets.MARKETDATA_TOKEN }} | |
| MARKETDATA_RUN_INTEGRATION_TESTS: 'true' | |
| run: | | |
| if [ -z "$MARKETDATA_TOKEN" ]; then | |
| echo "::error::MARKETDATA_TOKEN secret is required on main; integration tests must run on every merge." | |
| exit 1 | |
| fi | |
| ./gradlew integrationTest -PtestJdk=${{ matrix.java }} --stacktrace | |
| - name: Upload integration-test reports on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: integration-test-reports-jdk${{ matrix.java }} | |
| path: | | |
| build/reports/tests/integrationTest/ | |
| build/test-results/integrationTest/ | |
| retention-days: 14 |