Api v2 #209
Workflow file for this run
This file contains 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: Django CI | |
# triggers | |
on: | |
pull_request: | |
branches: | |
- devel | |
- main | |
push: | |
branches: | |
- devel | |
- main | |
# job definition | |
jobs: | |
health-check: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgis/postgis:14-master | |
env: # environmental variables required for the job | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: github_actions | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Cache dependency | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/zip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Setup python environment | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Install GDAL library | |
run: | | |
sudo add-apt-repository ppa:ubuntugis/ppa -y | |
sudo apt-get update -y | |
sudo apt-get install gdal-bin libgdal-dev -y | |
export CPLUS_INCLUDE_PATH=/usr/include/gdal | |
export C_INCLUDE_PATH=/usr/include/gdal | |
pip install GDAL==3.3.2 | |
- name: Install requirements | |
run: pip install -r requirements.txt | |
- name: Apply Database Migrations | |
run: python citizenvoice/manage.py migrate | |
- name: Run Tests | |
run: python citizenvoice/manage.py test ./citizenvoice/tests | |
- name: Run Development Server | |
run: | | |
nohup python citizenvoice/manage.py runserver & | |
sleep 5 | |
- name: Stop Development Server | |
run: pkill -f runserver | |