Skip to content

Add social features [1st part] #1731

Add social features [1st part]

Add social features [1st part] #1731

Workflow file for this run

name: Python CI
on:
push:
paths-ignore: ['docs/**', 'docsrc/**', 'docker/**', 'fittrackee_client/**', '*.md']
pull_request:
paths-ignore: ['docs/**', 'docsrc/**', 'docker/**', 'fittrackee_client/**', '*.md']
types: [opened, synchronize, reopened]
env:
APP_SETTINGS: fittrackee.config.TestingConfig
DATABASE_TEST_URL: "postgresql://fittrackee:fittrackee@postgres:5432/fittrackee_test"
EMAIL_URL: "smtp://none:[email protected]:1025"
FLASK_APP: fittrackee/__main__.py
SENDER_EMAIL: [email protected]
UI_URL: https://0.0.0.0:5000
jobs:
python:
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }}
name: python ${{ matrix.python-version }} (postgresql 15)
runs-on: ubuntu-latest
container: python:${{ matrix.python-version }}
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
steps:
- uses: actions/checkout@v4
- 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: Create test databases
run: python db/create_ci_test_db.py
- name: Bandit
if: matrix.python-version == '3.11'
run: bandit -r fittrackee -c pyproject.toml
- name: Lint
if: matrix.python-version == '3.11'
run: ruff check fittrackee e2e
- name: Mypy
if: matrix.python-version == '3.11'
run: mypy fittrackee
- name: Pytest
run: pytest fittrackee -n auto --maxprocesses=2 -p no:warnings --cov fittrackee --cov-report term-missing --maxfail=1
postgresql:
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }}
name: postgresql ${{ matrix.psql-version }} (python 3.11)
runs-on: ubuntu-latest
container: python:3.11
services:
postgres:
image: postgres:${{ matrix.psql-version }}
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
psql-version: [ "12", "13", "14", "16", "17" ]
steps:
- uses: actions/checkout@v4
- 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: Create test databases
run: python db/create_ci_test_db.py
- name: Pytest
run: pytest fittrackee -n auto --maxprocesses=2 -p no:warnings --cov fittrackee --cov-report term-missing --maxfail=1
end2end:
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }}
name: e2e tests
runs-on: ubuntu-latest
needs: ["python"]
container: python:3.11
services:
postgres:
image: postgres:15
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
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"
steps:
- uses: actions/checkout@v4
- 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
nohup flask worker --processes=1 >> nohup.out 2>&1 &
pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444 --maxfail=1
end2end_package:
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }}
name: e2e tests with package
runs-on: ubuntu-latest
needs: ["python"]
container: python:3.11
services:
postgres:
image: postgres:15
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
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"
HOST: "0.0.0.0"
PORT: 5000
steps:
- uses: actions/checkout@v4
- name: Update pip and install build
run: python3 -m pip install --upgrade pip build
- name: Create and source virtual environment
run: |
python3 -m venv .venv
. .venv/bin/activate
- name: Build fittrackee package
run: python3 -m build
- name: Install fittrackee package
run: python3 -m pip install dist/fittrackee-$(cat VERSION).tar.gz
- name: Run migrations
run: ftcli db upgrade
- name: Install pytest and selenium
run: python3 -m pip install pytest==8.2.0 pytest-selenium==4.1.0 selenium==4.20.0 pytest-html==4.1.1
- name: Start application and run tests with Selenium
run: |
setsid nohup fittrackee >> nohup.out 2>&1 &
export TEST_APP_URL=http://$(hostname --ip-address):5000
sleep 5
nohup flask worker --processes=1 >> nohup.out 2>&1 &
pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444 --maxfail=1
end2end_package_update:
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }}
name: e2e tests after update
runs-on: ubuntu-latest
needs: ["python"]
container: python:3.11
services:
postgres:
image: postgres:15
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
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"
HOST: "0.0.0.0"
PORT: 5000
steps:
- uses: actions/checkout@v4
- name: Update pip and install build
run: python3 -m pip install --upgrade pip build
- name: Create and source virtual environment
run: |
python3 -m venv .venv
. .venv/bin/activate
- name: Install previous version of fittrackee from PyPI
run: python3 -m pip install fittrackee
- name: Run migrations
run: ftcli db upgrade
- name: Build fittrackee package
run: python3 -m build
- name: Install fittrackee package to update instance
run: python3 -m pip install dist/fittrackee-$(cat VERSION).tar.gz
- name: Run migrations to update database
run: ftcli db upgrade
- name: Install pytest and selenium
run: python3 -m pip install pytest==8.2.0 pytest-selenium==4.1.0 selenium==4.20.0 pytest-html==4.1.1
- name: Start application and run tests with Selenium
run: |
setsid nohup fittrackee >> nohup.out 2>&1 &
export TEST_APP_URL=http://$(hostname --ip-address):5000
sleep 5
nohup flask worker --processes=1 >> nohup.out 2>&1 &
pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444 --maxfail=1