-
-
Notifications
You must be signed in to change notification settings - Fork 4
176 lines (152 loc) · 4.97 KB
/
Copy pathci.yml
File metadata and controls
176 lines (152 loc) · 4.97 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: CI
on:
push:
branches:
- master
paths:
- 'compose.yml'
- 'data/**'
- 'Dockerfile'
- 'guard_core/**'
- 'mypy.ini'
- '.pre-commit-config.yaml'
- 'pyproject.toml'
- 'pytest.ini'
- 'reqs.pip'
- 'tests/**'
pull_request_target:
branches:
- master
paths:
- 'compose.yml'
- 'data/**'
- 'Dockerfile'
- 'guard_core/**'
- 'mypy.ini'
- '.pre-commit-config.yaml'
- 'pyproject.toml'
- 'pytest.ini'
- 'reqs.pip'
- 'tests/**'
workflow_dispatch:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: '3.10'
- run: pip install uv
- run: uv sync --extra dev --extra otel --extra logfire
- run: uv run pre-commit run --all-files
test:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
permissions:
pull-requests: write
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Send Initial Slack Message
id: send_initial_slack_ci
uses: rennf93/good-comms@master
with:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
STATUS: 'Started'
CHANNEL_ID: '${{ secrets.SLACK_CHANNEL }}'
AUTHOR_NAME: 'Guard Core - CI & Tests - Py${{ matrix.python-version }}'
AUTHOR_LINK: 'https://github.com/rennf93/guard-core'
AUTHOR_ICON: ':test_tube:'
TITLE: 'CI & Tests Started - Py${{ matrix.python-version }}'
TITLE_LINK: 'https://github.com/rennf93/guard-core/actions'
MESSAGE: |
.
*CI & TESTS TRIGGERED!*
.
Matrix:
Python: ${{ matrix.python-version }}
Docs version:
${{ secrets.DOCS_VERSION }}
Commit:
${{ github.event.head_commit.message }}
.
COLOR: warning
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: |
pip install uv
- name: Install dependencies
run: |
uv sync --extra dev --extra otel --extra logfire
- name: Run tests
run: |
IPINFO_TOKEN='${{ secrets.IPINFO_TOKEN }}' REDIS_URL='redis://localhost:6379' REDIS_PREFIX='test:guard_core:' uv run pytest -v --cov=guard_core
- name: Notify Success on Slack Channel
uses: rennf93/good-comms@master
with:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
STATUS: 'Success'
CHANNEL_ID: '${{ secrets.SLACK_CHANNEL }}'
AUTHOR_NAME: 'Guard Core - CI & Tests - Py${{ matrix.python-version }}'
AUTHOR_LINK: 'https://github.com/rennf93/guard-core'
AUTHOR_ICON: ':gem:'
TITLE: 'CI & Tests Successful - Py${{ matrix.python-version }}'
TITLE_LINK: 'https://github.com/rennf93/guard-core/actions'
MESSAGE: |
.
Matrix:
Python: ${{ matrix.python-version }}
Docs version:
${{ secrets.DOCS_VERSION }}
Commit message:
${{ github.event.head_commit.message }}
Commit URL:
${{ github.event.head_commit.url }}
.
COLOR: good
SLACK_THREAD_TS: ${{ steps.send_initial_slack_ci.outputs.SLACK_THREAD_TS }}
- name: Send Failure Notification to Slack
if: failure()
uses: rennf93/good-comms@master
with:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
STATUS: 'Failed'
CHANNEL_ID: '${{ secrets.SLACK_CHANNEL }}'
AUTHOR_NAME: 'Guard Core - CI & Tests - Py${{ matrix.python-version }}'
AUTHOR_LINK: 'https://github.com/rennf93/guard-core'
AUTHOR_ICON: ':skull:'
TITLE: 'CI & Tests Failed - Py${{ matrix.python-version }}'
TITLE_LINK: 'https://github.com/rennf93/guard-core/actions'
MESSAGE: |
.
Matrix:
Python: ${{ matrix.python-version }}
Docs version:
${{ secrets.DOCS_VERSION }}
CI & Tests failed for commit:
${{ github.event.head_commit.message }}
Commit URL:
${{ github.event.head_commit.url }}
Please check the logs for more details.
.
COLOR: danger
SLACK_THREAD_TS: ${{ steps.send_initial_slack_ci.outputs.SLACK_THREAD_TS }}