Skip to content

Commit

Permalink
CI testing using Python 3.12 (#60)
Browse files Browse the repository at this point in the history
* Enable 3.12 CI

* Add `lint.yml`

* Switch to `publish.yml`

* Update RTD config

---------

Co-authored-by: Bernhard Reuter <[email protected]>
  • Loading branch information
michalk8 and msmdev authored Apr 29, 2024
1 parent bfae9f1 commit 0ce99c3
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 74 deletions.
66 changes: 4 additions & 62 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,23 @@ name: CI

on:
schedule:
- cron: 00 00 * * 1 # run every Monday at 00:00
- cron: 00 00 * * 1 # Run every Monday at 00:00
push:
branches:
- main
tags:
- v[0-9]+.[0-9]+.[0-9]+
branches: [main]
pull_request:
branches:
- main
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: precommit-${{ env.pythonLocation }}-${{ hashFiles('**/.pre-commit-config.yaml') }}

- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt install libenchant-2-dev pandoc
python -m pip install --upgrade pip
python -m pip install tox
- name: Linting
run: |
tox -e lint,check-docs,readme
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 5
matrix:
python: ['3.8', '3.10', '3.11']
python: ['3.8', '3.10', '3.11', '3.12']
os: [ubuntu-latest]
slepc: ['noslepc']
include:
Expand Down Expand Up @@ -87,30 +56,3 @@ jobs:
env_vars: OS,PYTHON
fail_ci_if_error: false
verbose: true

deploy:
needs: [lint, test]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install pypa/build
run: |
python -m pip install --upgrade pip
pip install build
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/
- name: Publish package on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
skip_existing: true
verify-metadata: true
verbose: true
40 changes: 40 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Lint

on:
schedule:
- cron: 00 00 * * 1 # run every Monday at 00:00
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Cache pre-commit
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('**/.pre-commit-config.yaml') }}

- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt install libenchant-2-dev pandoc
python -m pip install --upgrade pip
python -m pip install tox
- name: Linting
run: |
tox -e lint,check-docs,readme
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Upload package

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install pip dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: |
python -m build --sdist --wheel --outdir dist/
- name: Publish package on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
skip_existing: true
verify-metadata: true
verbose: true
16 changes: 6 additions & 10 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: '3.10'

sphinx:
builder: html
configuration: docs/source/conf.py
fail_on_warning: false

formats:
- htmlzip
- pdf

build:
image: latest

python:
version: 3.8
install:
- method: pip
path: .
extra_requirements:
- docs
extra_requirements: [docs]
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ isolated_build = True
envlist =
covclean
lint
py{3.8,3.9,3.10,3.11}-{slepc,noslepc}
py{3.8,3.9,3.10,3.11,3.12}-{slepc,noslepc}
coverage
readme
check-docs
Expand Down Expand Up @@ -113,7 +113,7 @@ deps =
coverage
diff_cover
skip_install = true
depends = py{3.8,3.9,3.10,3.11}
depends = py{3.8,3.9,3.10,3.11,3.12}
parallel_show_output = True
commands =
coverage report --omit="tox/*"
Expand Down

0 comments on commit 0ce99c3

Please sign in to comment.