Skip to content

ci: adding in gh actions #7

ci: adding in gh actions

ci: adding in gh actions #7

Workflow file for this run

name: "Unit Tests"
on:
pull_request:
push:
jobs:
unittest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
services:
rabbitmq:
image: rabbitmq:3
env:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
ports:
- 5672:5672
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
postgres:
image: postgres:13
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --no-cache-dir -r requirements.txt
python -m pip install coverage
- name: Run tests
env:
DATABASE_URL: postgres://postgres:postgres@localhost/postgres
REDIS_URL: redis://localhost
CLOUDAMQP_URL: amqp://guest:guest@localhost
COVERAGE: ${{ secrets.COVERAGE }}
run: |
coverage run --concurrency=multiprocessing -m unittest tests/*.py
coverage combine
coverage report -m --fail-under ${COVERAGE:-80}