Skip to content

Choix date signature #1337

Choix date signature

Choix date signature #1337

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/coverage@v3.2
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
thresholdAll: 0.8
thresholdNew: 0.8
thresholdModified: 0.5