Merge pull request #1079 from UweTrottmann/updates #1600
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: Android CI | |
# Avoid running this on the gh-pages branch | |
on: | |
push: | |
branches-ignore: | |
- "gh-pages" | |
pull_request: | |
branches-ignore: | |
- "gh-pages" | |
workflow_dispatch: # Allow running manually from web UI | |
jobs: | |
build: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
# Only run on pushes or if pull request from fork | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
permissions: | |
checks: write # to publish unit test results | |
steps: | |
- name: Check out | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Gradle info | |
run: ./gradlew -version | |
# Note: Currently no difference between flavors or debug and release | |
# Note: running tests will also compile | |
- name: Build and run unit tests | |
run: ./gradlew :app:testPureDebugUnitTest | |
- name: Test Report | |
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 # v1.9.1 | |
if: always() # also run if tests failed | |
with: | |
name: JUnit Report | |
path: app/build/test-results/**/*.xml | |
reporter: java-junit | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
# Only run on pushes or if pull request from fork | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
steps: | |
- name: Check out | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
# To speed up lint check only run for release variant and only on app module | |
# Note: the app module has lintOptions.checkDependencies true, so submodules will be checked | |
# Source: https://groups.google.com/forum/#!topic/lint-dev/RGTvK_uHQGQ | |
# Note: running lint will also compile | |
- name: Lint goog release | |
run: ./gradlew :app:lintPureRelease | |
- name: Lint amzn release | |
if: ${{ contains(github.ref, 'release') }} | |
run: ./gradlew :app:lintAmazonRelease | |
- name: Upload lint reports | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
if: ${{ always() }} # also upload of lint errors | |
with: | |
name: Lint reports | |
path: | | |
app/build/reports/lint-results-pureRelease.html | |
app/build/reports/lint-results-amazonRelease.html |