feat(ci): use action/cache
#92
Workflow file for this run
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
# SPDX-FileCopyrightText: 2024-now, Alex Turbov <zaufi@pm.me> | |
# SPDX-License-Identifier: CC0-1.0 | |
name: Run Unit Tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
env: | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
jobs: | |
test: | |
name: Hatch run unit tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- '3.10' | |
- '3.12' | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Prepare Cache | |
uses: actions/cache@v4 | |
with: | |
# TODO Hashing the whole `pyproject.toml` isn't nice! | |
key: py${{ matrix.python-version }}-hatch-${{ hashFiles('pyproject.toml') }}-tests | |
path: | | |
~/.cache/pip | |
~/.local/share/hatch | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Dependencies | |
run: | | |
pip install hatch | |
- name: Run tests | |
# NOTE Run tests per environment to avoid `default` environment activation | |
# when `hatch run test` running. | |
run: | | |
hatch run test.pytest.7x:test | |
hatch run test.pytest.8x:test |