GA actions cache of full env (90->30s) #61
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: [ '*' ] | |
pull_request: | |
branches: [ '*' ] | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Cache virtual environment | |
uses: actions/cache@v3 | |
id: cache-venv | |
with: | |
path: venv | |
key: ${{ runner.os }}-venv-${{ hashFiles('requirements*.txt') }} | |
restore-keys: ${{ runner.os }}-venv- | |
- name: Install dependencies (only if no cache hit) | |
if: steps.cache-venv.outputs.cache-hit != 'true' | |
run: | | |
python -m venv venv | |
. venv/bin/activate | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt -r requirements-dev.txt | |
- name: Run tests | |
run: | | |
. venv/bin/activate | |
pytest -vvrP test.py | |
- name: Run performance tests | |
if: contains(github.event.head_commit.message, '[perf]') | |
run: | | |
. venv/bin/activate | |
python test_performance.py |