Update github actions #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
env: | |
POSTGRES_USER: location_api | |
POSTGRES_DB: location_api | |
POSTGRES_PASSWORD: location_api | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- '**' | |
jobs: | |
test: | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
services: | |
postgres: | |
image: postgis/postgis | |
env: | |
POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
POSTGRES_DB: ${{ env.POSTGRES_DB }} | |
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: "Set up python ${{ matrix.python-version }}" | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'poetry' | |
#---------------------------------------------- | |
# ----- install os packages ----- | |
#---------------------------------------------- | |
- name: Install system dependencies | |
run: sudo apt-get update && sudo apt-get install -y binutils libproj-dev gdal-bin libgeoip1 python3-gdal | |
#---------------------------------------------- | |
# install dependencies | |
#---------------------------------------------- | |
- name: Install dependencies | |
run: poetry install --no-interaction --no-root | |
#---------------------------------------------- | |
# install your root project, if required | |
#---------------------------------------------- | |
- name: Install library | |
run: poetry install --no-interaction | |
#---------------------------------------------- | |
# Run tests | |
#---------------------------------------------- | |
- name: Run tests | |
env: | |
DATABASE_URL: "postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB" | |
run: poetry run python ./runtests.py |