Migrate to ktfmt #223
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: build | |
| on: | |
| pull_request: {} | |
| workflow_dispatch: {} | |
| push: | |
| branches: | |
| - 'main' | |
| tags: | |
| - '**' | |
| env: | |
| GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false" | |
| jobs: | |
| static-checks: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| with: | |
| submodules: true | |
| - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5 | |
| with: | |
| distribution: 'zulu' | |
| java-version-file: .github/workflows/.java-version | |
| - name: Static checks | |
| run: ./gradlew apiCheck spotlessCheck | |
| jvm-test-binaries: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| with: | |
| submodules: true | |
| - uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2 | |
| with: | |
| version: 0.14.0 | |
| - run: zig build -p src/jvmMain/resources/jni | |
| working-directory: zstd-kmp | |
| - run: ./gradlew :zstd-kmp:installJvmTestDistribution | |
| - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 | |
| with: | |
| name: jni-binaries | |
| path: zstd-kmp/src/jvmMain/resources/jni | |
| if-no-files-found: error | |
| - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 | |
| with: | |
| name: zstd-kmp-jvm-tests | |
| path: zstd-kmp/build/install/jvmTest | |
| if-no-files-found: error | |
| native-test-binaries: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| with: | |
| submodules: true | |
| - run: ./gradlew :zstd-kmp:linkNativeDebugTests | |
| - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 | |
| with: | |
| name: zstd-kmp-native-tests | |
| path: zstd-kmp/build/bin | |
| if-no-files-found: error | |
| platform-test: | |
| needs: | |
| - jvm-test-binaries | |
| - native-test-binaries | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - os: macOS-15-intel | |
| native-target: macosX64 | |
| - os: macOS-15 | |
| native-target: macosArm64 | |
| - os: ubuntu-24.04 | |
| native-target: linuxX64 | |
| - os: ubuntu-24.04-arm | |
| native-target: linuxArm64 | |
| - os: windows-2025 | |
| native-target: mingwX64 | |
| - os: windows-11-arm | |
| native-target: skip | |
| runs-on: ${{ matrix.platform.os }} | |
| steps: | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| with: | |
| sparse-checkout: .github/workflows/.java-version | |
| sparse-checkout-cone-mode: false | |
| - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5 | |
| with: | |
| distribution: 'zulu' | |
| java-version-file: .github/workflows/.java-version | |
| - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6 | |
| with: | |
| name: zstd-kmp-jvm-tests | |
| - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6 | |
| if: matrix.platform.native-target != 'skip' | |
| with: | |
| name: zstd-kmp-native-tests | |
| - name: Run JVM tests | |
| run: | | |
| chmod +x bin/zstd-kmp-test | |
| bin/zstd-kmp-test | |
| - name: Run native tests | |
| if: matrix.platform.native-target != 'skip' | |
| shell: bash | |
| run: | | |
| chmod +x ${{ matrix.platform.native-target }}/debugTest/test.* | |
| ${{ matrix.platform.native-target }}/debugTest/test.* | |
| android-test: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - jvm-test-binaries | |
| steps: | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| with: | |
| submodules: true | |
| - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5 | |
| with: | |
| distribution: 'zulu' | |
| java-version-file: .github/workflows/.java-version | |
| - name: Enable KVM (for Android test) | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - name: Android test | |
| uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # v2 | |
| with: | |
| api-level: 29 | |
| emulator-boot-timeout: 20000 | |
| script: ./gradlew assembleAndroidTest connectedCheck | |
| - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 | |
| if: ${{ always() }} | |
| with: | |
| name: test-report-${{ matrix.os }} | |
| path: '**/build/reports/tests/**' | |
| retention-days: 1 | |
| final-status: | |
| if: ${{ !cancelled() }} | |
| runs-on: ubuntu-latest | |
| needs: | |
| - platform-test | |
| - android-test | |
| - static-checks | |
| 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: | |
| needs: | |
| - final-status | |
| runs-on: macos-latest | |
| if: ${{startsWith(github.ref, 'refs/tags/') && github.repository == 'square/zstd-kmp' }} | |
| steps: | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| with: | |
| submodules: true | |
| - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5 | |
| with: | |
| distribution: 'zulu' | |
| java-version-file: .github/workflows/.java-version | |
| - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6 | |
| with: | |
| name: jni-binaries | |
| path: zstd-kmp/src/jvmMain/resources/jni | |
| - run: ./gradlew publishToMavenCentral | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_CENTRAL_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_CENTRAL_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SECRET_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_SECRET_PASSPHRASE }} |