Skip to content

Updates for wakepy 0.8.0: Docs + small enhancements #102

Updates for wakepy 0.8.0: Docs + small enhancements

Updates for wakepy 0.8.0: Docs + small enhancements #102

name: Build and test wakepy
'on':
# Allows for manually starting tests
workflow_dispatch:
# Make this a reusable workflow
workflow_call:
# Triggers when pull request is created and when pushing to PR
pull_request:
# Common environment variables
env:
TOX_REQUIREMENT: 'tox -c requirements/requirements-test.txt'
# List of available versions: https://github.com/actions/python-versions/blob/main/versions-manifest.json
PYTHON_VERSION: '3.10'
jobs:
build-python-distributions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get history and tags for setuptools-scm
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
git describe --tags
git describe --tags $(git rev-list --tags --max-count=1)
- name: Install python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d #v5.1
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: install tox
run: |
python${{ env.PYTHON_VERSION }} -m pip install -U pip wheel && \
python${{ env.PYTHON_VERSION }} -m pip install ${{ env.TOX_REQUIREMENT }}
- name: Build with tox
run: tox -e build
- uses: actions/upload-artifact@v4
with:
name: wakepy-python-packages
path: ./dist/*.*
if-no-files-found: error
retention-days: 1
test:
runs-on: ${{ matrix.os }}
needs: build-python-distributions
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.7", "3.10", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: wakepy-python-packages
path: ./dist/
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d #v5.1
with:
python-version: ${{ matrix.python-version }}
- name: install tox
run: |
python -m pip install -U pip wheel &&
python -m pip install ${{ env.TOX_REQUIREMENT }}
- run: python -c "import sys; print(sys.executable)"
- run: python -c "import platform; print(platform.platform())"
- name: Run tox
run: tox -e ${{ matrix.python-version }} --skip-build
- name: Show lines not covered by tests
# No need to run this is all tests and coverage check passes
if: failure()
run: tox -e show-uncovered-lines
check-code:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d #v5.1
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: install tox
run: |
python${{ env.PYTHON_VERSION }} -m pip install -U pip wheel && \
python${{ env.PYTHON_VERSION }} -m pip install ${{ env.TOX_REQUIREMENT }}
- name: Check code
run: tox -e check
additional-mypy-checks:
# This is an *additional* check for mypy using the oldest and newest
# supported python
runs-on: ubuntu-latest
# Note that it's not possible to build the package using python 3.7
# (build is only tested on the env.PYTHON_VERSION). Therefore this mypy
# check just uses the build from the previous step. And build is required
# since it creates the wakepy._version module.
needs: build-python-distributions
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: wakepy-python-packages
path: ./dist/
- name: Install python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d #v5.1
with:
python-version: ${{ matrix.python-version }}
- name: install tox
run: python${{ matrix.python-version }} -m pip install ${{ env.TOX_REQUIREMENT }}
- name: Check code
run: tox -e mypy --skip-build
test-build-docs:
runs-on: ubuntu-latest
needs: build-python-distributions
steps:
- uses: actions/checkout@v4
- name: Install python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d #v5.1
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: install tox
run: |
python${{ env.PYTHON_VERSION }} -m pip install -U pip wheel && \
python${{ env.PYTHON_VERSION }} -m pip install ${{ env.TOX_REQUIREMENT }}
- name: Test building docs
run: tox -e builddocs
# Cancel in-progress jobs/runs for the same workflow; if you push to same
# pull request twice, the previous workflow should be canceled.
# From: https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# See: https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions:
actions: write
checks: none
contents: read
deployments: none
id-token: none
issues: none
discussions: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: read
statuses: none