Version 7.2.0 #296
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.8"] | |
os: [ubuntu-latest, macos-11, 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.0 | |
- 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.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- 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: cp38-manylinux_x86_64 cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 | |
CIBW_BEFORE_BUILD: pip install Cython==3.0.0 | |
CIBW_BEFORE_TEST: pip install -r requirements.txt -r requirements-test.txt setuptools wheel twine | |
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.8", "3.9", "3.10", "3.11", "3.12"] | |
os: [ubuntu-latest, macos-11, 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.0 | |
python setup.py build_ext --inplace | |
- name: Test with pytest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
pytest --cov=box -vv test/ |