Update tested IDE versions #4835
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: CI | |
| on: | |
| # Only run push on main | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '**/*.md' | |
| # Always run on PRs | |
| pull_request: | |
| concurrency: | |
| group: 'ci-${{ github.event.merge_group.head_ref || github.head_ref }}-${{ github.workflow }}' | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| format: | |
| name: format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| lfs: true | |
| - name: Check formatting | |
| run: ./scripts/format.sh --check | |
| generate-matrix: | |
| name: "⊹ generate compiler matrix ⊹" | |
| runs-on: ubuntu-slim | |
| outputs: | |
| matrix: ${{ steps.generate.outputs.matrix }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Generate matrix | |
| id: generate | |
| run: ./scripts/generate-ci-matrix.sh | |
| core: | |
| name: "core artifacts / ${{ matrix.kotlin-compiler }}" | |
| runs-on: ubuntu-latest | |
| needs: generate-matrix | |
| timeout-minutes: 60 | |
| strategy: | |
| matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} | |
| fail-fast: false | |
| permissions: | |
| checks: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Setup Gradle | |
| uses: ./.github/actions/setup-gradle | |
| with: | |
| encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
| cache-read-only: ${{ github.ref != 'refs/heads/main' }} | |
| konan: true | |
| konan-cache-prefix: ${{ matrix.kotlin-compiler }} | |
| - name: Check root project | |
| run: | | |
| # Regenerate tests per-run on CI to support exclusions, which are unfortunately code-gen level right now | |
| echo "Generating tests..." | |
| ./gradlew :compiler-tests:generateTests --quiet '-Pmetro.testCompilerVersion=${{ matrix.kotlin-compiler }}' ${{ github.ref != 'refs/heads/main' && '-Dorg.gradle.configuration-cache.read-only=true' || '' }} | |
| echo "Running checks..." | |
| ./gradlew check --continue --quiet '-Pmetro.testCompilerVersion=${{ matrix.kotlin-compiler }}' ${{ github.ref != 'refs/heads/main' && '-Dorg.gradle.configuration-cache.read-only=true' || '' }} | |
| echo "Running large tests..." | |
| ./gradlew :compiler-tests:test --quiet '-Pmetro.enableLargeTests' '-Pmetro.testCompilerVersion=${{ matrix.kotlin-compiler }}' ${{ github.ref != 'refs/heads/main' && '-Dorg.gradle.configuration-cache.read-only=true' || '' }} | |
| - name: (Fail-only) Upload reports | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: reports-core-${{ matrix.kotlin-compiler }} | |
| path: | | |
| **/build/reports/** | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v6 | |
| if: failure() | |
| with: | |
| report_paths: '**/build/test-results/**/TEST-*.xml' | |
| check_name: 'Test Report - core / ${{ matrix.kotlin-compiler }}' | |
| samples: | |
| name: samples | |
| runs-on: ubuntu-latest | |
| permissions: | |
| checks: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Setup Gradle | |
| uses: ./.github/actions/setup-gradle | |
| with: | |
| encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
| cache-read-only: ${{ github.ref != 'refs/heads/main' }} | |
| konan: true | |
| - name: Check samples | |
| run: | | |
| # We have to regen package locks because the kotlin yarn/node/etc build tooling is brittle | |
| ./gradlew -p samples kotlinWasmUpgradePackageLock kotlinUpgradePackageLock --rerun-tasks --no-build-cache --no-configuration-cache --quiet ${{ github.ref != 'refs/heads/main' && '-Dorg.gradle.configuration-cache.read-only=true' || '' }} | |
| ./gradlew -p samples check --continue --quiet ${{ github.ref != 'refs/heads/main' && '-Dorg.gradle.configuration-cache.read-only=true' || '' }} | |
| - name: (Fail-only) Upload reports | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: reports-samples | |
| path: | | |
| **/build/reports/** | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v6 | |
| if: failure() | |
| with: | |
| report_paths: 'samples/**/build/test-results/**/TEST-*.xml' | |
| check_name: 'Test Report - samples' | |
| # Run multiplatform tests on main only to reduce PR time | |
| # Note: We use step-level conditions instead of job-level to ensure matrix expands and shows nice names | |
| multiplatform-tests: | |
| name: ${{ format('multiplatform / {0}{1}', matrix.os, github.ref != 'refs/heads/main' && ' (skipped)' || '') }} | |
| runs-on: ${{ github.ref == 'refs/heads/main' && matrix.os || 'ubuntu-latest' }} | |
| permissions: | |
| checks: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-latest, windows-latest, macos-latest ] | |
| steps: | |
| - name: Skip on PRs | |
| if: github.ref != 'refs/heads/main' | |
| run: echo "Skipping multiplatform tests on PRs to reduce CI time" | |
| - name: Checkout | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Setup Gradle | |
| if: github.ref == 'refs/heads/main' | |
| uses: ./.github/actions/setup-gradle | |
| with: | |
| encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
| cache-read-only: ${{ github.ref != 'refs/heads/main' }} | |
| konan: true | |
| - name: Check runtime and IC tests | |
| if: github.ref == 'refs/heads/main' | |
| run: ./gradlew :runtime:allTests :gradle-plugin:functionalTest --continue --quiet | |
| - name: Check samples | |
| if: github.ref == 'refs/heads/main' | |
| run: ./gradlew -p samples test allTests --continue --quiet | |
| - name: (Fail-only) Upload reports | |
| if: failure() && github.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: reports-multiplatform-${{ matrix.os }} | |
| path: | | |
| **/build/reports/** | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v6 | |
| if: failure() && github.ref == 'refs/heads/main' | |
| with: | |
| report_paths: | | |
| **/build/test-results/**/TEST-*.xml | |
| samples/**/build/test-results/**/TEST-*.xml | |
| check_name: 'Test Report - multiplatform / ${{ matrix.os }}' | |
| benchmarks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Setup Gradle | |
| uses: ./.github/actions/setup-gradle | |
| with: | |
| encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
| cache-read-only: ${{ github.ref != 'refs/heads/main' }} | |
| konan: true | |
| - name: Build Metro benchmark | |
| run: | | |
| cd benchmark | |
| ./run_benchmarks.sh metro --build-only | |
| - name: (Fail-only) Upload reports | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: reports-benchmarks | |
| path: | | |
| **/build/reports/** | |
| # https://jakewharton.com/fan-in-to-a-single-required-github-action/ | |
| final-status: | |
| if: always() | |
| runs-on: ubuntu-slim | |
| needs: | |
| - format | |
| - core | |
| - benchmarks | |
| - samples | |
| steps: | |
| - name: Check | |
| run: | | |
| results=$(tr -d '\n' <<< '${{ toJSON(needs.*.result) }}') | |
| if ! grep -q -v -E '(failure|cancelled)' <<< "$results"; then | |
| echo "One or more required jobs failed" | |
| exit 1 | |
| fi | |
| publish: | |
| name: Publish snapshot (main only) | |
| runs-on: macos-latest | |
| if: github.ref == 'refs/heads/main' && github.repository == 'zacsweers/metro' | |
| needs: | |
| - final-status | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Setup Gradle | |
| uses: ./.github/actions/setup-gradle | |
| with: | |
| encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
| cache-read-only: ${{ github.ref != 'refs/heads/main' }} | |
| konan: true | |
| - name: Upload snapshot | |
| # Sonatype keeps giving 429 errors lately, so no need to mark this as failure for now | |
| continue-on-error: true | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SonatypeUsername }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SonatypePassword }} | |
| run: ./metrow publish |