Fix multiplatform test compatibility issues #51
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: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/gradle-build-action@v2 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x library/gradlew | |
| if: matrix.os != 'windows-latest' | |
| - name: Build with Gradle | |
| run: ./gradlew build --no-daemon | |
| working-directory: library | |
| - name: Run tests | |
| run: ./gradlew allTests --no-daemon | |
| working-directory: library | |
| - name: Generate test report | |
| uses: dorny/test-reporter@v1 | |
| if: success() || failure() | |
| with: | |
| name: Test Results (${{ matrix.os }}) | |
| path: 'library/**/build/test-results/**/TEST-*.xml' | |
| reporter: java-junit | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: matrix.os == 'ubuntu-latest' | |
| with: | |
| name: build-artifacts | |
| path: library/build/libs/ | |
| - name: Upload test reports | |
| uses: actions/upload-artifact@v4 | |
| if: always() && matrix.os == 'ubuntu-latest' | |
| with: | |
| name: test-reports-${{ matrix.os }} | |
| path: | | |
| library/**/build/reports/tests/ | |
| library/**/build/test-results/ | |
| retention-days: 5 | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/gradle-build-action@v2 | |
| - name: Run detekt | |
| run: ./gradlew detekt | |
| working-directory: library | |
| continue-on-error: true | |
| - name: Upload detekt reports | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: detekt-reports | |
| path: library/build/reports/detekt/ | |
| publish-snapshot: | |
| needs: [build, lint] | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/gradle-build-action@v2 | |
| - name: Publish snapshot | |
| env: | |
| OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
| OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
| SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | |
| SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | |
| run: ./gradlew publish --no-daemon | |
| working-directory: library |