forked from music-assistant/server
-
Notifications
You must be signed in to change notification settings - Fork 2
104 lines (97 loc) · 3.5 KB
/
test.yml
File metadata and controls
104 lines (97 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# This workflow will install Python dependencies, run tests and lint
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Test
on:
push:
branches:
- stable
- dev
pull_request:
branches:
- stable
- dev
workflow_dispatch:
workflow_call:
inputs:
ref:
description: "Git ref to checkout"
required: false
type: string
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out code from GitHub
uses: actions/checkout@v6
with:
ref: ${{ inputs.ref || github.ref }}
- name: Set up Python
uses: actions/setup-python@v6.2.0
with:
python-version: "3.12"
# Cache apt .deb files to speed up ffmpeg installation (in home to avoid permission issues).
- name: Cache apt packages
uses: actions/cache@v5
with:
path: ~/.cache/apt-packages
key: apt-ffmpeg-${{ runner.os }}
- name: Install ffmpeg
run: |
# Restore cached .deb files to apt cache (if any)
sudo cp ~/.cache/apt-packages/*.deb /var/cache/apt/archives/ 2>/dev/null || true
sudo apt-get update && sudo apt-get install -y ffmpeg
# Save .deb files for next run
mkdir -p ~/.cache/apt-packages && cp /var/cache/apt/archives/*.deb ~/.cache/apt-packages/ 2>/dev/null || true
- name: Install uv
run: pip install uv
- name: Cache uv packages
uses: actions/cache@v5
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-3.12-${{ hashFiles('requirements_all.txt', 'pyproject.toml') }}
- name: Install dependencies
run: uv pip install --system . .[test] -r requirements_all.txt
- name: Lint/test with pre-commit
run: SKIP=no-commit-to-branch pre-commit run --all-files
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.12"
steps:
- name: Check out code from GitHub
uses: actions/checkout@v6
with:
ref: ${{ inputs.ref || github.ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6.2.0
with:
python-version: ${{ matrix.python-version }}
# Cache apt .deb files to speed up ffmpeg installation (in home to avoid permission issues).
- name: Cache apt packages
uses: actions/cache@v5
with:
path: ~/.cache/apt-packages
key: apt-ffmpeg-${{ runner.os }}
- name: Install ffmpeg
run: |
# Restore cached .deb files to apt cache (if any)
sudo cp ~/.cache/apt-packages/*.deb /var/cache/apt/archives/ 2>/dev/null || true
sudo apt-get update && sudo apt-get install -y ffmpeg
# Save .deb files for next run
mkdir -p ~/.cache/apt-packages && cp /var/cache/apt/archives/*.deb ~/.cache/apt-packages/ 2>/dev/null || true
- name: Install uv
run: pip install uv
- name: Cache uv packages
uses: actions/cache@v5
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements_all.txt', 'pyproject.toml') }}
- name: Install dependencies
run: uv pip install --system . .[test] -r requirements_all.txt
- name: Pytest
run: pytest --durations 10 --cov-report term-missing --cov=music_assistant --cov-report=xml tests/