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+ env :
26+ POSTGRES_USER : ${{ env.POSTGRES_USER }}
27+ POSTGRES_DB : ${{ env.POSTGRES_DB }}
28+ POSTGRES_PASSWORD : ${{ env.POSTGRES_PASSWORD }}
29+ options : >-
30+ --health-cmd pg_isready
31+ --health-interval 10s
32+ --health-timeout 5s
33+ --health-retries 5
34+ ports :
35+ - 5432:5432
1636 steps :
17- - name : Check out repository
18- uses : actions/checkout@v3
37+ - uses : actions/checkout@v4
1938 - name : " Set up python ${{ matrix.python-version }}"
2039 id : setup-python
21- uses : actions/setup-python@v4
40+ uses : actions/setup-python@v5
2241 with :
2342 python-version : ${{ matrix.python-version }}
43+ cache : ' poetry'
2444 # ----------------------------------------------
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
45+ # ----- install os packages -----
3246 # ----------------------------------------------
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') }}
47+ - name : Install system dependencies
48+ run : sudo apt-get update && sudo apt-get install -y binutils libproj-dev gdal-bin libgeoip1 python3-gdal
4149 # ----------------------------------------------
42- # install dependencies if cache does not exist
50+ # install dependencies
4351 # ----------------------------------------------
4452 - name : Install dependencies
45- if : steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
4653 run : poetry install --no-interaction --no-root
4754 # ----------------------------------------------
4855 # install your root project, if required
4956 # ----------------------------------------------
5057 - name : Install library
5158 run : poetry install --no-interaction
5259 # ----------------------------------------------
53- # Run tests
60+ # Run tests
5461 # ----------------------------------------------
5562 - 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
63+ env :
64+ DATABASE_URL : " postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB"
65+ run : poetry run python ./runtests.py
0 commit comments