-
-
Notifications
You must be signed in to change notification settings - Fork 91
104 lines (101 loc) · 2.96 KB
/
ci.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
name: CI
on:
- push
- pull_request
jobs:
poetry-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Poetry
run: pipx install poetry
- name: Validate pyproject.toml and poetry.lock
run: poetry check
python-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Setup environment
run: |
pipx install poetry
poetry config virtualenvs.prefer-active-python true
- name: Install dependencies
run: poetry install --no-root --only dev
- name: Run Ruff formatter
run: poetry run ruff format --check --diff
tests:
runs-on: ubuntu-latest
needs:
- poetry-check
- python-lint
strategy:
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
services:
postgres:
image: postgres:12
ports:
- 5432:5432
env:
POSTGRES_DB: peering_manager
POSTGRES_USER: devbox
POSTGRES_PASSWORD: devbox
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:6
ports:
- 6379:6379
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup environment
run: |
pipx install poetry
poetry config virtualenvs.prefer-active-python true
cp peering_manager/configuration.example.py peering_manager/configuration.py
- name: Install dependencies
run: poetry install --no-root --with dev,docs
- name: Build documentation
run: poetry run mkdocs build
- name: Collect static files
run: poetry run python manage.py collectstatic --no-input
- name: Check for missing migrations
run: poetry run python manage.py makemigrations --check
- name: Run tests
run: poetry run coverage run manage.py test
- name: Generate coverage report
run: poetry run coverage xml -i
- name: Report coverage
uses: coverallsapp/github-action@v2
with:
flag-name: run-${{ join(matrix.*, '-') }}
parallel: true
github-token: ${{ secrets.GITHUB_TOKEN}}