mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-27 23:40:36 +05:30
Improve github workflow
* Cache gradle wrapper distributions * Don't always show gradle welcome message * Deduplicated code * Make it possible to select downloader and manually execute a run
This commit is contained in:
parent
b0cc9d47ce
commit
d44b520a90
28
.github/workflows/ci.yml
vendored
28
.github/workflows/ci.yml
vendored
@ -1,6 +1,14 @@
|
|||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
downloaderType:
|
||||||
|
description: 'Downloader Type'
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- MOCK
|
||||||
|
- REAL
|
||||||
schedule:
|
schedule:
|
||||||
# once per day
|
# once per day
|
||||||
- cron: 0 0 * * *
|
- cron: 0 0 * * *
|
||||||
@ -25,6 +33,13 @@ jobs:
|
|||||||
java-version: '11'
|
java-version: '11'
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|
||||||
|
- name: Cache Gradle wrapper dists
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/wrapper/dists
|
||||||
|
key: ${{ runner.os }}-gradle-wrapper-dists-${{ hashFiles('gradle/wrapper/**') }}
|
||||||
|
restore-keys: ${{ runner.os }}-gradle-wrapper-dists
|
||||||
|
|
||||||
- name: Cache Gradle dependencies
|
- name: Cache Gradle dependencies
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
@ -35,14 +50,17 @@ jobs:
|
|||||||
# See gradle file for difference between downloaders
|
# See gradle file for difference between downloaders
|
||||||
- name: Build and run Tests
|
- name: Build and run Tests
|
||||||
run: |
|
run: |
|
||||||
|
downloader_type="${{ github.event.inputs.downloaderType || 'MOCK' }}"
|
||||||
if [[ "$GITHUB_EVENT_NAME" == 'schedule' ]]; then
|
if [[ "$GITHUB_EVENT_NAME" == 'schedule' ]]; then
|
||||||
echo running with real downloader
|
downloader_type="REAL"
|
||||||
./gradlew check --stacktrace -Ddownloader=REAL
|
|
||||||
else
|
|
||||||
echo running with mock downloader
|
|
||||||
./gradlew check --stacktrace -Ddownloader=MOCK
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Running with $downloader_type downloader"
|
||||||
|
./gradlew check \
|
||||||
|
-Dorg.gradle.welcome=never \
|
||||||
|
--stacktrace \
|
||||||
|
-Ddownloader=$downloader_type
|
||||||
|
|
||||||
- name: Upload test reports when failure occurs
|
- name: Upload test reports when failure occurs
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
if: failure()
|
if: failure()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user