Scheduled pre-release tests #251
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: Scheduled pre-release tests | |
on: | |
schedule: | |
# Run this workflow twice a week | |
# ref: https://crontab.guru/#0_5_*_*_1,4 | |
- cron: "0 5 * * 1,4" | |
workflow_dispatch: | |
env: | |
FORCE_COLOR: "1" # Make tools pretty | |
PIP_DISABLE_PIP_VERSION_CHECK: "1" # Don't check for pip updates | |
permissions: {} | |
jobs: | |
prerelease: | |
# only run this workflow for pydata owned repositories (avoid forks) | |
if: github.repository_owner == 'pydata' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.13"] | |
steps: | |
- name: "Checkout repository 🛎" | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
with: | |
persist-credentials: false | |
- name: "Setup CI environment 🛠" | |
# Important: make sure to update the SHA after making any changes to the set-dev-env action | |
uses: pydata/pydata-sphinx-theme/.github/actions/set-dev-env@01731d0cc57768b9eff1c97f38909932ecd7e7d1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
pandoc: true | |
- name: "Install (prerelease) dependencies 📦" | |
run: | | |
python -Im pip install --upgrade pip wheel setuptools | |
- name: "Build PST docs and check for warnings 📖" | |
run: | | |
# example substitution: tox run -e docs-py312-docs | |
python -Im tox run -e docs-py$(echo ${{ matrix.python-version }} | tr -d .)-docs -- --keep-going | |
- name: "Run tests ✅ (no coverage)" | |
run: | | |
# this will compile the assets then run the tests | |
python -Im tox run -e compile-assets,i18n-compile,py$(echo ${{ matrix.python-version }} | tr -d .)-tests-no-cov | |
echo "PYTEST_ERRORS=$?" >> $GITHUB_ENV | |
- name: "Build and inspect package 📦" | |
uses: hynek/build-and-inspect-python-package@b5076c307dc91924a82ad150cdd1533b444d3310 | |
if: matrix.python-version == '3.9' | |
id: baipp | |
- run: echo Packages can be found at "${BAIPP_DIST}" | |
if: matrix.python-version == '3.9' | |
env: | |
BAIPP_DIST: ${{ steps.baipp.outputs.dist }} | |
- name: "Get PST version" | |
run: | | |
python -Im pip install -e . | |
# Get the version of the package | |
PST_VERSION=$(python -c "import pydata_sphinx_theme; print(pydata_sphinx_theme.__version__)") | |
echo "PST_VERSION=$PST_VERSION" >> $GITHUB_ENV | |
# Run tests on the built package (which will be later uploaded to PyPI) | |
- name: "Install PST from wheel and test" | |
env: | |
BAIPP_DIST: ${{ steps.baipp.outputs.dist }} | |
PST_VERSION: ${{ env.PST_VERSION }} | |
run: | | |
# calling with --installpkg so we can use the already built package | |
tox run -e py312-tests-no-cov \ | |
--installpkg "${BAIPP_DIST}"/pydata_sphinx_theme-"${PST_VERSION}"-py3-none-any.whl \ | |
-- --deselect tests/test_build.py::test_translations | |
# If either the docs build or the tests resulted in an error, create an issue to note it | |
- name: "Create an issue if failure" | |
uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 | |
if: ${{ env.SPHINX_BUILD_UNEXPECTED_WARNINGS || !env.PYTEST_ERRORS }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
filename: .github/prerelease-template.md |