Skip to content

Remove Python 3.7 and add Python 3.12 in CI/CD #300

Remove Python 3.7 and add Python 3.12 in CI/CD

Remove Python 3.7 and add Python 3.12 in CI/CD #300

Workflow file for this run

name: Python CI/CD
on:
push:
pull_request:
release:
types:
- published
jobs:
build-and-test:
name: 'Python${{ matrix.python-version }}@${{ matrix.os }}'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- 3.8
- 3.9
- "3.10"
- "3.11"
- "3.12"
os:
- ubuntu-20.04
- macos-latest
- windows-latest
include:
- optional: false
steps:
- uses: actions/checkout@master
- run: git fetch --prune --unshallow
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install cmake-build-extensions
run: pip install wheel && pip install -v .[all]
- name: Example dependencies [Windows]
if: contains(matrix.os, 'windows')
shell: bash
run: |
choco install -y swig
vcpkg install --triplet x64-windows eigen3
- name: Example dependencies [macOS]
if: contains(matrix.os, 'macOS')
run: |
brew install swig eigen
# https://cibuildwheel.readthedocs.io/en/stable/cpp_standards
echo "MACOSX_DEPLOYMENT_TARGET=10.14" >> $GITHUB_ENV
- name: Example dependencies [Ubuntu]
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt update
sudo apt install build-essential swig libeigen3-dev
- name: Build and install example
continue-on-error: ${{ matrix.optional }}
working-directory: example
run: pip install -v .[all]
env:
# Pretend to be using cibuildwheel
CIBUILDWHEEL: 1
- name: Test example
continue-on-error: ${{ matrix.optional }}
working-directory: example
run: pytest
publish:
name: Publish to PyPI
needs: build-and-test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- run: git fetch --prune --unshallow
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Python tools
run: pip install build
- name: Create distributions
run: python -m build -o dist/
- name: Inspect dist folder
run: ls -lah dist/
- name: Check wheel
run: test $(find dist/ -name *-none-any.whl | wc -l) -gt 0
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
path: dist/*
name: dist
- name: Publish to PyPI
if: |
github.repository == 'diegoferigo/cmake-build-extension' &&
((github.event_name == 'push' && github.ref == 'refs/heads/master') ||
(github.event_name == 'release'))
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
skip_existing: true