Skip to content

bring back cache

bring back cache #19

Workflow file for this run

name: Unit Tests
on: [push, pull_request]
env:
branch_name: ${{ github.head_ref || github.ref_name }}
jobs:
test:
runs-on: ubuntu-20.04
permissions:
pull-requests: write
contents: read
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: 3.10.12
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.7.1
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
uses: actions/cache/restore@v3
id: cached-poetry-dependencies
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
venv-${{ runner.os }}-
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --no-interaction
- name: Run tests
run: |
source .venv/bin/activate
poetry run python -m unittest discover -s tests -v
- name: πŸ’Ύ Save cache
uses: actions/cache/save@v3
if: env.branch_name == 'main'
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}