Refactor: pull up variable, move method, replace conditional with polymorphism #1417
Workflow file for this run
This file contains 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: Validate | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
gradle-wrapper: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: gradle/wrapper-validation-action@v1 | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
- name: Setup JDK | |
uses: actions/setup-java@v2 | |
with: | |
distribution: "zulu" | |
java-version: 17 | |
- uses: gradle/gradle-build-action@v2 | |
- 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@v4 | |
with: | |
name: lint_reports | |
path: reports.zip | |
unit-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
- name: Setup JDK | |
uses: actions/setup-java@v2 | |
with: | |
distribution: "zulu" | |
java-version: 17 | |
- uses: gradle/gradle-build-action@v2 | |
- 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@v4 | |
with: | |
name: unit_test_reports | |
path: reports.zip | |
api-compatibility: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
- name: Setup JDK | |
uses: actions/setup-java@v2 | |
with: | |
distribution: "zulu" | |
java-version: 17 | |
- uses: gradle/gradle-build-action@v2 | |
- name: Run API compatibility check | |
run: ./gradlew apiCheck --no-daemon | |
snapshot-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
- name: Setup env | |
shell: bash | |
run: | | |
curl https://us-central1-lottie-snapshots.cloudfunctions.net/snapshot-env-v1/emulator > 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: 17 | |
- uses: gradle/gradle-build-action@v2 | |
- name: Build app | |
run: ./gradlew snapshot-tests:assembleDebug snapshot-tests:assembleDebugAndroidTest --no-daemon | |
- name: Run tests | |
uses: emulator-wtf/[email protected] | |
with: | |
api-token: ${{ env.EW_API_TOKEN }} | |
version: 0.9.19 | |
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,gpu=auto | |
model=Pixel2,version=31,gpu=auto | |
outputs-dir: build/test-results | |
- name: Save PR number | |
if: github.event_name == 'pull_request' | |
env: | |
PR_NUMBER: ${{ github.event.number }} | |
run: | | |
mkdir -p ./env | |
echo PR_NUMBER=$PR_NUMBER > ./env/env | |
echo GITHUB_SHA=${{ github.sha }} >> ./env/env | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: env | |
path: env/ | |
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@v3 | |
- name: Setup JDK | |
uses: actions/setup-java@v2 | |
with: | |
distribution: "zulu" | |
java-version: 17 | |
- uses: gradle/gradle-build-action@v2 | |
- name: "Deploy Snapshot" | |
env: | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
run: ./deploy_snapshot.sh |