pre-commit: bump repositories #221
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: | |
branches: | |
- main | |
jobs: | |
pytest: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- 'windows-latest' | |
- 'ubuntu-latest' | |
python: | |
- '3.7' | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
include: | |
- os: macos-latest | |
python: '3.7' | |
- os: macos-latest | |
python: '3.12' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up target Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Pick environment to run | |
run: | | |
import platform; import os; import sys; import codecs | |
base = '.'.join(map(str, sys.version_info[:2])) | |
env = 'BASE={}\n'.format(base) | |
print('Picked:\n{}for{}'.format(env, sys.version)) | |
with codecs.open(os.environ['GITHUB_ENV'], 'a', 'utf-8') as file_handler: | |
file_handler.write(env) | |
shell: python | |
- name: Set up Python for nox | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install nox | |
run: | | |
python -m pip install nox | |
nox --version | |
- name: Run tests | |
run: nox -s test-${{ env.BASE }} | |
- name: Send coverage report | |
uses: codecov/codecov-action@v1 | |
env: | |
PYTHON: ${{ matrix.python }} | |
with: | |
flags: tests | |
env_vars: PYTHON | |
name: ${{ matrix.python }} | |
# https://github.com/marketplace/actions/alls-green#why | |
required-checks-pass: # This job does nothing and is only used for the branch protection | |
if: always() | |
needs: | |
- pytest | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} |