Bump pip from 23.0.1 to 24.0 in /.github/workflows #5092
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, pull_request] | |
jobs: | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { python-version: "3.10", os: ubuntu-latest } | |
- { python-version: "3.10", os: windows-latest } | |
- { python-version: "3.10", os: macos-latest } | |
- { python-version: "3.9", os: ubuntu-latest } | |
- { python-version: "3.8", os: ubuntu-latest } | |
- { python-version: "3.7", os: ubuntu-latest } | |
name: Python ${{ matrix.python-version }} (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: cookiecutter-hypermodern-python | |
- uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install tools using pip | |
working-directory: cookiecutter-hypermodern-python | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt pip | |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt cookiecutter | |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox | |
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry | |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry | |
- name: Generate project using Cookiecutter | |
run: cookiecutter --no-input cookiecutter-hypermodern-python | |
- name: Create git repository | |
if: matrix.os != 'windows-latest' | |
run: | | |
git init | |
git config --local user.name "GitHub Action" | |
git config --local user.email "[email protected]" | |
git add . | |
git commit --message="Initial import" | |
working-directory: hypermodern-python | |
- name: Create git repository (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
git init | |
git config --local user.name "GitHub Action" | |
git config --local user.email "[email protected]" | |
# https://github.com/cookiecutter/cookiecutter/issues/405 | |
$ErrorActionPreference = "Continue" | |
git add . | |
$ErrorActionPreference = "Stop" | |
git add --renormalize . | |
git commit --message="Initial import" | |
working-directory: hypermodern-python | |
- name: Compute cache key for pre-commit | |
if: matrix.os != 'windows-latest' | |
id: cache_key | |
shell: python | |
run: | | |
import hashlib | |
import sys | |
python = "py{}.{}".format(*sys.version_info[:2]) | |
payload = sys.version.encode() + sys.executable.encode() | |
digest = hashlib.sha256(payload).hexdigest() | |
result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest) | |
print("::set-output name=result::{}".format(result)) | |
- uses: actions/cache@v3 | |
if: matrix.os != 'windows-latest' | |
with: | |
path: ~/.cache/pre-commit | |
key: ${{ steps.cache_key.outputs.result }}-${{ hashFiles('hypermodern-python/.pre-commit-config.yaml') }} | |
restore-keys: | | |
${{ steps.cache_key.outputs.result }}- | |
- name: Run test suite using Nox | |
run: nox --force-color --python=${{ matrix.python-version }} | |
working-directory: hypermodern-python | |
- name: Install dependencies using Poetry | |
run: poetry install --ansi | |
working-directory: hypermodern-python |