mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-11-14 05:44:55 +00:00
45d2492bcb
We don't seem to agree on which character to use as a separator between `release` and `X.X.X` in release branch names (e.g. `release-0.23.1` or `release/0.23.0`). All those names start with `release`, though, so let's use that to identify releases.
118 lines
3.3 KiB
YAML
118 lines
3.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
branches:
|
|
- dev
|
|
- master
|
|
- release**
|
|
paths-ignore:
|
|
- 'README.md'
|
|
- 'doc/**'
|
|
- 'fastlane/**'
|
|
- 'assets/**'
|
|
- '.github/**/*.md'
|
|
- '.github/FUNDING.yml'
|
|
- '.github/ISSUE_TEMPLATE/**'
|
|
push:
|
|
branches:
|
|
- dev
|
|
- master
|
|
paths-ignore:
|
|
- 'README.md'
|
|
- 'doc/**'
|
|
- 'fastlane/**'
|
|
- 'assets/**'
|
|
- '.github/**/*.md'
|
|
- '.github/FUNDING.yml'
|
|
- '.github/ISSUE_TEMPLATE/**'
|
|
|
|
jobs:
|
|
build-and-test-jvm:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: gradle/wrapper-validation-action@v1
|
|
|
|
- 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 }}
|
|
|
|
- name: set up JDK 11
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
java-version: 11
|
|
distribution: "temurin"
|
|
cache: 'gradle'
|
|
|
|
- name: Build debug APK and run jvm tests
|
|
run: ./gradlew assembleDebug lintDebug testDebugUnitTest --stacktrace -DskipFormatKtlint
|
|
|
|
- name: Upload APK
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: app
|
|
path: app/build/outputs/apk/debug/*.apk
|
|
|
|
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 ]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: set up JDK 11
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
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/**
|
|
|
|
sonar:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
|
|
|
- name: Set up JDK 11
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
java-version: 11 # Sonar requires JDK 11
|
|
distribution: "temurin"
|
|
cache: 'gradle'
|
|
|
|
- name: Cache SonarCloud packages
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.sonar/cache
|
|
key: ${{ runner.os }}-sonar
|
|
restore-keys: ${{ runner.os }}-sonar
|
|
|
|
- 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
|