Switched to Gradle convention plugin #576
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: build | |
| env: | |
| GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false" | |
| RUNNING_ON_CI: "true" | |
| LC_ALL: C.UTF-8 | |
| LANG: C.UTF-8 | |
| on: [push, pull_request] | |
| jobs: | |
| build: | |
| name: Build and test | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Validate Gradle Wrapper | |
| uses: gradle/actions/wrapper-validation@v4 | |
| - name: Install JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| cache: "gradle" | |
| check-latest: true | |
| - name: Configure Gradle | |
| run: | |
| ./gradlew help | |
| ./gradlew --version | |
| - name: Build project | |
| run: ./gradlew assemble --stacktrace | |
| - name: Run tests | |
| run: ./gradlew testAll --stacktrace | |
| # TODO: switch to Kover | |
| # - name: Create coverage report | |
| # run: ./gradlew jacocoTestReportDefault | |
| - name: Final checks | |
| run: ./gradlew ktlint | |
| # Publish packages | |
| - name: Publish package | |
| if: startsWith(github.ref, 'refs/tags/v-') | |
| run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository | |
| env: | |
| PUBLICATION_USERNAME: ${{ secrets.PUBLICATION_USERNAME }} | |
| PUBLICATION_PASSWORD: ${{ secrets.PUBLICATION_PASSWORD }} | |
| SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | |
| SIGNING_KEY_RING: ${{ secrets.SIGNING_KEY_RING }} | |
| SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | |
| - name: Bundle the build report | |
| if: failure() | |
| run: find . -type d -name 'reports' | zip -@ -r build-report.zip | |
| - name: Upload the build report | |
| if: failure() | |
| uses: actions/upload-artifact@master | |
| with: | |
| name: build-report | |
| path: build-report.zip | |
| docs: | |
| name: Publish docs | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| if: startsWith(github.ref, 'refs/heads/_publish') || startsWith(github.ref, 'refs/tags/v-') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| cache: "gradle" | |
| check-latest: true | |
| - name: Install common deps | |
| run: sudo scripts/build-common.sh | |
| - name: Generate docs | |
| run: ./gradlew dokkaGenerate | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload Artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: 'build/docs/html' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |