1- name : Run tests
2-
1+ name : tests
32on :
43 push :
4+ branches :
5+ - " **"
6+ tags-ignore :
7+ - " *.*"
58
69jobs :
7- build :
8- runs-on : ubuntu-20.04
10+ tests :
11+ runs-on : ubuntu-latest
912 services :
1013 postgres :
1114 image : postgres
@@ -19,47 +22,36 @@ jobs:
1922 ports :
2023 - 5432:5432
2124 steps :
22- - uses : actions/checkout@v2
25+ - uses : actions/checkout@v4
2326
2427 - name : Set up Python
25- uses : actions/setup-python@v2
28+ uses : actions/setup-python@v5
2629 with :
27- python-version : " 3.12"
28-
29- # Below will create fresh template in path: minimal_project
30- - name : Generate project from template using cookiecutter
31- run : |
32- pip install cookiecutter
33- python tests/create_minimal_project.py
30+ python-version : " 3.12.2"
3431
3532 - name : Install Poetry
3633 uses : snok/install-poetry@v1
3734 with :
3835 virtualenvs-create : true
39- virtualenvs-in-project : true
36+ virtualenvs-in-project : false
37+ virtualenvs-path : /opt/venv
4038
41- # run tests from folder minimal_project
4239 - name : Load cached venv
43- id : cached-poetry-dependencies-template
44- uses : actions/cache@v2
40+ id : cached-poetry-dependencies
41+ uses : actions/cache@v4
4542 with :
46- path : minimal_project/. venv
47- key : venv-${{ runner.os }}-${{ hashFiles('minimal_project/ poetry.lock') }}
43+ path : /opt/ venv
44+ key : venv-${{ runner.os }}-python-3.12.2- ${{ hashFiles('poetry.lock') }}
4845
49- - name : Install template minimal dependencies
50- if : steps.cached-poetry-dependencies-template .outputs.cache-hit != 'true'
46+ - name : Install dependencies and actiavte virtualenv
47+ if : steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
5148 run : |
52- cd minimal_project
5349 poetry install --no-interaction --no-root
5450
55- - name : Run template minimal flake8 and then tests
51+ - name : Run tests
5652 env :
57- TEST_DATABASE_HOSTNAME : localhost
58- TEST_DATABASE_PASSWORD : postgres
59- TEST_DATABASE_PORT : 5432
60- TEST_DATABASE_USER : postgres
61- TEST_DATABASE_DB : postgres
53+ SECURITY__JWT_SECRET_KEY : very-not-secret
54+ DATABASE__HOSTNAME : localhost
55+ DATABASE__PASSWORD : postgres
6256 run : |
63- cd minimal_project
64- poetry run ruff app
65- poetry run coverage run -m pytest
57+ poetry run pytest
0 commit comments