Revert to unittest suite (vs pytest) #19
Workflow file for this run
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
name: Build and Test | |
on: [push] | |
jobs: | |
build-and-test: | |
name: build ${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: | |
- ubuntu | |
- macos | |
- windows | |
python-version: | |
- "8" | |
- "9" | |
- "10" | |
include: | |
- os: ubuntu | |
platform: linux | |
- os: windows | |
ls: dir | |
runs-on: ${{ format('{0}-latest', matrix.os) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up rust | |
uses: dtolnay/rust-toolchain@stable | |
- run: | | |
if [[ $(sysctl -n machdep.cpu.brand_string) =~ "Apple" ]]; then | |
rustup target add aarch64-apple-darwin; | |
else | |
rustup target add x86_64-apple-darwin; | |
fi | |
if: matrix.os == 'macos' | |
shell: bash | |
- name: set up python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.${{ matrix.python-version }}' | |
- name: install python dependencies | |
run: python -m pip install --upgrade pip setuptools wheel pytest twine cibuildwheel | |
- name: install FASTSim python | |
run: python -m pip install -e .[dev] | |
- name: run cargo tests | |
run: cargo test | |
- name: run pytest | |
run: pytest -v | |
- name: build source distribution | |
if: matrix.os == 'ubuntu' && matrix.python-version == '10' | |
run: | | |
pip install -U setuptools-rust | |
python -c "import setuptools; setuptools.setup()" sdist | |
- name: build ${{ matrix.platform || matrix.os }} binaries | |
run: cibuildwheel --output-dir dist | |
env: | |
CIBW_BUILD: "cp3${{ matrix.python-version }}-*" | |
CIBW_SKIP: "*-win32 *-musllinux* *i686 *ppc64le *s390x *aarch64" | |
CIBW_PLATFORM: ${{ matrix.platform || matrix.os }} | |
# CIBW_TEST_REQUIRES: pytest | |
# CIBW_TEST_COMMAND: "pytest -v {project}/python/fastsim/tests" | |
CIBW_TEST_COMMAND: "python -m unittest discover {project}/python/fastsim/tests" | |
CIBW_ARCHS_MACOS: "universal2" | |
# see https://cibuildwheel.readthedocs.io/en/stable/faq/#universal2 | |
CIBW_TEST_SKIP: "*_universal2:arm64" | |
CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH"' | |
CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"' | |
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" | |
CIBW_MANYLINUX_I686_IMAGE: "manylinux2014" | |
CIBW_BEFORE_BUILD: > | |
python -m pip install -U setuptools-rust pytest && | |
rustup default stable && | |
rustup show | |
CIBW_BEFORE_BUILD_LINUX: > | |
yum -y install openssl openssl-devel && | |
pip install -U setuptools-rust pytest && | |
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y && | |
rustup show | |
- name: list dist files | |
run: ${{ matrix.ls || 'ls -lh' }} dist/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ./dist/* | |