[pre-commit.ci] pre-commit autoupdate #1393
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test suite | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
tests: | |
name: "Python ${{ matrix.python-version }}" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ "3.9", "3.10", "3.11", "3.12" ] | |
services: | |
mongodb: | |
image: mongo | |
ports: | |
- 27017:27017 | |
options: --health-cmd "mongosh mongodb://localhost:27017" --health-interval 10s --health-timeout 5s --health-retries 10 | |
minio: | |
image: bitnami/minio | |
env: | |
MINIO_ROOT_USER: minioadmin | |
MINIO_ROOT_PASSWORD: minioadmin | |
ports: | |
- 9000:9000 | |
options: --health-cmd "curl http://localhost:9000/minio/health/live" --health-interval 10s --health-timeout 5s --health-retries 10 | |
postgres: | |
image: postgres:17-alpine | |
env: | |
POSTGRES_USER: username | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: test_db | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
mysql: | |
image: mysql:8 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_USER: username | |
MYSQL_PASSWORD: password | |
MYSQL_DATABASE: test_db | |
ports: | |
- 3306:3306 | |
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
- name: Install Dependencies | |
run: pip install hatch | |
- name: Lint | |
run: hatch run test:lint | |
- name: Test sqla(postgresql) with LocalStorage & mongodb | |
env: | |
SQLA_ENGINE: 'postgresql+psycopg2://username:password@localhost:5432/test_db' | |
SQLA_ASYNC_ENGINE: 'postgresql+asyncpg://username:password@localhost:5432/test_db' | |
STORAGE_PROVIDER: 'LOCAL' | |
LOCAL_PATH: '/tmp/storage' | |
MONGO_URI: 'mongodb://localhost:27017/' | |
MONGO_DATABASE: 'test_db' | |
run: hatch run test:all | |
- name: Test LocalStorage & mysql | |
env: | |
SQLA_ENGINE: 'mysql+pymysql://username:password@localhost:3306/test_db' | |
SQLA_ASYNC_ENGINE: 'mysql+aiomysql://username:password@localhost:3306/test_db' | |
STORAGE_PROVIDER: 'LOCAL' | |
LOCAL_PATH: '/tmp/storage' | |
run: hatch run test:sqla | |
- name: Test Minio Storage provider & sqlite memory | |
env: | |
SQLA_ENGINE: 'sqlite:///test.db?check_same_thread=False' | |
SQLA_ASYNC_ENGINE: 'sqlite+aiosqlite:///test.db?check_same_thread=False' | |
STORAGE_PROVIDER: 'MINIO' | |
MINIO_KEY: 'minioadmin' | |
MINIO_SECRET: 'minioadmin' | |
MINIO_HOST: 'localhost' | |
MINIO_PORT: 9000 | |
MINIO_SECURE: false | |
run: hatch run test:sqla | |
- name: store coverage files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-${{ matrix.python-version }} | |
path: .coverage* | |
retention-days: 1 | |
include-hidden-files: true | |
coverage: | |
needs: | |
- tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
- name: get coverage files | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: coverage* | |
merge-multiple: true | |
- name: Install Dependencies | |
run: pip install hatch | |
- name: Coverage Report | |
run: hatch run cov:report | |
- name: Upload coverage | |
uses: codecov/codecov-action@v4 |