DDIM #14
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: 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.11.9 | |
- 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') }} |