1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 08:30:44 +00:00
NewPipe/.github/workflows/ci.yml

143 lines
3.6 KiB
YAML
Raw Normal View History

2020-12-09 06:55:57 +00:00
name: CI
2021-03-08 12:15:22 +00:00
on:
workflow_dispatch:
2021-03-08 12:15:22 +00:00
pull_request:
branches:
2021-03-08 12:19:18 +00:00
- dev
- master
- refactor
- release**
paths-ignore:
2022-02-04 10:13:10 +00:00
- 'README.md'
- 'doc/**'
- 'fastlane/**'
- 'assets/**'
- '.github/**/*.md'
2022-02-04 10:32:33 +00:00
- '.github/FUNDING.yml'
- '.github/ISSUE_TEMPLATE/**'
2021-03-08 12:15:22 +00:00
push:
2021-03-21 01:47:19 +00:00
branches:
2021-03-08 12:19:18 +00:00
- dev
- master
paths-ignore:
2022-02-04 10:13:10 +00:00
- 'README.md'
- 'doc/**'
- 'fastlane/**'
- 'assets/**'
- '.github/**/*.md'
2022-02-04 10:32:33 +00:00
- '.github/FUNDING.yml'
- '.github/ISSUE_TEMPLATE/**'
2020-12-09 06:55:57 +00:00
jobs:
2021-01-06 15:32:33 +00:00
build-and-test-jvm:
2020-12-09 06:55:57 +00:00
runs-on: ubuntu-latest
permissions:
contents: read
2020-12-09 06:55:57 +00:00
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
2020-12-09 06:55:57 +00:00
- name: create and checkout branch
# push events already checked out the branch
if: github.event_name == 'pull_request'
env:
BRANCH: ${{ github.head_ref }}
run: git checkout -B "$BRANCH"
2024-10-22 18:57:21 +00:00
- name: set up JDK
uses: actions/setup-java@v4
2020-12-09 06:55:57 +00:00
with:
2024-10-22 18:57:21 +00:00
java-version: 21
distribution: "temurin"
cache: 'gradle'
2021-01-06 15:32:33 +00:00
- name: Build debug APK and run jvm tests
run: ./gradlew assembleDebug lintDebug testDebugUnitTest --stacktrace -DskipFormatKtlint
2020-12-09 06:55:57 +00:00
- name: Upload APK
uses: actions/upload-artifact@v4
2020-12-09 06:55:57 +00:00
with:
name: app
path: app/build/outputs/apk/debug/*.apk
2021-01-06 15:32:33 +00:00
test-android:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
2023-04-20 09:31:45 +00:00
include:
- api-level: 21
target: default
arch: x86
- api-level: 33
target: google_apis # emulator API 33 only exists with Google APIs
arch: x86_64
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
2024-10-22 18:57:21 +00:00
- name: set up JDK
uses: actions/setup-java@v4
with:
2024-10-22 18:57:21 +00:00
java-version: 21
distribution: "temurin"
cache: 'gradle'
- name: Run android tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
2023-04-20 09:31:45 +00:00
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
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@v4
if: failure()
with:
name: android-test-report-api${{ matrix.api-level }}
path: app/build/reports/androidTests/connected/**
2021-01-06 15:32:33 +00:00
2021-12-19 11:18:37 +00:00
sonar:
runs-on: ubuntu-latest
permissions:
contents: read
2021-12-19 11:18:37 +00:00
steps:
- uses: actions/checkout@v4
2021-12-19 11:18:37 +00:00
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
2024-10-22 18:57:21 +00:00
- name: Set up JDK
uses: actions/setup-java@v4
2021-12-19 11:18:37 +00:00
with:
2024-10-22 18:57:21 +00:00
java-version: 21
2021-12-19 11:18:37 +00:00
distribution: "temurin"
cache: 'gradle'
2021-12-19 11:18:37 +00:00
- name: Cache SonarCloud packages
uses: actions/cache@v4
2021-12-19 11:18:37 +00:00
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
2021-12-19 11:18:37 +00:00
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2022-11-29 16:20:31 +00:00
run: ./gradlew build sonar --info