Skip to content

tox -> nox

tox -> nox #2417

Workflow file for this run

name: CI
on:
push:
pull_request:
release:
types: [published]
schedule:
# Daily at 3:21
- cron: "21 3 * * *"
env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PIP_NO_PYTHON_VERSION_WARNING: "1"
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/action@v3.0.0
list:
runs-on: ubuntu-latest
outputs:
noxenvs: ${{ steps.noxenvs-matrix.outputs.noxenvs }}
steps:
- uses: actions/checkout@v3
- name: Set up nox
uses: wntrblm/nox@2023.04.22
- id: noxenvs-matrix
run: |
echo >>$GITHUB_OUTPUT noxenvs=$(
nox --list-sessions |
grep '^* ' |
cut -d ' ' -f 2- |
jq --raw-input --slurp 'split("\n") | map(select(. != ""))'
)
ci:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
noxenv: ${{ fromJson(needs.list.outputs.noxenvs) }}
posargs: [""]
include:
- os: ubuntu-latest
noxenv: "tests-3.11(extras='[format]')"
posargs: ghcoverage
- os: ubuntu-latest
noxenv: "tests-3.11(extras='')"
posargs: ghcoverage
exclude:
- os: windows-latest
noxenv: readme
- os: windows-latest
noxenv: "docs(dirhtml)"
- os: windows-latest
noxenv: "docs(doctest)"
- os: windows-latest
noxenv: "docs(linkcheck)"
- os: windows-latest
noxenv: "docs(spelling)"
- os: windows-latest
noxenv: "docs(style)"
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libenchant-2-dev
if: runner.os == 'Linux' && startsWith(matrix.noxenv, 'docs')
- name: Install dependencies
run: brew install enchant
if: runner.os == 'macOS' && startsWith(matrix.noxenv, 'docs')
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Set up nox
uses: wntrblm/nox@2023.04.22
- name: Run nox
run: nox -s "${{ matrix.noxenv }}" -- "${{ matrix.posargs }}"
packaging:
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: python -m pip install build
- name: Create packages
run: python -m build .
- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}
- name: Create a Release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
with:
files: |
dist/*
generate_release_notes: true