Skip to content

Windows CI

Windows CI #111

Workflow file for this run

name: Test
on:
pull_request:
types:
- opened
- synchronize
push:
branches:
- main
tags:
- '*'
jobs:
test:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14" ]
compiler: ["default", "mingw", "msvc"]
exclude:
# MinGW and MSVC are Windows-only
- os: "ubuntu-latest"
compiler: "mingw"
- os: "ubuntu-latest"
compiler: "msvc"
- os: "macos-latest"
compiler: "mingw"
- os: "macos-latest"
compiler: "msvc"
name: Test (${{ matrix.python-version }}, ${{ matrix.os }}${{ matrix.os == 'windows-latest' && format(', {0}', matrix.compiler) || '' }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash -l {0}' }}
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v3
with:
mamba-version: "*"
channels: conda-forge
activate-environment: cppimport
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
- name: Install MinGW-w64 compiler (Windows MinGW)
if: ${{ matrix.os == 'windows-latest' && matrix.compiler == 'mingw' }}
run: |
conda install -y -c conda-forge gxx_win-64
- name: Install cppimport
run: |
pip install --no-deps -e .
- name: Lint with flake8
run: |
flake8 .
- name: Check formatting with black
run: |
black --check .
- name: Check import ordering with isort
run: |
isort --check .
- name: Test (macOS)
if: ${{ matrix.os == 'macos-latest' }}
run: |
CFLAGS='-stdlib=libc++' pytest --cov=./ --cov-report=xml
- name: Test (Windows MinGW)
if: ${{ matrix.os == 'windows-latest' && matrix.compiler == 'mingw' }}
run: |
pytest --cov=./ --cov-report=xml
- name: Test (Windows MSVC)
if: ${{ matrix.os == 'windows-latest' && matrix.compiler == 'msvc' }}
run: |
pytest --cov=./ --cov-report=xml
- name: Test (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
pytest --cov=./ --cov-report=xml
build-and-publish:
# based on https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
# also see: https://github.com/marketplace/actions/pypi-publish#advanced-release-management
needs: test
name: Build and publish Python distributions to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
channels: conda-forge
activate-environment: cppimport
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Build sdist
run: >-
python setup.py sdist
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true