Python Nightly Tests #176
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
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 | |
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt | |
name: "Python Nightly Tests" | |
on: | |
push: | |
branches: | |
- "**/*nightly*" | |
schedule: | |
# Run at 2:22am early every morning Eastern time (6/7:22 UTC) | |
# so that we get tips of CPython development tested. | |
# https://crontab.guru/#22_7_%2a_%2a_%2a | |
- cron: "22 7 * * *" | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
env: | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
LOCK_SUFFIX: ${{ vars.DRAINSWAMP_SET_LOCK == '1' && '.lock' || '.unlock' }} | |
permissions: | |
contents: read | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.ref }}" | |
cancel-in-progress: true | |
jobs: | |
tests: | |
name: "${{ matrix.python-version }} on ${{ matrix.platform }}" | |
runs-on: "${{ matrix.platform }}" | |
# If it doesn't finish in an hour, it's not going to. Don't spin for six | |
# hours needlessly. | |
timeout-minutes: 60 | |
strategy: | |
matrix: | |
platform: | |
# Choose a recent Ubuntu that deadsnakes still builds all the versions for. | |
# For example, deadsnakes doesn't provide 3.10 nightly for 22.04 (jammy) | |
# because jammy ships 3.10, and deadsnakes doesn't want to clobber it. | |
# https://launchpad.net/~deadsnakes/+archive/ubuntu/nightly/+packages | |
# https://github.com/deadsnakes/issues/issues/234 | |
# See https://github.com/deadsnakes/nightly for the source of the nightly | |
# builds. | |
# bionic: 18, focal: 20, jammy: 22, noble: 24 | |
- "ubuntu-22.04" | |
python-version: | |
# When changing this list, be sure to check the [gh] list in | |
# tox.ini so that tox will run properly. PYVERSIONS | |
# Available versions: | |
# https://launchpad.net/~deadsnakes/+archive/ubuntu/nightly/+packages | |
# https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa | |
- "3.12" | |
- "3.13" | |
# - "3.14-full" | |
# https://github.com/actions/setup-python#available-versions-of-pypy | |
- "pypy-3.9-nightly" | |
- "pypy-3.10-nightly" | |
fail-fast: false | |
steps: | |
- id: prepare-config-settings | |
name: >- | |
Build Plugin parameters | |
uses: msftcangoblowm/drain-swamp-action@1.0.3 | |
with: | |
plugin_parameters: '{"set-lock": "${{ vars.DRAINSWAMP_SET_LOCK }}", "kind": "current"}' | |
checkout: true | |
python_version: "${{ matrix.python-version }}" | |
- name: "Download artifact" | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
name: config-settings-${{ matrix.platform || matrix.os }}-${{ matrix.python-version }} | |
path: '${{ runner.temp }}' | |
- name: "Check out the repo" | |
uses: actions/checkout@v4.2.2 | |
with: | |
repository: '${{ github.repository }}' | |
# fetch all branches and tags instead of only fetching the ref/SHA that triggered the workflow | |
fetch-depth: 0 | |
- name: Get latest tag | |
id: vars | |
run: | | |
echo "tag=$(git describe --tags)" >> $GITHUB_OUTPUT | |
- name: "Install ${{ matrix.python-version }} with deadsnakes" | |
uses: deadsnakes/action@5bd83736ba0d62b1b9fd1079e1cbe1f9449222ca | |
if: ${{ ! startsWith(matrix.python-version, 'pypy-') }} | |
with: | |
python-version: "${{ matrix.python-version }}" | |
- name: "Install ${{ matrix.python-version }} with setup-python" | |
uses: actions/setup-python@v5.3.0 | |
if: startsWith(matrix.python-version, 'pypy-') | |
with: | |
python-version: "${{ matrix.python-version }}" | |
- name: "Show diagnostic info" | |
run: | | |
set -xe | |
python -VV | |
python -m site | |
env | |
- name: "Install dependencies" | |
run: | | |
python -m pip install -r requirements/kit.lock -r requirements/prod.shared.unlock -r requirements/tox.lock | |
- name: build | |
run: | | |
# TOML file location ${{ runner.temp }}/${{ steps.outcome.inputs.toml_file_name }} | |
# env.DS_CONFIG_SETTINGS contains (OS independent) path to TOML file | |
cat '${{ env.DS_CONFIG_SETTINGS }}' | |
python -m build | |
- name: get-os-short | |
# tox needs just the OS; platform is `{OS}-{OS version}` | |
# matrix.os-short side effect, more matrix runs; total * [OS count] | |
run: | | |
python -c 'import os; lst="${{ matrix.platform }}".split("-"); os_short = lst[0]; env_file = os.environ.get("GITHUB_ENV"); f = open(env_file, "a"); print(f"OS_SHORT={os_short}", file=f); f.close();' | |
python -c 'import os; pyclean = "${{ matrix.python-version }}" if not "${{ matrix.python-version }}".endswith("-nightly") else "${{ matrix.python-version }}".strip("-nightly"); env_file = os.environ.get("GITHUB_ENV"); f = open(env_file, "a"); print(f"PY_CLEAN={pyclean}", file=f); f.close();' | |
- name: "Run tox" | |
run: | | |
echo "env.OS_SHORT ${{ env.OS_SHORT }}" | |
echo "env.PY_CLEAN ${{ env.PY_CLEAN }}" | |
python -m tox -vv -c tox-test.ini -e ${{ env.PY_CLEAN }}-${{ env.OS_SHORT }} |