FitTrackee/.gitlab-ci.yml
2021-11-03 18:27:21 +01:00

101 lines
2.2 KiB
YAML

image: python:3.9
variables:
POSTGRES_DB: fittrackee_test
POSTGRES_USER: fittrackee
POSTGRES_PASSWORD: fittrackee
POSTGRES_HOST: postgres
APP_SETTINGS: fittrackee.config.TestingConfig
DATABASE_TEST_URL: postgresql://fittrackee:fittrackee@postgres:5432/fittrackee_test
EMAIL_URL: smtp://none:none@0.0.0.0:1025
FLASK_APP: fittrackee/__main__.py
SENDER_EMAIL: fittrackee@example.com
services:
- name: postgres:latest
alias: postgres
stages:
- lint
- tests
- selenium
.python:
stage: tests
before_script:
- pip install --quiet poetry
- poetry config virtualenvs.create false
- poetry install --no-interaction --quiet
script:
- pytest fittrackee -p no:warnings --cov fittrackee --cov-report term-missing
.javascript:
stage: tests
before_script:
- apt-get update && apt-get install -y nodejs npm
- npm install --global yarn
- cd fittrackee_client
- yarn install
python-lint:
stage: lint
extends: .python
script:
- pytest --flake8 --isort --black -m "flake8 or isort or black" fittrackee e2e --ignore=fittrackee/migrations
python-type-check:
stage: lint
extends: .python
script:
- mypy fittrackee
eslint:
stage: lint
extends: .javascript
script:
- yarn lint
python-3.7:
extends: .python
image: python:3.7
python-3.8:
extends: .python
image: python:3.8
python-3.9:
extends: .python
python-3.10:
extends: .python
image: python:3.10
typescript:
stage: tests
before_script:
- apt-get update && apt-get install -y nodejs npm
- npm install --global yarn
- cd fittrackee_client
- yarn install
script:
- yarn test:unit
firefox:
stage: selenium
services:
- name: postgres:latest
alias: postgres
- name: selenium/standalone-firefox
alias: selenium
before_script:
- pip install --quiet poetry
- poetry config virtualenvs.create false
- poetry install --no-interaction --quiet
- flask db upgrade --directory fittrackee/migrations
- flask init-data
- setsid nohup flask run --with-threads -h 0.0.0.0 -p 5000 >> nohup.out 2>&1 &
- export TEST_APP_URL=http://$(hostname --ip-address):5000
- sleep 5
script:
- pytest e2e --driver Remote --capability browserName firefox --host selenium --port 4444