Merge pull request #183 from cds-astro/support-3.13 #327
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: test-mocpy | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
# Allows to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
# Linux is specific: because of manylinux, we have to use a docker file | |
test-linux64-wheels: | |
runs-on: ubuntu-latest | |
# CentOS 7 64 bits Docker Hub image that 'build-linux64-wheels' executes in. | |
# See https://github.com/pypa/manylinux for this particular container: | |
# * CPython 3.7, 3.8, 3.9, 3.10 and 3.11 installed in /opt/python/<python tag>-<abi tag> | |
container: quay.io/pypa/manylinux2014_x86_64 | |
env: {ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true} # Allow using Node16 actions required for CentOS7 | |
steps: | |
- name: "Checkout branch ${{ github.head_ref }}" | |
uses: actions/checkout@v3 | |
- name: "Install Rust" | |
run: | | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
# Build and install locally wheels for all pre-installed python version (in /opt/python/, see docker image comment) | |
# We use maturin: https://github.com/PyO3/maturin#pypy | |
- name: "Build and test wheels" | |
run: | | |
source $HOME/.cargo/env | |
for PYBIN in /opt/python/cp*-cp3{8,9,10,11,12,13}/bin; do | |
echo "Loop on PYBIN: $PYBIN" | |
# With maturin develop, we have to use virtualenv | |
"${PYBIN}/pip" install virtualenv | |
"${PYBIN}/virtualenv" mocpy-env | |
source mocpy-env/bin/activate | |
pip install --upgrade pip | |
pip install maturin | |
maturin build --release --compatibility manylinux2014 | |
maturin develop --release | |
pip install .[dev] | |
python -m pytest -v -s python/mocpy | |
pip freeze > requirements-uninstall.txt | |
pip uninstall -r requirements-uninstall.txt -y | |
deactivate | |
rm -r mocpy-env/ | |
done | |
test-macos-wheels: | |
runs-on: macOS-latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
steps: | |
# Checkout the project | |
- name: "Checkout branch ${{ github.head_ref }}" | |
uses: actions/checkout@v4 | |
# Set up python, see https://docs.github.com/en/actions/guides/building-and-testing-python | |
- name: "Set up Python ${{ matrix.python-version }} on MacOS" | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Test python code | |
- name: "Build and test wheel for Python ${{ matrix.python-version }} on MacOS" | |
run: | | |
# Install, create and activate a python virtualenv | |
rustup target add x86_64-apple-darwin | |
pip install virtualenv | |
virtualenv mocpy-env | |
source mocpy-env/bin/activate | |
pip install --upgrade pip | |
# Install and use maturin | |
pip install maturin | |
maturin build --release --target universal2-apple-darwin | |
maturin develop --release | |
# Install dependencies | |
pip install .[dev] | |
# Run tests | |
python -m pytest -v -s python/mocpy | |
# Clean | |
pip freeze > requirements-uninstall.txt | |
pip uninstall -r requirements-uninstall.txt -y | |
deactivate | |
rm -r mocpy-env/ | |
test-windows-wheels: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
steps: | |
# Checkout the project | |
- name: "Checkout branch ${{ github.head_ref }}" | |
uses: actions/checkout@v4 | |
# Set up python, see https://docs.github.com/en/actions/guides/building-and-testing-python | |
- name: "Set up Python ${{ matrix.python-version }} on Windows" | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Test python code | |
- name: "Build and test wheel for Python ${{ matrix.python-version }} on Windows" | |
run: | | |
# Install, create and activate a python virtualenv | |
# See: https://mothergeo-py.readthedocs.io/en/latest/development/how-to/venv-win.html | |
pip install virtualenv | |
virtualenv mocpy-env | |
.\mocpy-env\Scripts\activate | |
# Install and use maturin | |
pip install maturin | |
maturin develop --release | |
# Install dependencies | |
pip install .[dev] | |
# Run tests | |
python -m pytest -v -s python\mocpy | |
deactivate |