Merge pull request #28 from slamora/feature/github-actions
Configure GitHub actions to run tests.
This commit is contained in:
commit
b0d4e06ac2
67
.github/workflows/flask.yml
vendored
Normal file
67
.github/workflows/flask.yml
vendored
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
name: Django CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master, testing]
|
||||||
|
pull_request:
|
||||||
|
branches: [master, testing]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# Service containers to run with `container-job`
|
||||||
|
services:
|
||||||
|
# Label used to access the service container
|
||||||
|
postgres:
|
||||||
|
# Docker Hub image
|
||||||
|
image: postgres:11
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
# Set health checks to wait until postgres has started
|
||||||
|
options: >-
|
||||||
|
--health-cmd pg_isready
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
|
env:
|
||||||
|
POSTGRES_DB: dh_test
|
||||||
|
POSTGRES_USER: dhub
|
||||||
|
POSTGRES_PASSWORD: ereuse
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
max-parallel: 4
|
||||||
|
matrix:
|
||||||
|
python-version: [3.7]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update -qy
|
||||||
|
sudo apt-get -y install postgresql-client
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install flake8 pytest
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
- name: Prepare database
|
||||||
|
env:
|
||||||
|
POSTGRES_DB: dh_test
|
||||||
|
POSTGRES_USER: dhub
|
||||||
|
POSTGRES_PASSWORD: ereuse
|
||||||
|
run: |
|
||||||
|
export PGPASSWORD=$POSTGRES_PASSWORD
|
||||||
|
psql -h "localhost" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION pgcrypto SCHEMA public;"
|
||||||
|
psql -h "localhost" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION ltree SCHEMA public;"
|
||||||
|
psql -h "localhost" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION citext SCHEMA public;"
|
||||||
|
psql -h "localhost" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION pg_trgm SCHEMA public;"
|
||||||
|
|
||||||
|
- name: Run Tests
|
||||||
|
run: |
|
||||||
|
pytest --maxfail=5 tests/
|
||||||
|
|
Reference in a new issue