Add coverage for CSV branch import. #167
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: Test | |
on: [push, pull_request] | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-20.04 | |
services: | |
postgres: | |
image: postgis/postgis:13-3.1 | |
env: | |
POSTGRES_PASSWORD: password | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
PGHOST: localhost | |
PGUSER: postgres | |
PGPASSWORD: password | |
CFLAGS: "-O0" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install system packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y binutils libproj-dev gdal-bin | |
- name: Set up python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Load cached venv | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cache/pip | |
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
env: | |
POETRY_VIRTUALENVS_CREATE: "false" | |
run: | | |
pip install poetry==1.4.2 | |
poetry install --no-interaction --no-root | |
- name: Set up database & config | |
run: | | |
createdb mapit | |
psql -d mapit -c 'create extension postgis; create extension pg_trgm;' | |
echo 'MAPIT_DB_NAME: mapit' > conf/general.yml | |
echo 'MAPIT_DB_USER: postgres' >> conf/general.yml | |
echo 'MAPIT_DB_PASS: password' >> conf/general.yml | |
echo 'MAPIT_DB_HOST: localhost' >> conf/general.yml | |
echo 'DJANGO_SECRET_KEY: secret' >> conf/general.yml | |
- name: Run migrations | |
env: | |
SECRET_KEY: 'secret' | |
DATABASE_URL: 'postgis://postgres:password@localhost/mapit' | |
run: python manage.py migrate | |
- name: Run tests with coverage | |
env: | |
SECRET_KEY: 'secret' | |
DATABASE_URL: 'postgis://postgres:password@localhost/mapit' | |
run: coverage run python manage.py test | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |