@@ -5,32 +5,48 @@ name: Test, build and deploy
55on :
66 push :
77
8+ env :
9+ PYTHON_VERSION : 3.13
10+
811jobs :
912 test :
1013 runs-on : [self-hosted, common]
14+ env :
15+ TEST_DB_HOST : postgres
16+ TEST_DB_PORT : 5432
17+ TEST_DB_NAME : platform-back-${{ github.run_id }}
18+ TEST_DB_USER : bimdata
19+ TEST_DB_PASSWORD : bimdata
1120 steps :
1221 - uses : actions/checkout@v4
1322 - name : Set up Python
23+ id : setup-python
1424 uses : actions/setup-python@v5
1525 with :
16- python-version : " 3.13"
17- - name : psycopg2 prerequisites
18- run : |
19- sudo apt-get update
20- sudo apt-get install libpq-dev -y
26+ python-version : ${{ env.PYTHON_VERSION }}
2127 - name : Install poetry
2228 uses : snok/install-poetry@v1
23- - name : Install library
29+ with :
30+ virtualenvs-create : true
31+ virtualenvs-in-project : true
32+ virtualenvs-path : .venv
33+ env :
34+ POETRY_HOME : ${{ github.workspace }}/.${{ env.PYTHON_VERSION }}-poetry
35+ - name : Load cached venv
36+ id : cached-poetry-dependencies
37+ uses : actions/cache@v4
38+ with :
39+ path : .venv
40+ key : venv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }}
41+ - name : Install dependencies if no cache
42+ if : steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
43+ run : poetry install --no-interaction --no-root
44+ - name : Install api
2445 run : poetry install --no-interaction
2546 - name : Run tests
2647 run : >
2748 poetry run pytest
28- env :
29- TEST_DB_HOST : postgres
30- TEST_DB_PORT : 5432
31- TEST_DB_NAME : platform-back-${{ github.run_id }}
32- TEST_DB_USER : bimdata
33- TEST_DB_PASSWORD : bimdata
49+
3450 build-and-push :
3551 runs-on : [self-hosted, common]
3652 needs : [test]
0 commit comments