-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (57 loc) · 1.98 KB
/
main.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
name: Trackdechets Website CI
on: pull_request
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: admin
POSTGRES_DB: td_website_test
ports: [ '5432:5432' ]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Set locales
run: sudo apt-get install -y tzdata locales && sudo locale-gen fr_FR && sudo dpkg-reconfigure --frontend=noninteractive locales
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
- name: Install pipenv
run: |
python -m pip install --upgrade pipenv wheel
- id: cache-pipenv
uses: actions/cache@v2
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
- name: Install python dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
pipenv install --deploy --dev
- name: Ruff lint
run: pipenv run ruff check .
- name: Ruff format
run: pipenv run ruff format --check .
- name: Bandit security checks
run: pipenv run bandit --exit-zero -c pyproject.toml -r src
- name: Bandit security checks
run: pipenv run bandit --exit-zero -c pyproject.toml -r src
- name: Run Tests
working-directory: src
run: |
pipenv run pytest
env:
DJANGO_SETTINGS_MODULE: core.settings.test
DATABASE_URL: postgresql://admin:postgres@localhost/td_website_test
ADMIN_SLUG: admin
WEBINARS_DOMAIN: formations
BREVO_GENERAL_NEWSLETTER_ID: 1
BREVO_TECH_NEWSLETTER_ID: 2
BREVO_API_KEY: x