Skip to content

Merge pull request #112 from lpsinger/missing-return-statements #190

Merge pull request #112 from lpsinger/missing-return-statements

Merge pull request #112 from lpsinger/missing-return-statements #190

Workflow file for this run

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
steps:
- name: "Checkout branch ${{ github.head_ref }}"
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- 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{37,38,39,310,311}-*/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 -r requirements/tests.txt
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.7', '3.8', '3.9', '3.10', '3.11']
steps:
# Checkout the project
- name: "Checkout branch ${{ github.head_ref }}"
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
# 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@v4
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 aarch64-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 -r requirements/tests.txt
# 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.7', '3.8', '3.9', '3.10', '3.11']
steps:
# Checkout the project
- name: "Checkout branch ${{ github.head_ref }}"
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
# 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@v4
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 -r requirements\tests.txt
# Run tests
python -m pytest -v -s python\mocpy
deactivate