2021-08-02 20:14:07 +02:00

69 lines
2.0 KiB
YAML

name: Cypress
# Controls when the action will run.
on: [push, pull_request, workflow_dispatch]
env:
LANG: "de_DE.UTF-8"
jobs:
# Label of the container job
runner-job:
# Containers must run in Linux based operating systems
runs-on: ubuntu-latest
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: mdillon/postgis
# Provide the password for postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: gsevpt_tests
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Start server
run: |
flask database create-all
flask database seed
gunicorn -b 127.0.0.1:5001 -w 1 project:app --daemon
env:
DATABASE_URL: postgresql://postgres:postgres@localhost/gsevpt_tests
- name: Cypress run
uses: cypress-io/github-action@v2
with:
record: true
wait-on: "http://127.0.0.1:5001"
config: baseUrl=http://127.0.0.1:5001
env:
DATABASE_URL: postgresql://postgres:postgres@localhost/gsevpt_tests
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}