Forge: add Incus VM runner spec #5965
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
| # Per-PR gate that tests only changed metadata/tests: builds the batched matrix with | |
| # generateChangedMetadataTestMatrix (§TCK-test-harness.7) and runs the test lane on it. | |
| # §CI-test-changed-metadata; exercises §METADATA-suite and §TESTS-suite. | |
| name: "Test changed metadata" | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}" | |
| cancel-in-progress: true | |
| jobs: | |
| get-changed-metadata: | |
| name: "📋 Get a list of all changed libraries" | |
| runs-on: "ubuntu-22.04" | |
| timeout-minutes: 5 | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| none-found: ${{ steps.set-matrix.outputs.none-found }} | |
| relevant-files-changed: ${{ steps.filter.outputs.changed }} | |
| steps: | |
| - name: "☁️ Checkout repository" | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: "🔎 Detect relevant file changes" | |
| id: filter | |
| uses: ./.github/actions/detect-file-changes | |
| with: | |
| file-patterns: | | |
| - 'metadata/**' | |
| - 'tests/src/**' | |
| - name: "🔧 Setup Java" | |
| if: steps.filter.outputs.changed == 'true' | |
| uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 | |
| with: | |
| distribution: 'graalvm' | |
| java-version: '25' | |
| - name: "🕸️ Populate matrix" | |
| id: set-matrix | |
| if: steps.filter.outputs.changed == 'true' | |
| run: | | |
| ./gradlew generateChangedMetadataTestMatrix -PbaseCommit=${{ github.event.pull_request.base.sha }} -PnewCommit=${{ github.event.pull_request.head.sha }} | |
| echo "Matrix:" | |
| echo "${{ steps.set-matrix.outputs.matrix }}" | |
| test-changed-metadata: | |
| name: "🧪 ${{ matrix.coordinates }} [batch ${{ matrix.batch }}] [${{ matrix.nativeImageMode }}] (GraalVM for JDK ${{ matrix.version }} @ ${{ matrix.os }})" | |
| if: needs.get-changed-metadata.outputs.relevant-files-changed == 'true' && needs.get-changed-metadata.result == 'success' && needs.get-changed-metadata.outputs.none-found != 'true' && github.repository == 'oracle/graalvm-reachability-metadata' | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 480 | |
| needs: get-changed-metadata | |
| env: | |
| GVM_TCK_NATIVE_IMAGE_MODE: ${{ matrix.nativeImageMode }} | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.get-changed-metadata.outputs.matrix) }} | |
| steps: | |
| - name: "☁️ Checkout repository" | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - name: "🛠️ Setup latest native-build-tools snapshot" | |
| uses: ./.github/actions/setup-native-build-tools | |
| - name: "🔧 Download GraalVM for metadata testing" | |
| uses: graalvm/setup-graalvm@60c26726de13f8b90771df4bc1641a52a3159994 # v1 | |
| with: | |
| distribution: 'graalvm' | |
| java-version: ${{ matrix.version }} | |
| set-java-home: 'true' | |
| native-image-job-reports: 'true' | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: "Pull allowed docker images" | |
| run: | | |
| ./gradlew pullAllowedDockerImages -Pcoordinates=${{ matrix.coordinates }} | |
| - name: "Disable docker networking" | |
| run: bash ./.github/workflows/scripts/disable-docker.sh | |
| - name: "🔎 Check metadata files content" | |
| run: | | |
| ./gradlew checkMetadataFiles -Pcoordinates=${{ matrix.coordinates }} | |
| - name: "🧪 Run '${{ matrix.coordinates }}' tests for tested-version batch ${{ matrix.batch }}" | |
| run: | | |
| GAV_COORDINATES="${{ matrix.coordinates }}" | |
| VERSIONS_JSON='${{ toJson(matrix.versions) }}' | |
| # Run tests for the tested-version batch assigned to this job. | |
| bash ./.github/workflows/scripts/run-consecutive-tests.sh "$GAV_COORDINATES" "$VERSIONS_JSON" 2>&1 | tee test_results.txt || true | |
| # Check if any version tested-version failed tests | |
| if grep -q "^FAILED" test_results.txt; then | |
| FAILED_VERSION=$(grep "^FAILED" test_results.txt | head -n 1 | awk -F'[][]' '{print $4}') | |
| echo "Tests failed for version $FAILED_VERSION" | |
| exit 1 | |
| fi | |
| all-metadata-passed: | |
| name: "🧪 All metadata tests have passed" | |
| runs-on: "ubuntu-22.04" | |
| timeout-minutes: 1 | |
| needs: [get-changed-metadata, test-changed-metadata] | |
| if: always() | |
| steps: | |
| - name: "All tests passed" | |
| if: needs.test-changed-metadata.result == 'success' || needs.get-changed-metadata.outputs.relevant-files-changed == 'false' | |
| run: exit 0 | |
| - name: "Some tests failed" | |
| if: needs.test-changed-metadata.result == 'failure' | |
| run: exit 1 |