Fix copyright headers stage 1 #1616
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: "Test changed metadata" | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| 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@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@v4 | |
| with: | |
| distribution: 'graalvm' | |
| java-version: '21' | |
| - name: "🕸️ Populate matrix" | |
| id: set-matrix | |
| if: steps.filter.outputs.changed == 'true' | |
| run: | | |
| ./gradlew generateChangedCoordinatesMatrix -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 }} (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: 120 | |
| needs: get-changed-metadata | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.get-changed-metadata.outputs.matrix) }} | |
| steps: | |
| - name: "☁️ Checkout repository" | |
| uses: actions/checkout@v4 | |
| - name: "🔧 Setup java" | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'graalvm' | |
| java-version: '21' | |
| - name: "🔧 Download GraalVM for metadata testing" | |
| uses: graalvm/setup-graalvm@v1 | |
| with: | |
| distribution: 'graalvm' | |
| java-version: ${{ matrix.version }} | |
| set-java-home: 'false' | |
| 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 all tested versions" | |
| run: | | |
| GAV_COORDINATES="${{ matrix.coordinates }}" | |
| # Extract tested versions for the metadata-version from index.json | |
| GROUP_ID=$(echo "$GAV_COORDINATES" | cut -d: -f1) | |
| ARTIFACT_ID=$(echo "$GAV_COORDINATES" | cut -d: -f2) | |
| METADATA_VERSION=$(echo "$GAV_COORDINATES" | cut -d: -f3) | |
| INDEX_FILE="metadata/$GROUP_ID/$ARTIFACT_ID/index.json" | |
| # Build JSON array of tested-version for the metadata-version | |
| VERSIONS_JSON=$(jq -r --arg mv "$METADATA_VERSION" '.[] | select(.["metadata-version"]==$mv) | ."tested-versions"' "$INDEX_FILE") | |
| # Run tests for all previously tested versions | |
| 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 |