Repository navigation
226 lines (203 loc) · 7.02 KB
/
Copy pathci.yaml
File metadata and controls
226 lines (203 loc) · 7.02 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
name: Test
on:
pull_request:
merge_group:
push:
branches:
- master
concurrency:
# Cancel previous workflow run when a new commit is pushed to a feature branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
PY_COLORS: 1
jobs:
base-install:
name: Test base installation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v10.3.3
with:
python-version: "3.11"
- name: Install Python tools
run: uv tool install "poethepoet>=0.26,<0.47.0"
- name: Install base dependencies
run: poe install --no-dev
- name: Run beets
env:
BEETSDIR: ${{ runner.temp }}/beets
run: uv run --no-sync beet version
test:
name: Run tests
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]
runs-on: ${{ matrix.platform }}
env:
IS_MAIN_PYTHON: ${{ matrix.python-version == '3.11' && matrix.platform == 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v10.3.3
with:
python-version: ${{ matrix.python-version }}
- name: Install Python tools
run: uv tool install "poethepoet>=0.26,<0.47.0"
- name: Set up MSYS2 with bash-completion
if: matrix.platform == 'windows-latest'
id: msys2
uses: msys2/setup-msys2@v2
with:
msystem: MSYS
update: true
install: bash-completion
- name: Configure MSYS2 environment
if: matrix.platform == 'windows-latest'
shell: pwsh
run: |
"MSYS2_ROOT=${{ steps.msys2.outputs.msys2-location }}" >> $env:GITHUB_ENV
"BEETS_TEST_SHELL=${{ steps.msys2.outputs.msys2-location }}\usr\bin\bash.exe --norc" >> $env:GITHUB_ENV
- name: Install system dependencies on Windows
if: matrix.platform == 'windows-latest'
shell: pwsh
run: |
# Chocolatey install scripts download from upstream hosts (xiph,
# SourceForge, ...) that drop connections now and then, so retry
# each package on its own with backoff.
function Install-ChocoPackage([string]$Name, [string[]]$ExtraArgs = @()) {
$maxAttempts = 5
for ($attempt = 1; $attempt -le $maxAttempts; $attempt++) {
choco install $Name -y --no-progress @ExtraArgs
if ($LASTEXITCODE -eq 0) {
return
}
if ($attempt -eq $maxAttempts) {
throw "$Name install failed after $maxAttempts attempts."
}
$delay = 5 * [math]::Pow(2, $attempt - 1)
Write-Host "$Name install failed (attempt $attempt), retrying in ${delay}s"
Start-Sleep -Seconds $delay
}
}
Install-ChocoPackage ffmpeg
Install-ChocoPackage flac
Install-ChocoPackage imagemagick
# mp3gain has no upstream checksums
Install-ChocoPackage mp3gain -ExtraArgs '--allow-empty-checksums'
- name: Install system dependencies on Ubuntu
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install --yes --no-install-recommends \
bash-completion \
btrfs-progs \
ffmpeg \
flac \
gobject-introspection \
gstreamer1.0-plugins-good \
imagemagick \
libcairo2-dev \
libgirepository-2.0-dev \
mp3gain \
pandoc \
python3-gst-1.0 \
unrar
- name: Provide a reflink-capable temporary directory on Ubuntu
if: matrix.platform == 'ubuntu-latest'
run: |
# The runner's disk is ext4, which cannot clone files. Back TMPDIR
# with a btrfs image so the reflink tests exercise real clones
# instead of quietly skipping.
image="$RUNNER_TEMP/reflink.img"
truncate -s 4G "$image"
mkfs.btrfs -q "$image"
sudo mkdir -p /mnt/reflink
sudo mount -o loop "$image" /mnt/reflink
sudo chown "$(id -u):$(id -g)" /mnt/reflink
# Clone within the mount: --reflink cannot cross filesystems.
echo probe > /mnt/reflink/probe.src
cp --reflink=always /mnt/reflink/probe.src /mnt/reflink/probe.dst
rm /mnt/reflink/probe.src /mnt/reflink/probe.dst
echo "TMPDIR=/mnt/reflink" >> "$GITHUB_ENV"
- name: Get changed lyrics files
id: lyrics-update
uses: tj-actions/changed-files@v47
with:
files: |
beetsplug/lyrics.py
test/plugins/test_lyrics.py
- name: Add pytest annotator
uses: liskin/gh-problem-matcher-wrap@v4
with:
linters: pytest
action: add
- if: ${{ env.IS_MAIN_PYTHON != 'true' }}
name: Test without coverage
shell: bash
run: |
poe install \
--group test \
--extra autobpm \
--extra discogs \
--extra embedart \
--extra import \
--extra lyrics \
--extra replaygain \
--extra reflink \
--extra fetchart \
--extra chroma \
--extra sonosupdate
poe test -n2 -k 'not test_convert_rst_to_md'
- if: ${{ env.IS_MAIN_PYTHON == 'true' }}
name: Test with coverage
shell: bash
env:
LYRICS_UPDATED: ${{ steps.lyrics-update.outputs.any_changed }}
run: |
poe install \
--group test \
--group docs \
--extra autobpm \
--extra discogs \
--extra embedart \
--extra import \
--extra lyrics \
--extra replaygain \
--extra reflink \
--extra fetchart \
--extra chroma \
--extra sonosupdate
poe docs
poe test-with-coverage -n2
- if: ${{ !cancelled() }}
name: Upload test results to Codecov
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- if: ${{ env.IS_MAIN_PYTHON == 'true' }}
name: Store the coverage report
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: .reports/coverage.xml
upload-coverage:
name: Upload coverage report
needs: test
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v7
- name: Get the coverage report
uses: actions/download-artifact@v8
with:
name: coverage-report
- name: Upload code coverage
uses: codecov/codecov-action@v7
with:
files: ./coverage.xml
use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}