Skip to content

The only downloader you need. 下载器的集大成者。

ci: 构建前在四个平台跑测试

XiaoYouChR4394e0a1b9a2
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b6fd4b1c..f4c6158a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -56,7 +56,15 @@ permissions:
contents: write
jobs:
+ test:
+ permissions:
+ contents: read
+ uses: ./.github/workflows/test.yml
+ secrets:
+ ANDROID_REPO_TOKEN: ${{ secrets.ANDROID_REPO_TOKEN }}
+
prepare:
+ needs: [test]
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
@@ -155,7 +163,7 @@ jobs:
fetch-depth: 0
- name: Set up uv
- uses: astral-sh/setup-uv@v7
+ uses: astral-sh/[email protected]
- name: Install dependencies
run: |
@@ -354,7 +362,7 @@ jobs:
brew cleanup openssl@3
- name: Set up uv
- uses: astral-sh/setup-uv@v7
+ uses: astral-sh/[email protected]
- name: Install dependencies
run: |
@@ -571,7 +579,7 @@ jobs:
fetch-depth: 0
- name: Set up uv
- uses: astral-sh/setup-uv@v7
+ uses: astral-sh/[email protected]
- name: Install dependencies
run: |
@@ -925,7 +933,7 @@ jobs:
fetch-depth: 0
- name: Set up uv
- uses: astral-sh/setup-uv@v7
+ uses: astral-sh/[email protected]
- name: Install Python
run: uv python install 3.13
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 00000000..79be4b31
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,91 @@
+name: Test
+
+on:
+ workflow_dispatch:
+ workflow_call:
+ secrets:
+ ANDROID_REPO_TOKEN:
+ required: true
+
+permissions:
+ contents: read
+
+env:
+ QT_QPA_PLATFORM: offscreen
+
+jobs:
+ desktop:
+ strategy:
+ fail-fast: false
+ matrix:
+ runner: [windows-2022, macos-14, ubuntu-22.04]
+ runs-on: ${{ matrix.runner }}
+ timeout-minutes: 15
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+
+ - name: Set up uv
+ uses: astral-sh/[email protected]
+
+ - name: Install system libraries
+ if: runner.os == 'Linux'
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y libegl1-mesa-dev libzstd1
+
+ - name: Install dependencies
+ run: |
+ uv python install 3.13
+ uv sync --locked
+
+ - name: Run tests
+ run: uv run pytest
+
+ android:
+ runs-on: ubuntu-24.04
+ timeout-minutes: 15
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+
+ - name: Checkout Android
+ uses: actions/checkout@v7
+ with:
+ repository: XiaoYouChR/Ghost-Downloader-Android
+ token: ${{ secrets.ANDROID_REPO_TOKEN }}
+ path: android
+ persist-credentials: false
+
+ - name: Set up uv
+ uses: astral-sh/[email protected]
+
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y libegl1-mesa-dev libzstd1
+ uv python install 3.13
+ uv sync --locked
+
+ - name: Run Python tests
+ run: uv run pytest tests/test_android.py
+
+ - uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version: '17'
+
+ - name: Set up Chaquopy build Python
+ uses: actions/setup-python@v7
+ with:
+ python-version: '3.14'
+
+ - uses: gradle/actions/setup-gradle@v6
+
+ - name: Run Kotlin tests without Android wheels
+ working-directory: android
+ run: ./gradlew :app:testDebugUnitTest -x installDebugPythonRequirements