NewPipe-app-android/.github/workflows/ci.yml

130 lines
3.4 KiB
YAML
Raw Normal View History

2020-12-09 07:55:57 +01:00
name: CI
2021-03-08 13:15:22 +01:00
on:
workflow_dispatch:
2021-03-08 13:15:22 +01:00
pull_request:
branches:
2021-03-08 13:19:18 +01:00
- dev
- master
- release**
paths-ignore:
2022-02-04 11:13:10 +01:00
- 'README.md'
- 'doc/**'
- 'fastlane/**'
- 'assets/**'
- '.github/**/*.md'
2022-02-04 11:32:33 +01:00
- '.github/FUNDING.yml'
- '.github/ISSUE_TEMPLATE/**'
2021-03-08 13:15:22 +01:00
push:
2021-03-21 02:47:19 +01:00
branches:
2021-03-08 13:19:18 +01:00
- dev
- master
paths-ignore:
2022-02-04 11:13:10 +01:00
- 'README.md'
- 'doc/**'
- 'fastlane/**'
- 'assets/**'
- '.github/**/*.md'
2022-02-04 11:32:33 +01:00
- '.github/FUNDING.yml'
- '.github/ISSUE_TEMPLATE/**'
2020-12-09 07:55:57 +01:00
jobs:
2021-01-06 16:32:33 +01:00
build-and-test-jvm:
2020-12-09 07:55:57 +01:00
runs-on: ubuntu-latest
permissions:
contents: read
2020-12-09 07:55:57 +01:00
steps:
- uses: actions/checkout@v3
2021-03-21 02:47:19 +01:00
- uses: gradle/wrapper-validation-action@v1
2020-12-09 07:55:57 +01:00
- name: create and checkout branch
# push events already checked out the branch
if: github.event_name == 'pull_request'
run: git checkout -B ${{ github.head_ref }}
2021-08-25 17:05:10 +02:00
- name: set up JDK 11
uses: actions/setup-java@v3
2020-12-09 07:55:57 +01:00
with:
2021-08-25 17:05:10 +02:00
java-version: 11
distribution: "temurin"
cache: 'gradle'
2021-01-06 16:32:33 +01:00
- name: Build debug APK and run jvm tests
run: ./gradlew assembleDebug lintDebug testDebugUnitTest --stacktrace -DskipFormatKtlint
2020-12-09 07:55:57 +01:00
- name: Upload APK
uses: actions/upload-artifact@v3
2020-12-09 07:55:57 +01:00
with:
name: app
path: app/build/outputs/apk/debug/*.apk
2021-01-06 16:32:33 +01:00
test-android:
# macos has hardware acceleration. See android-emulator-runner action
runs-on: macos-latest
timeout-minutes: 20
strategy:
matrix:
# api-level 19 is min sdk, but throws errors related to desugaring
api-level: [ 21, 29 ]
permissions:
contents: read
steps:
- uses: actions/checkout@v3
2021-08-25 17:05:10 +02:00
- name: set up JDK 11
uses: actions/setup-java@v3
with:
2021-08-25 17:05:10 +02:00
java-version: 11
distribution: "temurin"
cache: 'gradle'
- name: Run android tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
# workaround to emulator bug: https://github.com/ReactiveCircus/android-emulator-runner/issues/160
emulator-build: 7425822
script: ./gradlew connectedCheck --stacktrace
- name: Upload test report when tests fail # because the printed out stacktrace (console) is too short, see also #7553
uses: actions/upload-artifact@v3
if: failure()
with:
name: android-test-report-api${{ matrix.api-level }}
path: app/build/reports/androidTests/connected/**
2021-01-06 16:32:33 +01:00
2021-12-19 12:18:37 +01:00
sonar:
runs-on: ubuntu-latest
permissions:
contents: read
2021-12-19 12:18:37 +01:00
steps:
- uses: actions/checkout@v3
2021-12-19 12:18:37 +01:00
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
2021-12-19 12:18:37 +01:00
- name: Set up JDK 11
uses: actions/setup-java@v3
2021-12-19 12:18:37 +01:00
with:
java-version: 11 # Sonar requires JDK 11
distribution: "temurin"
cache: 'gradle'
2021-12-19 12:18:37 +01:00
- name: Cache SonarCloud packages
uses: actions/cache@v3
2021-12-19 12:18:37 +01:00
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
2021-12-19 12:18:37 +01:00
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew build sonarqube --info