Release 2024.9.10 #268
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: | |
- main | |
- master | |
pull_request: | |
jobs: | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { python-version: "3.12", os: ubuntu-latest } | |
- { python-version: "3.12", os: windows-latest } | |
- { python-version: "3.12", os: macos-latest } | |
- { python-version: "3.11", os: ubuntu-latest } | |
- { python-version: "3.10", os: ubuntu-latest } | |
name: Python ${{ matrix.python-version }} (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: ssb-pypitemplate | |
- uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install tools using pip | |
working-directory: ${{ github.workspace }}/ssb-pypitemplate | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt pip | |
pipx install --pip-args=--constraint=${{ github.workspace }}/ssb-pypitemplate/.github/workflows/constraints.txt cookiecutter | |
pipx install --pip-args=--constraint=${{ github.workspace }}/ssb-pypitemplate/.github/workflows/constraints.txt nox | |
pipx inject --pip-args=--constraint=${{ github.workspace }}/ssb-pypitemplate/.github/workflows/constraints.txt nox nox-poetry | |
pipx install --pip-args=--constraint=${{ github.workspace }}/ssb-pypitemplate/.github/workflows/constraints.txt poetry | |
- name: Generate project using Cookiecutter | |
run: | | |
cookiecutter --no-input ssb-pypitemplate project_name=ssb-library | |
- name: Create poetry.lock file | |
run: poetry update --lock | |
working-directory: ssb-library | |
- name: Create git repository | |
if: matrix.os != 'windows-latest' | |
run: | | |
git init | |
git config --local user.name "GitHub Action" | |
git config --local user.email "[email protected]" | |
git add . | |
git commit --message="Initial import" | |
working-directory: ssb-library | |
- name: Create git repository (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
git init | |
git config --local user.name "GitHub Action" | |
git config --local user.email "[email protected]" | |
# https://github.com/cookiecutter/cookiecutter/issues/405 | |
$ErrorActionPreference = "Continue" | |
git add . | |
$ErrorActionPreference = "Stop" | |
git add --renormalize . | |
git commit --message="Initial import" | |
working-directory: ssb-library | |
- name: Compute cache key for pre-commit | |
if: matrix.os != 'windows-latest' | |
id: cache_key | |
shell: python | |
run: | | |
import hashlib | |
import subprocess | |
import sys | |
python = "py{}.{}".format(*sys.version_info[:2]) | |
payload = sys.version.encode() + sys.executable.encode() | |
digest = hashlib.sha256(payload).hexdigest() | |
result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8]) | |
cmd = f'echo "result={result}" >> $GITHUB_OUTPUT' | |
subprocess.run(cmd, shell=True) | |
- uses: actions/cache@v4 | |
if: matrix.os != 'windows-latest' | |
with: | |
path: ~/.cache/pre-commit | |
key: ${{ steps.cache_key.outputs.result }}-${{ hashFiles('ssb-library/.pre-commit-config.yaml') }} | |
restore-keys: | | |
${{ steps.cache_key.outputs.result }}- | |
- name: Run test suite using Nox | |
run: nox --force-color --python=${{ matrix.python-version }} | |
working-directory: ssb-library | |
- name: Install dependencies using Poetry | |
run: poetry install --ansi | |
working-directory: ssb-library | |
doc: | |
name: Build documentation & check links | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/[email protected] | |
with: | |
python-version: "3.12" | |
- run: | | |
pip install --constraint=${{ github.workspace }}/.github/workflows/constraints.txt pip | |
pip install --constraint=${{ github.workspace }}/.github/workflows/constraints.txt nox | |
- name: Build documentation | |
run: nox --force-color --session=docs | |
- name: Check links | |
run: nox --force-color --session=linkcheck |