-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (45 loc) · 1.53 KB
/
test.yml
File metadata and controls
56 lines (45 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
name: Testing
on: [push, pull_request] # yamllint disable-line rule:truthy
jobs:
test:
runs-on: ubuntu-latest
services:
db:
image: postgres:16
env:
POSTGRES_DB: test_emg
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/setup-python@v5
with:
python-version: 3.12
- uses: pre-commit/action@v3.0.1
- name: Build Docker image
run: |
docker build --target ci -t app:latest .
- name: Check for unmigrated code
run: |
docker run --rm app:latest python manage.py makemigrations --check
- name: Run tests
run: |
docker run -v ${{ github.workspace }}/coverage:/app/coverage \
-v ${{ github.workspace }}/slurm-dev-environment/fs/nfs/public:/app/data \
--entrypoint bash \
--add-host=host.docker.internal:host-gateway \
-e DATABASE_URL=postgres://postgres:postgres@host.docker.internal:5432/emg --rm app:latest -c pytest
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: coverage/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
# Debugging info:
# This workflow file also works offline, using https://github.com/nektos/act.
# Tested on Apple M series, with Colima.