Activate prettier-plugin-toml for pre-commit hooks #3816
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: CI | |
on: | |
merge_group: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags: | |
workflow_call: | |
inputs: | |
cpython-pip-version: | |
description: >- | |
A JSON string with pip versions | |
to test against under CPython. | |
required: true | |
type: string | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
env: | |
FORCE_COLOR: 1 # Request colored output from CLI tools supporting it | |
MYPY_FORCE_COLOR: 1 # MyPy's color enforcement | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
PIP_NO_PYTHON_VERSION_WARNING: 1 | |
PIP_NO_WARN_SCRIPT_LOCATION: 1 | |
PRE_COMMIT_COLOR: 1 | |
PY_COLORS: 1 # Recognized by the `py` package, dependency of `pytest` | |
TOX_PARALLEL_NO_SPINNER: 1 | |
TOX_TESTENV_PASSENV: >- | |
FORCE_COLOR | |
MYPY_FORCE_COLOR | |
NO_COLOR | |
PY_COLORS | |
PYTEST_THEME | |
PYTEST_THEME_MODE | |
PRE_COMMIT_COLOR | |
jobs: | |
linters: | |
name: Linters | |
uses: ./.github/workflows/reusable-qa.yml | |
test: | |
name: ${{ matrix.os }} / ${{ matrix.python-version }} / ${{ matrix.pip-version }} | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- Ubuntu | |
- Windows | |
- macOS | |
python-version: | |
- "3.11" | |
- "3.10" | |
- "3.9" | |
- "3.8" | |
pip-version: >- | |
${{ | |
fromJSON( | |
github.job_workflow_sha | |
&& inputs.cpython-pip-version | |
|| '["latest", "previous"]' | |
) | |
}} | |
include: | |
- os: Ubuntu | |
python-version: >- | |
${{ | |
github.job_workflow_sha | |
&& '3.12-dev' | |
|| '3.8' | |
}} | |
pip-version: main | |
env: | |
TOXENV: >- | |
pip${{ matrix.pip-version }}${{ | |
!github.job_workflow_sha | |
&& '-coverage' | |
|| '' | |
}} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} from GitHub | |
id: python-install | |
if: "!endsWith(matrix.python-version, '-dev')" | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up Python ${{ matrix.python-version }} from deadsnakes | |
if: endsWith(matrix.python-version, '-dev') | |
uses: deadsnakes/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Log python version info (${{ matrix.python-version }}) | |
run: python --version --version | |
- name: Get pip cache dir | |
id: pip-cache | |
shell: bash | |
run: | | |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
- name: Pip cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: >- | |
${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}-${{ | |
hashFiles('pyproject.toml') }}-${{ hashFiles('tox.ini') }}-${{ | |
hashFiles('.pre-commit-config.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
- name: Install test dependencies | |
run: python -m pip install -U tox virtualenv | |
- name: Prepare test environment | |
run: tox -vv --notest -p auto --parallel-live | |
- name: Test pip ${{ matrix.pip-version }} | |
run: tox --skip-pkg-install | |
- name: Upload coverage to Codecov | |
if: >- | |
!github.job_workflow_sha | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.xml | |
flags: >- | |
CI-GHA, | |
OS-${{ runner.os }}, | |
VM-${{ matrix.os }}, | |
Py-${{ steps.python-install.outputs.python-version }}, | |
Pip-${{ matrix.pip-version }} | |
name: >- | |
OS-${{ runner.os }}, | |
VM-${{ matrix.os }}, | |
Py-${{ steps.python-install.outputs.python-version }}, | |
Pip-${{ matrix.pip-version }} | |
pypy: | |
name: ${{ matrix.os }} / ${{ matrix.python-version }} / ${{ matrix.pip-version }} | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- Ubuntu | |
- MacOS | |
- Windows | |
python-version: | |
- pypy-3.8 | |
pip-version: | |
- latest | |
env: | |
TOXENV: pip${{ matrix.pip-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get pip cache dir | |
id: pip-cache | |
shell: bash | |
run: | | |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
- name: Pip cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: >- | |
${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}-${{ | |
hashFiles('pyproject.toml') }}-${{ hashFiles('tox.ini') }}-${{ | |
hashFiles('.pre-commit-config.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
- name: Install tox | |
run: pip install tox | |
- name: Prepare test environment | |
run: tox --notest -p auto --parallel-live | |
- name: Test pip ${{ matrix.pip-version }} | |
run: tox | |
check: # This job does nothing and is only used for the branch protection | |
if: always() | |
needs: | |
- linters | |
- pypy | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@afee1c1eac2a506084c274e9c02c8e0687b48d9e | |
with: | |
jobs: ${{ toJSON(needs) }} |