2022-03-26 15:48:34 +01:00
|
|
|
name: Python CI
|
2022-03-26 14:45:36 +01:00
|
|
|
|
2022-03-26 15:48:34 +01:00
|
|
|
on:
|
|
|
|
push:
|
2022-03-26 16:10:21 +01:00
|
|
|
paths-ignore: ['docs/**', 'docsrc/**', 'fittrackee_client/**', '*.md']
|
2022-03-26 15:48:34 +01:00
|
|
|
pull_request:
|
2022-03-26 16:10:21 +01:00
|
|
|
paths-ignore: ['docs/**', 'docsrc/**', 'fittrackee_client/**', '*.md']
|
2022-03-26 14:45:36 +01:00
|
|
|
|
|
|
|
env:
|
|
|
|
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
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
python:
|
2022-10-26 17:36:01 +02:00
|
|
|
name: python ${{ matrix.python-version }} (postgresql 14)
|
2022-03-26 14:45:36 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: python:${{ matrix.python-version }}
|
|
|
|
services:
|
|
|
|
postgres:
|
2022-10-26 17:36:01 +02:00
|
|
|
image: postgres:14
|
2022-03-26 14:45:36 +01:00
|
|
|
env:
|
|
|
|
POSTGRES_DB: fittrackee_test
|
|
|
|
POSTGRES_USER: fittrackee
|
|
|
|
POSTGRES_PASSWORD: fittrackee
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-06-14 20:58:47 +02:00
|
|
|
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
|
2022-03-26 14:45:36 +01:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Install Poetry and Dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install --quiet poetry
|
|
|
|
poetry config virtualenvs.create false
|
|
|
|
poetry install --no-interaction --quiet
|
2022-05-28 20:01:14 +02:00
|
|
|
- name: Bandit
|
|
|
|
if: matrix.python-version == '3.10'
|
|
|
|
run: bandit -r fittrackee -c pyproject.toml
|
2023-06-14 20:58:47 +02:00
|
|
|
- name: Lint (isort & black)
|
2022-03-26 14:45:36 +01:00
|
|
|
if: matrix.python-version == '3.10'
|
2023-06-14 20:58:47 +02:00
|
|
|
run: pytest --isort --black -m "isort or black" fittrackee e2e --ignore=fittrackee/migrations -p no:warnings
|
|
|
|
- name: Lint (flake8)
|
|
|
|
if: matrix.python-version == '3.10'
|
|
|
|
run: flake8 fittrackee e2e
|
2022-03-26 14:45:36 +01:00
|
|
|
- name: Mypy
|
|
|
|
if: matrix.python-version == '3.10'
|
|
|
|
run: mypy fittrackee
|
|
|
|
- name: Pytest
|
|
|
|
run: pytest fittrackee -p no:warnings --cov fittrackee --cov-report term-missing
|
|
|
|
|
2022-10-26 17:36:01 +02:00
|
|
|
postgresql:
|
|
|
|
name: postgresql ${{ matrix.psql-version }} (python 3.10)
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: python:3.10
|
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres:${{ matrix.psql-version }}
|
|
|
|
env:
|
|
|
|
POSTGRES_DB: fittrackee_test
|
|
|
|
POSTGRES_USER: fittrackee
|
|
|
|
POSTGRES_PASSWORD: fittrackee
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-02-16 08:59:03 +01:00
|
|
|
psql-version: [ "11", "12", "13", "15" ]
|
2022-10-26 17:36:01 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Install Poetry and Dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install --quiet poetry
|
|
|
|
poetry config virtualenvs.create false
|
|
|
|
poetry install --no-interaction --quiet
|
|
|
|
- name: Pytest
|
|
|
|
run: pytest fittrackee -p no:warnings --cov fittrackee --cov-report term-missing
|
|
|
|
|
2022-03-26 14:57:31 +01:00
|
|
|
end2end:
|
|
|
|
runs-on: ubuntu-latest
|
2022-03-26 15:48:34 +01:00
|
|
|
needs: ["python"]
|
2022-03-26 14:57:31 +01:00
|
|
|
container: python:3.10
|
|
|
|
services:
|
|
|
|
postgres:
|
2022-10-26 17:36:01 +02:00
|
|
|
image: postgres:14
|
2022-03-26 14:57:31 +01:00
|
|
|
env:
|
|
|
|
POSTGRES_DB: fittrackee_test
|
|
|
|
POSTGRES_USER: fittrackee
|
|
|
|
POSTGRES_PASSWORD: fittrackee
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
selenium:
|
|
|
|
image: selenium/standalone-firefox
|
2022-03-23 12:36:41 +01:00
|
|
|
mailhog:
|
|
|
|
image: mailhog/mailhog:latest
|
|
|
|
redis:
|
|
|
|
image: redis:latest
|
|
|
|
env:
|
|
|
|
APP_SETTINGS: fittrackee.config.End2EndTestingConfig
|
|
|
|
EMAIL_URL: "smtp://mailhog:1025"
|
|
|
|
REDIS_URL: "redis://redis:6379"
|
2022-03-26 14:57:31 +01:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Install Poetry and Dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install --quiet poetry
|
|
|
|
poetry config virtualenvs.create false
|
|
|
|
poetry install --no-interaction --quiet
|
|
|
|
- name: Run migrations
|
|
|
|
run: flask db upgrade --directory fittrackee/migrations
|
|
|
|
- name: Start application and run tests with Selenium
|
|
|
|
run: |
|
|
|
|
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
|
2022-03-23 12:36:41 +01:00
|
|
|
nohup flask worker --processes=1 >> nohup.out 2>&1 &
|
2022-07-20 10:09:12 +02:00
|
|
|
pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444
|