Skip to content

Commit ccdcd38

Browse files
committed
Run unit tests in CI
1 parent 7d74632 commit ccdcd38

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/lint.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,27 @@ on:
77

88
jobs:
99

10+
# From https://docs.github.com/en/actions/tutorials/use-containerized-services/create-postgresql-service-containers#configuring-the-runner-job-for-jobs-directly-on-the-runner-machine
11+
runner-job:
12+
runs-on: ubuntu-latest
13+
services:
14+
# Label used to access the service container
15+
postgres:
16+
# Docker Hub image
17+
image: postgres
18+
# Provide the password for postgres
19+
env:
20+
POSTGRES_PASSWORD: postgres
21+
# Set health checks to wait until postgres has started
22+
options: >-
23+
--health-cmd pg_isready
24+
--health-interval 10s
25+
--health-timeout 5s
26+
--health-retries 5
27+
ports:
28+
# Maps tcp port 5432 on service container to the host
29+
- 5432:5432
30+
1031
black:
1132
runs-on: ubuntu-latest
1233
steps:
@@ -83,3 +104,33 @@ jobs:
83104

84105
- name: Run isort
85106
run : isort --profile black .
107+
108+
109+
unit-tests:
110+
runs-on: ubuntu-latest
111+
strategy:
112+
matrix:
113+
python-version: ["3.12"]
114+
steps:
115+
- uses: actions/checkout@v4
116+
with:
117+
fetch-depth: 0 # Needed for versioningit to find the repo version
118+
- uses: actions/setup-python@v5
119+
with:
120+
python-version: ${{ matrix.python-version }}
121+
122+
- name: Install dependencies
123+
run: python -m pip install .[drf]
124+
125+
- name: Install dependencies
126+
run: python -m pip install --upgrade pip
127+
-r requirements/requirements-dev.in
128+
-r requirements/requirements-test.in
129+
130+
- name: Run unit tests
131+
run: python3 run_tests.py
132+
env:
133+
# The hostname used to communicate with the PostgreSQL service container
134+
POSTGRES_HOST: localhost
135+
# The default PostgreSQL port
136+
POSTGRES_PORT: 5432

0 commit comments

Comments
 (0)