mirror of
https://github.com/fankes/moshi.git
synced 2025-10-18 23:49:21 +08:00
44 lines
1.2 KiB
YAML
44 lines
1.2 KiB
YAML
name: CI
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
build:
|
|
name: 'Java ${{ matrix.java-version }} | KSP ${{ matrix.use-ksp }}'
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
use-ksp: [ true, false ]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Validate Gradle Wrapper
|
|
uses: gradle/wrapper-validation-action@v1
|
|
|
|
- name: Generate cache key
|
|
run: ./.github/workflows/checksum.sh checksum.txt
|
|
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: ~/.gradle/caches
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('checksum.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gradle-
|
|
|
|
- name: Configure JDK
|
|
uses: actions/setup-java@v2
|
|
with:
|
|
distribution: 'zulu'
|
|
java-version: '17'
|
|
|
|
- name: Test
|
|
run: ./gradlew build check --stacktrace -PuseKsp=${{ matrix.use-ksp }}
|
|
|
|
- name: Publish (default branch only)
|
|
if: github.repository == 'square/moshi' && github.ref == 'refs/heads/master'
|
|
run: ./gradlew publish -PmavenCentralUsername=${{ secrets.SONATYPE_NEXUS_USERNAME }} -PmavenCentralPassword=${{ secrets.SONATYPE_NEXUS_PASSWORD }}
|