forked from misiektoja/spotify_monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (153 loc) · 6.54 KB
/
Copy pathtests.yml
File metadata and controls
162 lines (153 loc) · 6.54 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
name: Tests
on:
push:
branches: [main, dev]
pull_request:
workflow_dispatch:
workflow_call:
permissions: {}
jobs:
lint:
name: ruff
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.13"
- name: Install the pinned linter
run: python -m pip install ".[lint]"
- name: Lint the module, debug helpers and the test suite
run: python -m ruff check spotify_monitor.py debug tests
test:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Install project test dependencies
run: python -m pip install ".[test]"
- name: Run offline tests
run: python -m pytest
extras:
name: Install ${{ matrix.extra }} extra
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
extra: [legacy-oauth, browser, notification-images]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.13"
- name: Install optional extra
run: python -m pip install ".[${{ matrix.extra }}]"
- name: Verify installed dependencies
run: python -m pip check
quality:
name: Type and coverage checks
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.13"
- name: Install project quality dependencies
run: python -m pip install ".[test,legacy-oauth,browser]" -r debug/spotify_monitor_secret_grabber_docker/requirements.txt
- name: Run pyright with the selected interpreter
run: python -m pyright --pythonpath "$(command -v python)" spotify_monitor.py debug tests
- name: Run subprocess-aware branch coverage
env:
COVERAGE_FILE: ${{ github.workspace }}/local/coverage-data/.coverage
run: mkdir -p local/coverage-data && python -m coverage run -m pytest && python -m coverage combine local/coverage-data && python -m coverage report
docs-check:
name: Documentation strict build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.13"
- name: Install documentation dependencies
run: python -m pip install -r docs/requirements.txt
- name: Build documentation with strict validation
run: python -m mkdocs build --strict --site-dir local/docs-site
windows-setup-smoke:
name: Windows setup and startup smoke checks
runs-on: windows-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.14"
- name: Install project test dependencies
run: python -m pip install ".[test]"
- name: Run setup and startup tests
run: python -m pytest tests/test_setup_wizard.py tests/test_install_method_commands.py tests/test_startup_ui.py tests/test_config_and_inputs.py tests/test_packaging.py
container-smoke:
name: Main container smoke checks
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Build local smoke image
run: docker build --tag spotify-monitor:ci .
- name: Confirm Python 3.13 runtime
run: docker run --rm --entrypoint /usr/local/bin/python spotify-monitor:ci --version | grep -E '^Python 3\.13\.'
- name: Run application version and help
run: |
docker run --rm spotify-monitor:ci --version
docker run --rm spotify-monitor:ci --help
- name: Confirm noninteractive setup guidance
run: |
mkdir -p local/container-smoke
if docker run --rm spotify-monitor:ci --setup >local/container-smoke/setup-output.txt 2>&1; then
echo "Noninteractive setup unexpectedly succeeded"
exit 1
fi
grep -E "interactive terminal" local/container-smoke/setup-output.txt
- name: Generate a config through the container
run: |
mkdir -p local/container-smoke
docker run --rm --user "$(id -u):$(id -g)" -v "$PWD/local/container-smoke:/data:z" spotify-monitor:ci --generate-config /data/spotify_monitor.conf
test -s local/container-smoke/spotify_monitor.conf
if grep -Ev '^[[:space:]]*(#|$)' local/container-smoke/spotify_monitor.conf | grep -E 'LIVE-|secret-cookie|refresh-token'; then
echo "Generated config contains a test secret marker"
exit 1
fi
- name: Validate Docker Compose configuration
run: docker compose -f docker-compose.yml config
- name: Run the locally built image through Docker Compose
run: |
mkdir -p local/container-smoke
docker tag spotify-monitor:ci misiektoja/spotify-monitor:latest
SPOTIFY_MONITOR_UID="$(id -u)" SPOTIFY_MONITOR_GID="$(id -g)" docker compose -f docker-compose.yml run --rm --pull=never spotify_monitor --version
SPOTIFY_MONITOR_UID="$(id -u)" SPOTIFY_MONITOR_GID="$(id -g)" docker compose -f docker-compose.yml run --rm --pull=never spotify_monitor --generate-config /data/local/container-smoke/compose-spotify-monitor.conf
test -s local/container-smoke/compose-spotify-monitor.conf