Merge pull request #1 from malmeloo/flexible-libs #22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run unit tests | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
pull_request: | |
jobs: | |
dl-apk: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Apple Music APK file | |
run: wget -O applemusic.apk https://anisette.dl.mikealmel.ooo/apk | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: applemusic | |
path: applemusic.apk | |
if-no-files-found: error | |
retention-days: 1 | |
versions: | |
runs-on: ubuntu-latest | |
outputs: | |
py-versions: ${{ steps.supported-versions.outputs.py-versions }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: "pyproject.toml" | |
- name: Install dependencies | |
run: uv sync --all-extras --dev | |
- id: supported-versions | |
name: Get supported versions | |
run: | | |
set -e | |
echo "py-versions=$(uv run ./scripts/supported_py_versions.py)" >> "$GITHUB_OUTPUT" | |
test: | |
runs-on: ubuntu-latest | |
needs: | |
- dl-apk | |
- versions | |
strategy: | |
matrix: | |
py-version: ${{ fromJson(needs.versions.outputs.py-versions) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: applemusic | |
- name: Install uv and set the python version | |
uses: astral-sh/setup-uv@v5 | |
with: | |
python-version: ${{ matrix.py-version }} | |
- name: Install dependencies | |
run: uv sync --all-extras --dev | |
- name: Run unit tests | |
run: uv run pytest | |
results: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- run: | | |
result="${{ needs.test.result }}" | |
if [[ $result == "success" || $result == "skipped" ]]; then | |
exit 0 | |
else | |
exit 1 | |
fi |