Skip to content

Merge branch 'main' into ilert #2

Merge branch 'main' into ilert

Merge branch 'main' into ilert #2

Workflow file for this run

name: Tests (E2E)
on:
workflow_dispatch:
push:
paths:
- 'keep/**'
pull_request:
paths:
- 'keep/**'
# MySQL server and Postgres for testing
env:
PYTHON_VERSION: 3.11
STORAGE_MANAGER_DIRECTORY: /tmp/storage-manager
# this is from docker-compose-mysql.yml
MYSQL_ROOT_PASSWORD: keep
MYSQL_DATABASE: keep
# this is from docker-compose-postgres.yml
POSTGRES_USER: keepuser
POSTGRES_PASSWORD: keeppassword
POSTGRES_DB: keepdb
jobs:
tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_ROOT_PASSWORD }}
MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }}
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
postgres:
image: postgres:13
env:
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
ports:
- 5432:5432
volumes:
- postgres_data:/var/lib/postgresql/data
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1
with:
src: "./keep"
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v2
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies using poetry
run: poetry install --no-interaction --no-root
- name: Run unit tests and report coverage
run: |
# Add a step to wait for MySQL to be fully up and running
until nc -z 127.0.0.1 3306; do
echo "waiting for MySQL..."
sleep 1
done
echo "MySQL is up and running!"
# Add a step to wait for Postgres to be fully up and running
until nc -z 127.0.0.1:5432; do
echo "waiting for Postgres..."
sleep 1
done
echo "Postgres is up and running!"
# Run the tests
poetry run coverage run --branch -m pytest tests/e2e_tests/
- name: Convert coverage results to JSON (for CodeCov support)
run: poetry run coverage json --omit="keep/providers/*"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false # don't fail if we didn't manage to upload the coverage report
files: coverage.json
verbose: true