-
Notifications
You must be signed in to change notification settings - Fork 4
108 lines (94 loc) · 2.58 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
105
106
107
108
---
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
name: Python CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
PYTHON_VERSION: "3.12"
jobs:
python_build:
name: Test and build Python
env:
PYTHONDEVMODE: 1
FF_SLACK_SKIP_CHECKS: true
ENABLE_JIRA: true
ENABLE_RAID: true
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
os: ["ubuntu-latest"]
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:13-alpine
# Provide the password for postgres
env:
POSTGRES_DB: ff_dev
POSTGRES_USER: firefighter
POSTGRES_PASSWORD: firefighter
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
# Docker Hub image
image: redis:6-alpine
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@main
id: setup-pdm
with:
python-version: ${{ matrix.python-version }}
cache: true
allow-python-prereleases: true
# Needed for CSS and JS minification
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
- name: Install dependencies
run: pdm install -v && pdm info
- name: Run Tests
run: |
cp .env.example .env
pdm run collectstatic
pdm run tests-cov
- name: Type check with mypy
run: |
pdm run lint-mypy
- name: Lint with ruff
run: |
pdm run lint-ruff --output-format=github --exit-non-zero-on-fix
- name: Build with pdm
run: |
pdm build
- name: Publish Python artifacts on Github artifacts
uses: actions/upload-artifact@v4
if: ${{ matrix.python-version == env.PYTHON_VERSION }}
with:
name: python-artifacts
path: |
dist/*.whl
dist/*.tar.gz