Skip to content

CI: extend CI to Python 3.12 #218

CI: extend CI to Python 3.12

CI: extend CI to Python 3.12 #218

Workflow file for this run

name: Continuous integration
on:
push:
pull_request:
jobs:
build:
# To prevent this job from running, have "[skip ci]" or "[ci skip]" in the commit message
if: contains(toJson(github.event.commits), '[ci skip]') == false && contains(toJson(github.event.commits), '[skip ci]') == false
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
exclude:
# pycifrw 4.4.4 is broken on Windows / python 3.10
- os: windows-latest
python-version: "3.10"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt') }}
- uses: actions/cache@v4
if: startsWith(runner.os, 'macOS')
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt') }}
- uses: actions/cache@v4
if: startsWith(runner.os, 'Windows')
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('**/*requirements.txt') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy wheel
pip install -r requirements.txt
pip install -r dev-requirements.txt
# We run the tests on the installed package, with all optional dependencies
# Note the use of the -Wa flag to show DeprecationWarnings
- name: Unit tests
run: |
python -m pip install .[diffshow]
cd ~
python -Wa -m pytest --pyargs skued --import-mode=importlib
- name: Build documentation
run: |
python setup.py build_sphinx
- name: Doctests
run: |
python -m sphinx -b doctest docs build
- name: Build artifacts
run: |
python setup.py sdist bdist_wheel
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: artifact-${{ runner.os }}-py${{ matrix.python-version }}
path: dist/*
retention-days: 7
release:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: dist/
pattern: artifact-*
merge-multiple: true
- name: Create release description
run: |
python release-description.py CHANGELOG.rst > description.md
cat description.md
- name: Create release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: description.md
files: |
dist/*
- name: Upload to PyPI
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}