Bump actions/checkout from 4.1.5 to 4.1.6 #2419
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 | |
pull_request: | |
schedule: | |
# Run tests every Monday at 9:17 to catch regressions. | |
- cron: "17 9 * * 1" | |
# XXX Concurrency detection sucks and jobs gets killed randonmly. | |
# concurrency: | |
# # Group workflow jobs so new commits cancels in-progress execution triggered by previous commits. | |
# # Source: https://mail.python.org/archives/list/[email protected]/thread/PCBCQMJF64JGRBOX7E2EE4YLKHT4DI55/ | |
# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
# cancel-in-progress: true | |
jobs: | |
test-matrix: | |
# There is no way to selective flags collections of elements in a matrix, without having to flag all combinations. | |
# This will became unmaintainable and tedious so we use this job to pre-compute which jobs is going to get our | |
# "stable" flag. | |
name: "OS/Python/stable matrix pre-compute" | |
runs-on: ubuntu-22.04 | |
outputs: | |
test_matrix: ${{ steps.create_matrix.outputs.matrix }} | |
steps: | |
- name: Create JSON matrix | |
id: create_matrix | |
shell: python | |
run: | | |
import json | |
import os | |
from itertools import product | |
from pathlib import Path | |
variants: dict[str, set[str]] = { | |
"os": { | |
# Available OSes: https://github.com/actions/runner-images#available-images | |
"ubuntu-22.04", | |
"ubuntu-20.04", | |
"macos-14", | |
"macos-13", | |
"windows-2022", | |
"windows-2019", | |
}, | |
"python-version": { | |
"3.8", | |
"3.9", | |
"3.10", | |
"3.11", | |
"3.12", | |
"3.13-dev", | |
}, | |
"click-version": { | |
"released", | |
"8.1.x", | |
"main", | |
}, | |
"cloup-version": { | |
"released", | |
"master", | |
} | |
} | |
# TODO: List of additional variants to include in the matrix. | |
include: list[dict[str, str]] = [] | |
# List of variants to exclude from the matrix. | |
exclude: list[dict[str, str]] = [] | |
# List of unstable criterions. | |
unstable: list[dict[str, str]] = [ | |
# msgpack does not work on Python 3.13-dev yet: | |
# https://github.com/msgpack/msgpack-python/issues/573 | |
{"python-version": "3.13-dev"}, | |
# Ignore failing tests on Click development branch, because some top-level classes (BaseCommand, | |
# MultiCommand and OptionParser) have been removed. See: | |
# https://github.com/pallets/click/compare/8.1.x...main#diff-768bcdbbdaa3001d4905761c3eed38d5ce6a62b9127df80de90d9ca4e806cacc | |
{"click-version": "main"}, | |
] | |
# Removes from the matrix some combinations for development versions of Click and Cloup. This reduce the size | |
# of the matrix for tests on non-released versions. While keeping the full exhaustive tests on the released | |
# versions of Click and Cloup. | |
for dev_version in ( | |
{"click-version": "8.1.x"}, | |
{"click-version": "main"}, | |
{"cloup-version": "master"}, | |
): | |
for criterion in ( | |
# Exclude old OSes. Only keeps the latest OSes of each family. | |
{"os": "ubuntu-20.04"}, | |
{"os": "macos-13"}, | |
{"os": "windows-2019"}, | |
# Exclude Python's dev version. | |
{"python-version": "3.13-dev"}, | |
# Exclude intermediate Python version. Only test on oldest and newest released Python versions. | |
{"python-version": "3.9"}, | |
{"python-version": "3.10"}, | |
{"python-version": "3.11"}, | |
): | |
exclude.append({**dev_version, **criterion}) | |
# Build the job matrix. | |
jobs: list[dict[str, str]] = [] | |
for variants in product(*[{(key, value) for value in values} for key, values in variants.items()]): | |
job = dict(variants) | |
# Match the job against the exclude criterions. | |
exclude_job = False | |
for criterion in exclude: | |
if set(criterion.items()).issubset(job.items()): | |
exclude_job = True | |
break | |
if exclude_job: | |
continue | |
# Match the job against the unstable criterions. | |
job["state"] = "stable" | |
for criterion in unstable: | |
if set(criterion.items()).issubset(job.items()): | |
job["state"] = "unstable" | |
break | |
jobs.append(job) | |
matrix = json.dumps({"include": jobs}) | |
env_file = Path(os.getenv("GITHUB_OUTPUT")) | |
env_file.write_text(f"matrix={matrix}") | |
- name: Print JSON matrix | |
run: | | |
echo '${{ steps.create_matrix.outputs.matrix }}' | |
jq -aR <<< echo '${{ steps.create_matrix.outputs.matrix }}' | |
tests: | |
needs: | |
- test-matrix | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.test-matrix.outputs.test_matrix) }} | |
name: | | |
[${{ matrix.state }}] | |
${{ matrix.os }}, | |
Python ${{ matrix.python-version }}, | |
Click: ${{ matrix.click-version }}, | |
Cloup: ${{ matrix.cloup-version }} | |
runs-on: ${{ matrix.os }} | |
# We keep going when a job flagged as not stable fails. | |
continue-on-error: ${{ matrix.state == 'unstable' }} | |
steps: | |
- uses: actions/[email protected] | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install click-extra and its dependencies | |
run: | | |
python -m pip install --upgrade setuptools pip | |
python -m pip install --upgrade poetry | |
poetry install --no-interaction | |
- name: Install click@${{ matrix.click-version }} | |
if: matrix.click-version != 'released' | |
run: | | |
poetry add git+https://github.com/pallets/click.git#${{ matrix.click-version }} | |
- name: Install cloup@${{ matrix.cloup-version }} | |
if: matrix.cloup-version != 'released' | |
run: | | |
poetry add git+https://github.com/janluke/cloup.git#${{ matrix.cloup-version }} | |
- name: Tests | |
run: | | |
poetry run pytest | |
- name: Codecov upload | |
uses: codecov/[email protected] |