kopia lustrzana https://github.com/ge0rg/aprsdroid
132 wiersze
3.0 KiB
YAML
132 wiersze
3.0 KiB
YAML
name: Android CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ '**' ]
|
|
pull_request:
|
|
branches: [ '**' ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
compile:
|
|
runs-on: macos-latest
|
|
name: "Compile all sources"
|
|
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: set up JDK 11
|
|
uses: actions/setup-java@v2
|
|
with:
|
|
java-version: '11'
|
|
distribution: 'adopt'
|
|
cache: gradle
|
|
|
|
- name: Load build outputs
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: build
|
|
key: build-${{ github.sha }}
|
|
|
|
- name: Create properties file with empty API key
|
|
run: echo mapsApiKey="\"${{ secrets.mapsApiKey }}\"" >> local.properties
|
|
|
|
- name: Build App
|
|
run: ./gradlew assemble --stacktrace
|
|
|
|
- name: Build unit tests
|
|
run: ./gradlew assembleDebugUnitTest assembleReleaseUnitTest --stacktrace
|
|
|
|
- name: Build instrumentation tests
|
|
run: ./gradlew assembleAndroidTest --stacktrace
|
|
|
|
unit-test:
|
|
name: "Run all unit tests"
|
|
needs: compile
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: set up JDK 11
|
|
uses: actions/setup-java@v2
|
|
with:
|
|
java-version: '11'
|
|
distribution: 'adopt'
|
|
cache: gradle
|
|
|
|
- name: Load build outputs
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: build
|
|
key: build-${{ github.sha }}
|
|
|
|
- name: Run Unit Tests
|
|
run: ./gradlew test --stacktrace
|
|
|
|
- name: Run Linter
|
|
run: ./gradlew lint --stacktrace
|
|
continue-on-error: true
|
|
|
|
- name: Upload reports
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: Unit Test Reports
|
|
path: build/outputs/reports
|
|
if: ${{ failure() }}
|
|
|
|
instrumentation:
|
|
name: "Testing on API ${{ matrix.api-level }} for ${{ matrix.target }}"
|
|
needs: compile
|
|
# macOS provided hardware-accelerated emulator
|
|
runs-on: macos-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
api-level: [ 15, 20, 24, 30 ]
|
|
target: [ default, google_apis ]
|
|
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: set up JDK 11
|
|
uses: actions/setup-java@v2
|
|
with:
|
|
java-version: '11'
|
|
distribution: 'adopt'
|
|
cache: gradle
|
|
|
|
- name: Load build outputs
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: build
|
|
key: build-${{ github.sha }}
|
|
|
|
- name: Run Instrumented Tests
|
|
uses: reactivecircus/android-emulator-runner@v2
|
|
with:
|
|
api-level: ${{ matrix.api-level }}
|
|
target: ${{ matrix.target }}
|
|
arch: x86
|
|
profile: Nexus 6
|
|
script: ./gradlew connectedCheck --stacktrace
|
|
|
|
- name: Save successful debug APK
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: debug apk
|
|
path: build/outputs/debug/aprsdroid-debug.apk
|
|
if: ${{ matrix.api-level == 30 && matrix.target == 'google_apis' }}
|