Run integration tests in matrix #5
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: Java Version Matrix Tests | |
| on: | |
| pull_request: | |
| paths: | |
| - 'integration-tests/**' | |
| - 'prometheus-metrics-core/**' | |
| - 'prometheus-metrics-exporter-*/**' | |
| - 'prometheus-metrics-exposition-*/**' | |
| - '.github/workflows/java-version-matrix-tests.yml' | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: {} | |
| jobs: | |
| integration-tests: | |
| name: Java ${{ matrix.java-version }} | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| java-version: [8, 11, 17, 21, 25] | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Set up mise | |
| uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1 | |
| with: | |
| version: v2026.1.4 | |
| sha256: 79c798e39b83f0dd80108eaa88c6ca63689695ae975fd6786e7a353ef9f87002 | |
| - name: Cache local Maven repository | |
| uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Build core library artifacts | |
| run: mise exec -- ./mvnw install -DskipTests -Dspotless.check.skip=true -Dcoverage.skip=true -Dcheckstyle.skip=true -Dwarnings=-nowarn -pl '!integration-tests' | |
| - name: Clean and rebuild sample apps targeting Java ${{ matrix.java-version }} | |
| run: | | |
| cd integration-tests | |
| if [ "${{ matrix.java-version }}" = "8" ]; then | |
| # Java 8 doesn't support --release flag, use source/target instead | |
| mise exec -- ../mvnw clean install -DskipTests -Dspotless.check.skip=true -Dcoverage.skip=true -Dcheckstyle.skip=true -Dwarnings=-nowarn \ | |
| -Djava.version=8 \ | |
| -Dmaven.compiler.source=8 \ | |
| -Dmaven.compiler.target=8 | |
| else | |
| # Java 9+ supports --release flag for better compatibility | |
| mise exec -- ../mvnw clean install -DskipTests -Dspotless.check.skip=true -Dcoverage.skip=true -Dcheckstyle.skip=true -Dwarnings=-nowarn \ | |
| -Djava.version=${{ matrix.java-version }} \ | |
| -Dmaven.compiler.release=${{ matrix.java-version }} | |
| fi | |
| - name: Run integration tests in parallel | |
| env: | |
| TEST_JAVA_VERSION: ${{ matrix.java-version }} | |
| run: | | |
| cd integration-tests | |
| mise exec -- ../mvnw verify -T 2C -Dspotless.check.skip=true -Dcoverage.skip=true -Dcheckstyle.skip=true -Dwarnings=-nowarn |