-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (69 loc) · 2.41 KB
/
Copy pathtests.yml
File metadata and controls
89 lines (69 loc) · 2.41 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
name: Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: # Manual trigger
jobs:
test:
name: Run tests - ${{ matrix.os }} - ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
exclude:
- os: ubuntu-latest # Python 3.8 is not supported since ubuntu-24.04
python-version: '3.8'
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
#cache: 'pip' # Caching pip dependencies
- name: Install Tkinter for Python on Ubuntu
if: ${{ startsWith(matrix.os, 'ubuntu') }}
# Ignore the failure here and let other steps fail,
# it allows 'act' to test actions locally.
run: sudo apt-get install python3-tk -y || true
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install the package with dependencies
run: python -m pip install '.[dev]'
- name: Test with pytest
run: |
python -m pip install pytest
pytest
check:
name: Check code quality - ${{ matrix.os }} - ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
# Doesn't work in GitHub actions with Python 3.10+ due to Tkinter.
# A package python3-tk must be installed via apt with newer Python.
python-version: ['3.9']
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install the package with dependencies
run: python -m pip install '.[dev]'
- name: Validate pyproject.toml
run: python -m validate_pyproject pyproject.toml
- name: Check the code with flake8
run: python -m flake8 src tests --count --statistics
- name: Check the code with pylint
run: python -m pylint src