11name : CI
2+
3+ env :
4+ POSTGRES_USER : location_api
5+ POSTGRES_DB : location_api
6+ POSTGRES_PASSWORD : location_api
7+
28on :
39 pull_request :
410 branches :
511 - main
612 push :
713 branches :
8- - main
14+ - ' ** '
915jobs :
1016 test :
1117 strategy :
1218 matrix :
1319 python-version : ["3.12"]
1420 os : [ubuntu-latest]
1521 runs-on : ${{ matrix.os }}
22+ services :
23+ postgres :
24+ image : postgis/postgis
25+ # platform: linux/amd64
26+ env :
27+ POSTGRES_USER : " $POSTGRES_USER"
28+ POSTGRES_DB : " $POSTGRES_DB"
29+ POSTGRES_PASSWORD : " $POSTGRES_PASSWORD"
30+ options : >-
31+ --health-cmd pg_isready
32+ --health-interval 10s
33+ --health-timeout 5s
34+ --health-retries 5
35+ ports :
36+ - 5432:5432
1637 steps :
17- - name : Check out repository
18- uses : actions/checkout@v3
38+ - uses : actions/checkout@v4
1939 - name : " Set up python ${{ matrix.python-version }}"
2040 id : setup-python
21- uses : actions/setup-python@v4
41+ uses : actions/setup-python@v5
2242 with :
2343 python-version : ${{ matrix.python-version }}
44+ cache : ' poetry'
2445 # ----------------------------------------------
25- # ----- install & configure poetry -----
26- # ----------------------------------------------
27- - name : Install Poetry
28- uses : snok/install-poetry@v1
29- with :
30- virtualenvs-create : true
31- virtualenvs-in-project : true
46+ # ----- install os packages -----
3247 # ----------------------------------------------
33- # load cached venv if cache exists
34- # ----------------------------------------------
35- - name : Load cached venv
36- id : cached-poetry-dependencies
37- uses : actions/cache@v3
38- with :
39- path : .venv
40- key : venv-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
48+ - name : Install system dependencies
49+ run : sudo apt-get update && sudo apt-get install -y binutils libproj-dev gdal-bin libgeoip1 python3-gdal
4150 # ----------------------------------------------
42- # install dependencies if cache does not exist
51+ # install dependencies
4352 # ----------------------------------------------
4453 - name : Install dependencies
45- if : steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
4654 run : poetry install --no-interaction --no-root
4755 # ----------------------------------------------
4856 # install your root project, if required
4957 # ----------------------------------------------
5058 - name : Install library
5159 run : poetry install --no-interaction
5260 # ----------------------------------------------
53- # Run tests
61+ # Run tests
5462 # ----------------------------------------------
5563 - name : Run tests
56- run : poetry run invoke test
57- # ----------------------------------------------
58- # Build docs
59- # ----------------------------------------------
60- - name : Build docs
61- run : poetry run invoke docs
62- # ----------------------------------------------
63- # Deploy docs (if on main)
64- # ----------------------------------------------
65- - name : Deploy docs 🚀
66- if : github.ref == 'refs/heads/main'
67- uses : JamesIves/github-pages-deploy-action@v4
68- with :
69- folder : docs/_build
64+ env :
65+ DATABASE_URL : " postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB"
66+ run : poetry run python ./runtests.py
0 commit comments