Update workflow to try to get macos to build #30
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.base }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: | |
#- base: ubuntu | |
# version: latest | |
- base: macos | |
version: 13 | |
arch: 'x86_64' | |
- base: macos | |
version: 14 | |
arch: 'arm64' | |
#- base: windows | |
# version: latest | |
# arch: 'amd64' | |
python-version: | |
#- "8" | |
#- "9" | |
- "10" | |
#include: | |
# - os: ubuntu | |
# platform: linux | |
# - os: windows | |
# ls: dir | |
runs-on: ${{ format('{0}-{1}', matrix.os.base, matrix.os.version) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: set up rust | |
uses: dtolnay/rust-toolchain@stable | |
- run: rustup target add aarch64-apple-darwin | |
if: matrix.os.base == 'macos' && matrix.os.version == '14' | |
- run: rustup target add x86_64-apple-darwin | |
if: matrix.os.base == 'macos' && matrix.os.version == '13' | |
- name: run cargo tests | |
run: cargo test | |
- 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 pytest | |
run: pytest -v | |
- name: build source distribution | |
if: matrix.os.base == '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 }} | |
# # TODO: why doesn't pytest work with cibuildwheel? | |
# # 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: "*_arm64 *_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 && | |
# rustup default stable && | |
# rustup show | |
# CIBW_BEFORE_BUILD_LINUX: > | |
# yum -y install openssl openssl-devel && | |
# pip install -U setuptools-rust && | |
# curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y && | |
# rustup show | |
- name: build ${{ matrix.platform || matrix.os.base }} binaries | |
run: python -m 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 }} | |
# TODO: why doesn't pytest work with cibuildwheel? | |
# CIBW_TEST_COMMAND: "pytest -v {project}/python/fastsim/tests" | |
CIBW_TEST_COMMAND: "python -m unittest discover {project}/python/fastsim/tests" | |
CIBW_ARCHS: "auto64" | |
# CIBW_ARCHS_MACOS: "universal2" | |
# see https://cibuildwheel.readthedocs.io/en/stable/faq/#universal2 | |
# CIBW_TEST_SKIP: "*-macosx_arm64 *_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: > | |
# pip install -U setuptools-rust && | |
# rustup default stable && | |
# rustup show | |
#CIBW_BEFORE_BUILD_LINUX: > | |
# yum -y install openssl openssl-devel && | |
# pip install -U setuptools-rust && | |
# curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y && | |
# rustup show | |
#CIBW_BUILD_VERBOSITY: 1 | |
- name: list dist files | |
run: ${{ matrix.ls || 'ls -lh' }} dist/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: fastsim-${{ matrix.platform || matrix.os.base }}-py3.${{ matrix.python }}-${{ strategy.job-index }} | |
path: ./dist/* | |