👷 Add Rabbit service to test action #131
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
# trunk-ignore-all(checkov/CKV2_GHA_1) | |
name: Run Pytest tests in multiple Python versions | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: moderateapi | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
rabbit: | |
image: rabbitmq:4 | |
env: | |
RABBITMQ_DEFAULT_USER: guest | |
RABBITMQ_DEFAULT_PASS: guest | |
ports: | |
- 5672:5672 | |
options: --health-cmd "rabbitmq-diagnostics -q ping" --health-interval 10s --health-timeout 5s --health-retries 5 | |
minio: | |
image: docker.io/agmangas/minio-gh-actions | |
env: | |
MINIO_ROOT_USER: minio | |
MINIO_ROOT_PASSWORD: minio123 | |
MINIO_REGION: eu-central-1 | |
ports: | |
- 9000:9000 | |
- 9001:9001 | |
options: --health-cmd "mc ready local" --health-interval 10s --health-timeout 5s --health-retries 5 | |
env: | |
# trunk-ignore(checkov/CKV_SECRET_4) | |
TESTS_POSTGRES_URL: postgresql+asyncpg://postgres:postgres@localhost:5432/moderateapi | |
LOG_LEVEL: INFO | |
TESTS_MINIO_ROOT_USER: minio | |
TESTS_MINIO_ROOT_PASSWORD: minio123 | |
TESTS_MINIO_ENDPOINT_URL: http://localhost:9000 | |
TESTS_MINIO_USE_SSL: "false" | |
TESTS_MINIO_REGION: eu-central-1 | |
TESTS_MINIO_BUCKET: moderate-api-tests | |
TESTS_RABBIT_URL: amqp://guest:guest@localhost:5672/ | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: Gr1N/setup-poetry@v8 | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Run tests | |
run: | | |
poetry run pytest -sv |