|
| 1 | +name: Build & Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "main" ] |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ci-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + |
| 16 | +jobs: |
| 17 | + test: |
| 18 | + name: Test - ${{ matrix.platform }} |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + timeout-minutes: 15 |
| 21 | + |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + include: |
| 26 | + - os: windows-latest |
| 27 | + platform: Windows |
| 28 | + - os: macos-latest |
| 29 | + platform: macOS |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Validate Gradle wrapper |
| 36 | + uses: gradle/actions/wrapper-validation@v4 |
| 37 | + |
| 38 | + - name: Setup JDK 21 |
| 39 | + uses: actions/setup-java@v4 |
| 40 | + with: |
| 41 | + java-version: '21' |
| 42 | + distribution: 'temurin' |
| 43 | + |
| 44 | + - name: Grant execute permission |
| 45 | + if: runner.os != 'Windows' |
| 46 | + run: chmod +x ./gradlew |
| 47 | + |
| 48 | + - name: Setup Gradle |
| 49 | + uses: gradle/actions/setup-gradle@v4 |
| 50 | + with: |
| 51 | + cache-read-only: ${{ github.ref != 'refs/heads/main' }} |
| 52 | + add-job-summary: on-failure |
| 53 | + |
| 54 | + - name: Execute JVM tests |
| 55 | + run: ${{ runner.os == 'Windows' && '.\gradlew.bat' || './gradlew' }} :library:jvmTest --no-daemon --stacktrace |
| 56 | + |
| 57 | + - name: Execute ComposeApp desktop tests |
| 58 | + run: ${{ runner.os == 'Windows' && '.\gradlew.bat' || './gradlew' }} :composeApp:desktopTest --no-daemon --stacktrace |
| 59 | + |
| 60 | + - name: Publish test report |
| 61 | + if: always() |
| 62 | + uses: actions/upload-artifact@v4 |
| 63 | + with: |
| 64 | + name: test-report-${{ matrix.platform }} |
| 65 | + path: | |
| 66 | + library/build/test-results/jvmTest/ |
| 67 | + library/build/reports/tests/jvmTest/ |
| 68 | + composeApp/build/test-results/desktopTest/ |
| 69 | + composeApp/build/reports/tests/desktopTest/ |
| 70 | + retention-days: 7 |
| 71 | + if-no-files-found: ignore |
0 commit comments