-
-
Notifications
You must be signed in to change notification settings - Fork 387
147 lines (140 loc) · 4.83 KB
/
run-tests.yml
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
name: Run tests
on: [push, pull_request]
permissions: {}
jobs:
test-latest:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12, ubuntu-latest, windows-2019]
python-version: ['3.9', '3.10', '3.11', '3.12']
include:
- os: macos-11
python-version: '3.9'
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies (Linux)
if: runner.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install libegl1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools
pip install -r requirements.txt
- name: Install gettext (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install gettext
- name: Install gettext (macOS)
if: runner.os == 'macOS'
run: |
brew install gettext
brew link gettext --force
echo "/usr/local/opt/gettext/bin" >> $GITHUB_PATH
- name: Check coding style
run: |
pip install flake8 "isort>=5"
flake8 picard test --count --show-source --statistics
isort --check-only --diff --recursive picard test
- name: Test with pytest
if: always()
timeout-minutes: 30
run: |
python setup.py build_locales -i
pip install pytest pytest-randomly pytest-cov
pytest --verbose --cov=picard --cov-report xml:coverage.xml test
- name: Submit code coverage to Codacy
if: env.CODACY_PROJECT_TOKEN
run: |
pip install codacy-coverage
python-codacy-coverage -r coverage.xml
test-requirements:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.9']
dependencies: [
"PyQt6==6.5.3 PyQt6-Qt6==6.5.3 mutagen==1.37 python-dateutil==2.7 PyYAML==5.1", # minimal versions, minimum dependencies
"PyQt6>=6.5.3 mutagen~=1.37 python-dateutil~=2.7 PyYAML~=6.0 discid==1.0",
"PyQt6>=6.5.3 mutagen~=1.37 python-dateutil~=2.7 PyYAML~=6.0 python-libdiscid",
"PyQt6>=6.5.3 mutagen~=1.37 python-dateutil~=2.7 PyYAML~=6.0 charset-normalizer==2.0.6",
"PyQt6>=6.5.3 mutagen~=1.37 python-dateutil~=2.7 PyYAML~=6.0 chardet==3.0.4",
]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies (Linux)
if: runner.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install libdiscid-dev libegl1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install $DEPENDENCIES
env:
DEPENDENCIES: ${{ matrix.dependencies }}
- name: Test with pytest
timeout-minutes: 30
run: |
pip install pytest pytest-randomly pytest-cov
pytest --verbose test
pip-install: # Test whether a clean pip install from source works
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12, ubuntu-latest, windows-latest]
python-version: ['3.9', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install gettext and libegl1 (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install gettext libegl1
- name: Install gettext (macOS)
if: runner.os == 'macOS'
run: |
brew install gettext
brew link gettext --force
echo "/usr/local/opt/gettext/bin" >> $GITHUB_PATH
- name: Install gettext (Windows)
if: runner.os == 'Windows'
run: |
& .\scripts\package\win-setup-gettext.ps1 `
-GettextVersion $Env:GETTEXT_VERSION -GettextSha256Sum $Env:GETTEXT_SHA256SUM
Add-Content $env:GITHUB_PATH (Join-Path -Path (Resolve-Path .) -ChildPath gettext\bin)
env:
GETTEXT_VERSION: 0.22.4
GETTEXT_SHA256SUM: 220068ac0b9e7aedda03534a3088e584640ac1e639800b3a0baa9410aa6d012a
- name: Run pip install .
run: |
python -m pip install --upgrade pip
pip install .
- name: Test running installed package
if: runner.os != 'Windows'
run: picard --long-version --no-crash-dialog
- name: Verify sdist package
if: runner.os != 'Windows'
timeout-minutes: 30
run: |
pip install --upgrade setuptools
pip install pytest
scripts/package/run-sdist-test.sh