Skip to content

Fix gh-actions

Fix gh-actions #17

Workflow file for this run

# Adapted from https://github.com/RalfG/python-wheels-manylinux-build/blob/master/full_workflow_example.yml
name: libmcphase
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, reopened, synchronize]
release:
types: [published]
workflow_dispatch:
concurrency :
group: ${{ github.workflow }}-${{ github.ref == 'refs/head/main' && github.run_number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -l {0}
jobs:
build_and_test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
name: Build and test, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: mamba-org/setup-micromamba@v1
with:
cache-downloads: true
- name: Build wheels
run: |
$MAMBA_EXE create -n cibuildwheel python=3.12
eval "$($MAMBA_EXE shell activate cibuildwheel)"
python -m pip install cibuildwheel
if [[ $OSTYPE == "darwin23" ]] || [[ $OSTYPE == "darwin22" ]]
then
# For some reason cibuildwheel on builds 3.9-3.12 arm64 on macos-latest
CIBW_BUILD="cp39* cp310* cp311* cp312*" CIBW_ARCHS_MACOS="native" python -m cibuildwheel --output-dir wheelhouse
else
python -m cibuildwheel --output-dir wheelhouse
fi
env:
CIBW_BUILD: "cp38-* cp39* cp310-* cp311-* cp312-*"
CIBW_SKIP: "*musllinux* *win32* *i686*"
CIBW_ARCHS_MACOS: "universal2"
CIBW_BUILD_VERBOSITY: 1
- name: Install wheels and run test
run: |
# set -e makes sure the script fails if any command in the loop fails
set -e
if [[ $OSTYPE == "darwin23" ]] || [[ $OSTYPE == "darwin22" ]]
then
export PYVERS="3.9 3.10 3.11 3.12"
else
export PYVERS="3.8 3.9 3.10 3.11 3.12"
fi
for pyver in $PYVERS
do
$MAMBA_EXE create -n py$pyver -c conda-forge python=$pyver numpy
eval "$($MAMBA_EXE shell activate py$pyver)"
python -m pip install wheelhouse/*cp$(echo $pyver | sed s/\\.//)*
cd tests
python -m unittest
cd ..
done
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}_artifacts.zip
path: wheelhouse/*
- name: Setup tmate
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
#- name: Publish wheels to PyPI
# if: ${{ github.event_name == 'release' }}
# env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
# run: |
# twine upload wheelhouse/*