blob: b70b72115a6157f22c3739a3d92cc482193c3b49 [file] [log] [blame] [edit]
name: Validate
on:
pull_request:
push:
branches:
- master
jobs:
gradle-wrapper:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Setup JDK
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 11
cache: 'gradle'
- name: Run Lint
run: ./gradlew lintDebug --no-daemon
- name: Zip reports
if: always()
run: zip -r reports.zip . -i '**/reports/*.xml' '**/reports/*.html'
- name: Upload reports
if: always()
uses: actions/upload-artifact@v2
with:
name: lint_reports
path: reports.zip
unit-test:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Setup JDK
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 11
cache: 'gradle'
- name: Run Unit Tests
run: ./gradlew testDebugUnitTest --no-daemon
- name: Zip reports
if: always()
run: zip -r reports.zip . -i '**/reports/*.xml' '**/reports/*.html'
- name: Upload reports
if: always()
uses: actions/upload-artifact@v2
with:
name: unit_test_reports
path: reports.zip
snapshot-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Setup env
shell: bash
run: |
curl https://us-central1-lottie-snapshots.cloudfunctions.net/snapshot-env-v1 > snapshot-env
while read line; do
echo "$line" >> $GITHUB_ENV
done < snapshot-env
- name: Setup JDK
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 11
cache: 'gradle'
- name: Build app
run: ./gradlew snapshot-tests:assembleDebug snapshot-tests:assembleDebugAndroidTest --no-daemon
- name: Run tests
uses: emulator-wtf/run-tests@master
with:
api-token: ${{ env.EW_API_TOKEN }}
app: snapshot-tests/build/outputs/apk/debug/snapshot-tests-debug.apk
test: snapshot-tests/build/outputs/apk/androidTest/debug/snapshot-tests-debug-androidTest.apk
devices: |
model=Pixel2,version=23
model=Pixel2,version=31
outputs-dir: build/test-results
deploy:
if: github.event_name == 'push' && github.repository == 'airbnb/lottie-android' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: [lint, unit-test, gradle-wrapper, snapshot-tests]
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Setup JDK
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 11
cache: 'gradle'
- name: "Deploy Snapshot"
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: ./deploy_snapshot.sh