Update GitHub Actions workflows (#3270)

This commit is contained in:
Adam Turner 2023-08-05 13:24:46 +01:00 committed by GitHub
parent ce3a33067d
commit 2c5152bb40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 68 additions and 21 deletions

View File

@ -1,12 +1,18 @@
name: Read the Docs PR preview
on:
pull_request_target:
types:
- opened
permissions:
contents: read
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
documentation-links:
runs-on: ubuntu-latest

View File

@ -1,6 +1,19 @@
name: Lint
name: Lint PEPs
on: [push, pull_request, workflow_dispatch]
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
FORCE_COLOR: 1
jobs:
pre-commit:
@ -8,13 +21,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v3
- uses: actions/checkout@v3
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: "3.x"
cache: pip
- name: Run pre-commit hooks
uses: pre-commit/action@v3.0.0

View File

@ -1,6 +1,19 @@
name: Render PEPs
on: [push, pull_request, workflow_dispatch]
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
FORCE_COLOR: 1
jobs:
render-peps:
@ -9,40 +22,42 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.x", "3.12-dev"]
python-version:
- "3.x"
- "3.12-dev"
steps:
- name: 🛎️ Checkout
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch all history so that last modified date-times are accurate
- name: 🐍 Set up Python ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: 👷‍ Install dependencies
- name: Update pip
run: |
python -m pip install --upgrade pip
- name: 🔧 Render PEPs
- name: Render PEPs
run: make dirhtml JOBS=$(nproc)
# remove the .doctrees folder when building for deployment as it takes two thirds of disk space
- name: 🔥 Clean up files
- name: Clean up files
run: rm -r build/.doctrees/
- name: 🚀 Deploy to GitHub pages
- name: Deploy to GitHub pages
# This allows CI to build branches for testing
if: (github.ref == 'refs/heads/main') && (matrix.python-version == '3.x')
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build # Synchronise with build.py -> build_directory
folder: build # Synchronise with Makefile -> OUTPUT_DIR
single-commit: true # Delete existing files
- name: ♻️ Purge CDN cache
- name: Purge CDN cache
if: github.ref == 'refs/heads/main'
run: |
curl -H "Accept: application/json" -H "Fastly-Key: $FASTLY_TOKEN" -X POST "https://api.fastly.com/service/$FASTLY_SERVICE_ID/purge_all"

View File

@ -13,6 +13,13 @@ on:
- "tox.ini"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
FORCE_COLOR: 1
@ -22,12 +29,18 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12-dev"]
os: [windows-latest, macos-latest, ubuntu-latest]
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12-dev"
os:
- "windows-latest"
- "macos-latest"
- "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
@ -40,7 +53,7 @@ jobs:
python -m pip install -U wheel
python -m pip install -U tox
- name: Run tests with tox
- name: Run tests
run: |
tox -e py -- -v --cov-report term

View File

@ -7,6 +7,7 @@ SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
BUILDER = html
JOBS = 8
SOURCES =
# synchronise with render.yml -> deploy step
OUTPUT_DIR = build
SPHINXERRORHANDLING =

View File

@ -39,7 +39,7 @@ def create_parser():
parser.add_argument(
"-o",
"--output-dir",
default="build", # synchronise with render.yaml -> deploy step
default="build",
help="Output directory, relative to root. Default 'build'.",
)