Skip to content

Python package tests #18

Python package tests

Python package tests #18

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package tests
on:
pull_request:
branches:
- '*'
workflow_dispatch:
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-13, macos-14 ]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13.0-rc.3"]
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 }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools cython
python -m pip install -e .[dev]
- name: Run tests in pure python mode
run: |
pytest tests --no-header --no-summary -v
if [ $? -ne 0 ]; then
echo "Pytest failed, running without capture"
pytest tests -v
else
echo "Pytest succeeded."
fi
shell: bash
if: runner.os != 'Windows'
- name: Run tests in pure python mode on Windows
run: |
pytest tests --no-header --no-summary -v
if %ERRORLEVEL% neq 0 (
echo Pytest failed, running without capture
pytest tests -v
) else (
echo Pytest succeeded.
)
shell: cmd
if: runner.os == 'Windows'
- name: Build cython modules
run: |
cd ./py_ballisticcalc.exts
python setup.py build_ext --inplace
cd ..
- name: Run unittest tests in binary mode
run: |
pytest tests --no-header --no-summary -v
if [ $? -ne 0 ]; then
echo "Pytest failed, running without capture"
pytest tests -v
else
echo "Pytest succeeded."
fi
shell: bash
if: runner.os != 'Windows'
- name: Run unittest tests in binary mode on Windows
run: |
pytest tests --no-header --no-summary -v
if %ERRORLEVEL% neq 0 (
echo Pytest failed, running without capture
pytest tests -v
) else (
echo Pytest succeeded.
)
shell: cmd
if: runner.os == 'Windows'