mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
58 lines
1.4 KiB
YAML
58 lines
1.4 KiB
YAML
name: Run unit tests
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- "**"
|
|
|
|
|
|
jobs:
|
|
test-docker:
|
|
name: Tests (Docker)
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:15
|
|
env:
|
|
POSTGRES_USER: test
|
|
POSTGRES_PASSWORD: test
|
|
POSTGRES_DB: test
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build test image
|
|
run: docker build -f Dockerfile.test -t model-test .
|
|
|
|
- name: Initialise database schema
|
|
run: |
|
|
docker run --rm \
|
|
--network host \
|
|
-e DB_HOST=localhost \
|
|
-e DB_NAME=test \
|
|
-e DB_USERNAME=test \
|
|
-e DB_PASSWORD=test \
|
|
-e DB_PORT=5432 \
|
|
model-test python scripts/init_db.py
|
|
|
|
- name: Run tests
|
|
run: |
|
|
docker run --rm \
|
|
--network host \
|
|
-e EPC_AUTH_TOKEN=${{ secrets.DEV_EPC_AUTH_TOKEN }} \
|
|
-e HUBSPOT_API_KEY=${{ secrets.HUBSPOT_API_KEY }} \
|
|
-e DB_HOST=localhost \
|
|
-e DB_NAME=test \
|
|
-e DB_USERNAME=test \
|
|
-e DB_PASSWORD=test \
|
|
-e DB_PORT=5432 \
|
|
model-test pytest -vv -m 'not integration'
|