ci(renovate): use digest pinning for GitHub actions #981
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: check | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
venv | |
key: >- | |
lint-${{ hashFiles( | |
'.github/requirements.txt', | |
'requirements/dev-requirements.txt', | |
'requirements/test-requirements.txt', | |
'pyproject.toml' | |
) }} | |
restore-keys: lint- | |
- name: Install dependencies | |
run: | | |
set -euxo pipefail | |
# venv due to mypy through pre-commit, venv-run | |
python3 -m venv venv | |
venv/bin/python3 -m pip install -Ur .github/requirements.txt | |
- run: venv/bin/gitlint --commits "origin/$GITHUB_BASE_REF..HEAD" | |
if: github.event_name == 'pull_request' | |
- uses: pre-commit/action@v3.0.0 | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- "3.10" | |
- "3.11" | |
- "3.12" | |
- "3.13.0-alpha - 3.13" | |
- "pypy-3.10" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
.nox | |
key: >- | |
test-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles( | |
'requirements/test-requirements.txt', | |
'pyproject.toml' | |
) }} | |
restore-keys: test-${{ runner.os }}-${{ matrix.python-version }}- | |
- uses: fjwillemsen/setup-nox2@v3.0.0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Run tests | |
run: | | |
v="${{ matrix.python-version }}" | |
v=${v##* } # "3.12.0-alpha - 3.12" -> "3.12" | |
v=${v//-} # "pypy-3.9" -> "pypy3.9" | |
nox --force-color --python "$v" | |
env: | |
PYTEST_ADDOPTS: --vcr-record=none --color=yes |