Skip to content

Bump actions/setup-python from 4.6.1 to 4.7.1 #1426

Bump actions/setup-python from 4.6.1 to 4.7.1

Bump actions/setup-python from 4.6.1 to 4.7.1 #1426

Workflow file for this run

---
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/pypa-committers@python.org/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
# See what each os came pre-installed with at:
# https://help.github.com/en/actions/reference/software-installed-on-github-hosted-runners
os_list = {
"ubuntu-22.04",
"ubuntu-20.04",
"macos-12",
"macos-11",
"windows-2022",
"windows-2019",
}
python_list = {
"3.8",
"3.9",
"3.10",
"3.11",
"3.12-dev",
}
# Safety check to ensure there is no overlap between the 2 sets.
assert not os_list.intersection(python_list)
# List of unstable creiterions.
unstable = []
jobs = []
for os_id, python_version in product(os_list, python_list):
job = {
"os": os_id,
"python-version": python_version,
"state": "stable",
}
for criterion in unstable:
if criterion.issubset(job.values()):
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) }}
runs-on: ${{ matrix.os }}
# We keep going when a job flagged as not stable fails.
continue-on-error: ${{ matrix.state == 'unstable' }}
steps:
- uses: actions/checkout@v3.5.3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.7.1
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: Tests
run: |
poetry run pytest
- name: Codecov upload
uses: codecov/codecov-action@v3.1.4