-
Notifications
You must be signed in to change notification settings - Fork 341
DEV - Refactor CI and environment setup #1759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 74 commits
Commits
Show all changes
81 commits
Select commit
Hold shift + click to select a range
c1cfeaa
Add python default doc
trallard 1edcade
Add tox configuration
trallard d71c46a
Add tox based workflow
trallard 03c8531
Rename workflow
trallard a992b12
Add debugging branch
trallard 72bec4b
Remove extra .
trallard a1baedc
Update tox commands
trallard 027c2bb
Add sphinx versions test
trallard 5a282da
Update workflow syntax
trallard d285c4d
Fix typo
trallard c90409b
Add build docs
trallard 5da3482
Add pandoc
trallard 3280ac0
Exclude non-supported version
trallard cf30a7f
Remove if check
trallard d9c18fb
Fix sphinx version expression
trallard 47fc967
Use composite action
trallard cfbfe60
Fix inputs in composite
trallard 84c554c
Install Sphinx dev deps
trallard 4272ccc
Always use bash
trallard 3f3b203
Add lighthouse audits
trallard 0c36b2e
Allow for build docs params
trallard b3ce8b3
Fix deps - docs
trallard da0b90d
Fix if syntax
trallard fc588c5
Clean nox
trallard 7cdff01
Fix base python
trallard 92b1b53
Add coverage
trallard 29b756d
Ensure docs are built for a11y tests
trallard 0085c77
Update tox commands and envs
trallard ec5c1e0
Make compile explicit
trallard 256d574
Skip installs in lint
trallard 2b5b862
Add coverage upload
trallard 8f6c9cb
Fix Python version
trallard 37ea780
Update pre-release workflow
trallard d77fddb
Update tox.ini
trallard 1bcfa64
Small formatting and style fixes to actions
trallard 574e294
Add profiling to CI
trallard 9f84c92
Remove default version
trallard dfbca62
Remove trallard debug in ci
trallard 46eb200
Apply suggestions from code review
trallard dc202fa
Add inline comments
trallard a59a4fb
Merge branch 'trallard/update-ci' of https://github.com/trallard/pyda…
trallard 185efc6
Add Python 3.13 so we can start testing against it
trallard 4d35885
:pencil2: Fix typo - profile
trallard 7491341
Merge remote-tracking branch 'upstream/main' into trallard/update-ci
trallard dc3bc4f
Add Python 3.13 so we can start testing against it
trallard 90b2739
Ensure we can run profiling in CI
trallard 5887ea2
Remove 13 for now
trallard 5f435b1
Add script for now - install gh
trallard 876cc43
Use relative path for executable
trallard 0b74130
make install scritp executable
Carreau 19b8572
Merge remote-tracking branch 'origin/main' into trallard/update-ci
Carreau 039c530
try to fix sphinx test
Carreau 904ffeb
Fix Python version for profiling
trallard 963b51a
Merge remote-tracking branch 'upstream/main' into trallard/update-ci
trallard 491c59a
Update release workflow
trallard 7a6d85c
:memo: Update dev setup docs
trallard f44df2a
:heavy_plus_sign: Add pandoc to prerelease workflow
trallard 6b2dcca
Update manual dev instructions
trallard 0532405
Add notes about codespaces
trallard 800b89c
Add live-docs to tox
trallard 7ebd352
Remove obsolete nox refs
trallard 11343ec
Rename workflow to best reflect its purpose
trallard 85650ff
Ensure we do not build pkg before compiling
trallard a609f3a
Update a11y-pygments test
trallard 4123025
Merge branch 'main' into trallard/update-ci
trallard 9a51128
Update contrbution docs
trallard 36ec81f
Ensure we always use 80 as coverage treshold
trallard c3d8455
Fix profile step
trallard 996bfda
Merge remote-tracking branch 'origin/main' into trallard/update-ci
Carreau 4a59ab5
Fix CI - ensure consistency
trallard 2f77ce1
Merge branch 'trallard/update-ci' of https://github.com/trallard/pyda…
trallard c242b93
Apply suggestions from code review
trallard cb294ca
Add nox to devcontainer for now
trallard 652fea2
Merge branch 'trallard/update-ci' of https://github.com/trallard/pyda…
trallard 48c5cdd
Update .github/workflows/CI.yml
Carreau e74f1e2
Update .github/workflows/CI.yml
Carreau c237a81
Apply suggestions from code review
Carreau 325c29d
Apply suggestions from code review
Carreau 607f940
Remove coverage from docs
trallard f5b0507
Add newer Python and ubuntu versions
trallard 1043373
Exclude non-supported version
trallard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Setup PST CI environment | ||
description: Create a PST dev environment | ||
|
||
inputs: | ||
python-version: | ||
description: Default Python version to use if none is specified | ||
required: false | ||
default: "3.12" | ||
pandoc: | ||
description: Whether this should install pandoc or not | ||
required: false | ||
default: "False" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: "Setup Python 🐍" | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
cache: "pip" | ||
cache-dependency-path: "pyproject.toml" | ||
allow-prereleases: true | ||
|
||
- run: python -Im pip install tox-uv | ||
shell: bash | ||
|
||
# waiting for https://github.com/nikeee/setup-pandoc/pull/8 | ||
# using 12rambau fork until then | ||
- name: "Install pandoc 📝" | ||
uses: 12rambau/setup-pandoc@test | ||
if: ${{ inputs.pandoc }} == true |
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,234 @@ | ||
name: continuous-integration-tox | ||
|
||
# Concurrency group that uses the workflow name and PR number if available | ||
# or commit SHA as a fallback. If a new build is triggered under that | ||
# concurrency group while a previous build is running it will be canceled. | ||
# Repeated pushes to a PR will cancel all previous builds, while multiple | ||
# merges to main will not cancel. | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
FORCE_COLOR: "1" # Make tools pretty | ||
DEFAULT_PYTHON_VERSION: "3.12" # keep in sync with tox.ini | ||
PIP_DISABLE_PIP_VERSION_CHECK: "1" # Don't check for pip updates | ||
|
||
permissions: {} | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_call: | ||
# allow manual triggering of the workflow, while debugging | ||
workflow_dispatch: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout repository 🛎" | ||
uses: actions/checkout@v4 | ||
- name: "Setup CI environment 🛠" | ||
uses: ./.github/actions/set-dev-env | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON_VERSION }} | ||
- name: "Run lint checks 🧹" | ||
run: python -Im tox run -e lint | ||
|
||
# Run our test suite on various combinations of OS & Python versions | ||
run-pytest: | ||
needs: lint | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: ["ubuntu-latest", "macos-latest", "macos-14", "windows-latest"] | ||
python-version: ["3.9", "3.10", "3.11", "3.12"] | ||
sphinx-version: [""] | ||
include: | ||
# oldest Python version with the oldest Sphinx version | ||
- os: ubuntu-latest | ||
python-version: "3.9" | ||
sphinx-version: "6.1" | ||
# newest Python version with the newest Sphinx version | ||
- os: ubuntu-latest | ||
python-version: "3.12" | ||
# Sphinx HEAD | ||
sphinx-version: "dev" | ||
exclude: | ||
# Python 3.9 is not supported on macOS 14 - https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json | ||
- os: macos-14 | ||
python-version: "3.9" | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: "Checkout repository 🛎" | ||
uses: actions/checkout@v4 | ||
- name: "Setup CI environment 🛠" | ||
uses: ./.github/actions/set-dev-env | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
pandoc: true | ||
- name: "Run tests ✅" | ||
shell: bash | ||
run: | | ||
# this will compile the assets then run the tests | ||
# check if there is a specific Sphinx version to test with | ||
# example substitution: tox run -e compile,py39-sphinx61-tests | ||
if [ -n "${{matrix.sphinx-version}}" ]; then | ||
python -Im tox run -e compile,py$(echo ${{ matrix.python-version }} | tr -d .)-sphinx(echo ${{ matrix.sphinx-version }} | tr -d .)-tests | ||
# if not we use the default version | ||
# example substitution: tox run -e compile,py39-tests | ||
else | ||
python -Im tox run -e compile,py$(echo ${{ matrix.python-version }} | tr -d .)-tests | ||
fi | ||
- name: "Upload coverage data to GH artifacts 📤" | ||
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' && matrix.sphinx-version == 'dev' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-data-${{ matrix.python-version }} | ||
path: .coverage | ||
if-no-files-found: ignore | ||
trallard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Only run accessibility tests on the latest Python version (3.12) and Ubuntu | ||
a11y-tests: | ||
name: "a11y-tests (ubuntu-latest, 3.12)" | ||
needs: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout repository 🛎" | ||
uses: actions/checkout@v4 | ||
- name: "Setup CI environment 🛠" | ||
uses: ./.github/actions/set-dev-env | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON_VERSION }} | ||
- name: "Run accessibility tests with playwright 🎭" | ||
# build PST, build docs, then run a11y-tests | ||
run: python -Im tox run -e py312-docs,a11y-tests | ||
continue-on-error: true | ||
|
||
# Build our docs (PST) on major OSes and check for warnings | ||
build-site: | ||
name: "build PST docs" | ||
needs: lint | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: ["3.12"] | ||
include: | ||
# oldest Python version with the oldest Sphinx version | ||
- os: ubuntu-latest | ||
python-version: "3.9" | ||
sphinx-version: "6.1" | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: "Checkout repository 🛎" | ||
uses: actions/checkout@v4 | ||
- name: "Setup CI environment 🛠" | ||
uses: ./.github/actions/set-dev-env | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
pandoc: true | ||
- name: "Build docs and check for warnings 📖" | ||
shell: bash | ||
run: | | ||
# check if there is a specific Sphinx version to build with | ||
# example substitution: tox run -e docs-py39-sphinx61-docs | ||
if [ -n "${{matrix.sphinx-version}}" ]; then | ||
python -Im tox run -e py$(echo ${{ matrix.python-version }} | tr -d .)-sphinx(echo ${{ matrix.sphinx-version }} | tr -d .)-docs | ||
Carreau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# build with the default Sphinx version | ||
# example substitution: tox run -e docs-py312-docs | ||
else | ||
python -Im tox run -e py$(echo ${{ matrix.python-version }} | tr -d .)-docs | ||
fi | ||
|
||
# Run Lighthouse audits on the built site (kitchen-sink only) | ||
lighthouse-audit: | ||
needs: build-site | ||
runs-on: ubuntu-latest | ||
env: | ||
DOCS_DIR: "audit" | ||
steps: | ||
- name: "Checkout repository 🛎" | ||
uses: actions/checkout@v4 | ||
- name: "Setup CI environment 🛠" | ||
uses: ./.github/actions/set-dev-env | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON_VERSION }} | ||
- name: "Copy kitchen sink to a tiny site" | ||
run: | | ||
mkdir -p ${{ env.DOCS_DIR }}/site | ||
cp -r docs/examples/kitchen-sink ${{ env.DOCS_DIR }}/site/kitchen-sink | ||
printf "Test\n====\n\n.. toctree::\n\n kitchen-sink/index\n" > ${{ env.DOCS_DIR }}/site/index.rst | ||
echo 'html_theme = "pydata_sphinx_theme"' > ${{ env.DOCS_DIR }}/site/conf.py | ||
echo '.. toctree::\n :glob:\n\n *' >> ${{ env.DOCS_DIR }}/site/index.rst | ||
|
||
# build docs without checking for warnings | ||
python -Im tox run -e docs-no-checks | ||
|
||
- name: "Audit with Lighthouse 🔦" | ||
uses: treosh/lighthouse-ci-action@v11 | ||
with: | ||
configPath: ".github/workflows/lighthouserc.json" | ||
temporaryPublicStorage: true | ||
uploadArtifacts: true | ||
runs: 3 # Multiple runs to reduce variance | ||
|
||
coverage: | ||
name: "check coverage" | ||
needs: run-pytest | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout repository 🛎" | ||
uses: actions/checkout@v4 | ||
- name: "Setup CI environment 🛠" | ||
uses: ./.github/actions/set-dev-env | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON_VERSION }} | ||
- run: python -Im pip install --upgrade coverage[toml] | ||
- name: "Download coverage data 📥" | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: coverage-data-* | ||
merge-multiple: true | ||
- name: "Get coverage data & fail if it's <80%" | ||
run: | | ||
# if we decide to check cov across versions and combine | ||
# python -Im coverage combine | ||
python -Im coverage html --skip-covered --skip-empty | ||
|
||
# report and write to summary. | ||
python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY | ||
|
||
# report again and fail if under 80%. | ||
python -Im coverage report --fail-under=80 | ||
- name: "Upload HTML report if check failed 📤" | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: html-report | ||
path: htmlcov | ||
if: ${{ failure() }} | ||
|
||
profiling: | ||
needs: [build-site, run-pytest] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout repository 🛎" | ||
uses: actions/checkout@v4 | ||
- name: "Setup CI environment 🛠" | ||
uses: ./.github/actions/set-dev-env | ||
with: | ||
# 3.12 is not supported by py-spy yet | ||
python-version: "3.11" | ||
- name: "Run profiling with py-spy 🕵️♂️" | ||
# profiling needs to be run as sudo | ||
run: python -m tox run -e py311-profile-docs -- -o docbuild_profile.svg | ||
continue-on-error: true | ||
- name: "Upload profiling data to GH artifacts 📤" | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: profile-results | ||
path: docbuild_profile.svg | ||
if-no-files-found: ignore |
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.