Skip to content

Commit a09b9b0

Browse files
committed
Update github actions
1 parent 36ae4aa commit a09b9b0

File tree

1 file changed

+34
-36
lines changed

1 file changed

+34
-36
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,67 @@
11
name: CI
2+
3+
env:
4+
POSTGRES_USER: location_api
5+
POSTGRES_DB: location_api
6+
POSTGRES_PASSWORD: location_api
7+
28
on:
39
pull_request:
410
branches:
511
- main
612
push:
713
branches:
8-
- main
14+
- '**'
915
jobs:
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
38+
- name: Install poetry
39+
run: pipx install poetry
1940
- name: "Set up python ${{ matrix.python-version }}"
2041
id: setup-python
21-
uses: actions/setup-python@v4
42+
uses: actions/setup-python@v5
2243
with:
2344
python-version: ${{ matrix.python-version }}
45+
cache: 'poetry'
2446
#----------------------------------------------
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
47+
# ----- install os packages -----
3248
#----------------------------------------------
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') }}
49+
- name: Install system dependencies
50+
run: sudo apt-get update && sudo apt-get install -y binutils libproj-dev gdal-bin libgeoip1 python3-gdal
4151
#----------------------------------------------
42-
# install dependencies if cache does not exist
52+
# install dependencies
4353
#----------------------------------------------
4454
- name: Install dependencies
45-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
4655
run: poetry install --no-interaction --no-root
4756
#----------------------------------------------
4857
# install your root project, if required
4958
#----------------------------------------------
5059
- name: Install library
5160
run: poetry install --no-interaction
5261
#----------------------------------------------
53-
# Run tests
62+
# Run tests
5463
#----------------------------------------------
5564
- 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
65+
env:
66+
DATABASE_URL: "postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB"
67+
run: poetry run python ./runtests.py

0 commit comments

Comments
 (0)