-
Notifications
You must be signed in to change notification settings - Fork 4
77 lines (65 loc) · 2.13 KB
/
push-pull-request.yml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: "Test and check"
on:
- pull_request
# Explicitely set permissions to allow Dependabot workflow runs to write in the PR
# for coverage's reporting.
# By default, these are read-only when the actions are ran by Dependabot
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#changing-github_token-permissions
permissions:
pull-requests: write
env:
DATABASE_URL: postgres://apilos:apilos@localhost:5432/apilos
DB_READONLY: postgres://apilos:apilos@localhost:5432/apilos
SECRET_KEY: secret-key
DEBUG: False
jobs:
check:
uses: ./.github/workflows/run_check.yml
coverage:
name: Test & Coverage
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
image: postgres
ports:
- 5432:5432
env:
POSTGRES_USER: apilos
POSTGRES_NAME: apilos
POSTGRES_HOST: postgres
POSTGRES_PASSWORD: apilos
POSTGRES_PORT: 5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12.2"
- name: Install dependencies
run: |
pip install pip-tools
pip install -r requirements.txt -r dev-requirements.txt
- name: Check migrations
run: |
python manage.py makemigrations --check --dry-run
- name: Execute test with coverage
run: |
coverage run -m pytest
- name: Create coverage report
run: coverage xml -o coverage.xml --fail-under=79
- name: Post coverage to PR
if: ${{ github.event.pull_request.head.repo.full_name == 'MTES-MCT/apilos' }}
uses: orgoro/[email protected]
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
thresholdAll: 0.8
thresholdNew: 0.8
thresholdModified: 0.5