-
Notifications
You must be signed in to change notification settings - Fork 108
125 lines (117 loc) · 4.59 KB
/
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Tests
on:
push:
branches: [ test, tests ]
pull_request:
branches: [ master, development, develop, test, tests ]
jobs:
package-checks:
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# - uses: actions/cache@v3
# with:
# path: ~/.cache/pip
# key: package-check-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-test.txt') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-test.txt
pip install coveralls flake8 flake8-print mypy setuptools wheel twine Cython>=3.0.11
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors, undefined names or print statements
flake8 box --count --select=E9,F63,F7,F82,T001,T002,T003,T004 --show-source --statistics
# exit-zero treats all errors as warnings.
flake8 . --count --exit-zero --max-complexity=20 --max-line-length=120 --statistics --extend-ignore E203
- name: Run mypy
run: mypy box
- name: Build Wheel and check distribution log description
run: |
python setup.py sdist bdist_wheel
twine check dist/*
- name: Test packaged wheel on *nix
if: matrix.os != 'windows-latest'
run: |
pip install dist/*.whl
rm -rf box
python -m pytest -vv
- name: Test packaged wheel on Windows
if: matrix.os == 'windows-latest'
run: |
$wheel = (Get-ChildItem dist\*.whl | Sort lastWriteTime | Select-Object -last 1).Name
pip install dist\${wheel}
Remove-item box -recurse -force
python -m pytest -vv
- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: python_box_${{matrix.os}}_${{ matrix.python-version }}
path: dist/*.whl
package-manylinux-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
# - uses: actions/cache@v3
# with:
# path: ~/.cache/pip
# key: package-manylinux-check-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-test.txt') }}
- name: Build wheels
run: |
python -m pip install --upgrade pip
pip install cibuildwheel
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64
CIBW_BEFORE_BUILD: pip install Cython>=3.0.11 setuptools wheel
CIBW_BEFORE_TEST: pip install -r requirements.txt -r requirements-test.txt setuptools wheel twine Cython>=3.0.11
CIBW_BUILD_VERBOSITY: 1
CIBW_TEST_COMMAND: pytest {package}/test -vv
- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: python_box_manylinux
path: dist/*-manylinux*.whl
test:
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# - uses: actions/cache@v3
# with:
# path: ~/.cache/pip
# key: test-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-test.txt') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-test.txt
pip install setuptools wheel Cython>=3.0.11
python setup.py build_ext --inplace
- name: Test with pytest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pytest --cov=box -vv test/