This is a composite GitHub Action for running CI tasks through nox.
The action:
- Sets up Python
- Installs/updates pip and nox
- Caches the nox sessions
- Runs nox with the sessions you specify
name: Python CI
"on":
push:
tags:
- "*"
branches:
- "main"
pull_request: {}
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python:
- "3.11"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # full history for setuptools_scm
- name: Run nox
uses: lsst-sqre/run-nox@v1
with:
python-version: ${{ matrix.python }}
nox-sessions: "typing test"
cache-dependency: "**/requirements/*.txt"
cache-dependency
(string, optional) Glob pattern matching the files that contribute to which dependencies are installed in the nox sessions. This should match either the contributing frozen dependency files or the contributingpyproject.toml
files. Unfortunately due to limitations in the GitHub Actions syntax only a single glob pattern is supported. Default ispyproject.toml
.cache-key-prefix
(string, optional) Prefix for the tox environment cache key. Set to distinguish from other caches. Default istox
.nox-sessions
(string, required) The nox sessions to run, as a space-separated list. Example:typing test
to run a type checking session and a Python test session.nox-package
(string, optional) Pip requirement for nox itself (argument topip install
). Default isnox[uv]
, without any version constraints.nox-posargs
(string, optional) Space-separated command line arguments to pass to the nox command. The positional arguments are made available as thesession.posargs
attribute to nox sessions. Default is not to pass any arguments.python-version
(string, required) The Python version.use-cache
(boolean, optional) Flag to enable caching of the nox environment. Default istrue
.
No outputs.
This repository provides a composite GitHub Action, a type of action that packages multiple regular actions into a single step. We do this to make the GitHub Actions workflows of all our software projects more consistent and easier to maintain. You can learn more about composite actions in the GitHub documentation.
Create new releases using the GitHub Releases UI and assign a tag with a semantic version, including a v
prefix. Choose the semantic version based on compatibility for users of this workflow. If backwards compatibility is broken, bump the major version.
When a release is made, a new major version tag (i.e. v1
, v2
) is also made or moved using nowactions/update-majorver.
We generally expect that most users will track these major version tags.