This repository has been archived by the owner on Jun 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
176 lines (148 loc) · 4.63 KB
/
quality_checks.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
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: Quality checks 👌🧪
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
pull_request:
branches:
- main
- develop
merge_group:
env:
DEBUG: True
KEY: ${{ secrets.OCIAL_KEY }}
DB_NAME: ocialdb
DB_USERNAME: ${{ secrets.OCIAL_USER }}
DB_PASSWORD: ${{ secrets.OCIAL_PASSWORD }}
DB_HOST: 127.0.0.1
DB_PORT: 5432
jobs:
dependency-review:
name: Vulnerable dependencies 🔎
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/[email protected]
with:
show-progress: false
- name: Scan
uses: actions/[email protected]
with:
## Workaround from https://github.com/actions/dependency-review-action/issues/456
## TODO: Remove when necessary
base-ref: ${{ github.event.pull_request.base.sha || 'master' }}
head-ref: ${{ github.event.pull_request.head.sha || github.ref }}
run:
name: Run 🏃♂️
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: ocialdb
POSTGRES_USER: ${{ secrets.OCIAL_USER }}
POSTGRES_PASSWORD: ${{ secrets.OCIAL_PASSWORD }}
ports:
- 5432:5432
# Necesario porque el contenedor no tiene comprobaciones de su salud
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout ⬇️
uses: actions/[email protected]
with:
show-progress: false
- name: Setup Python 🐍
uses: actions/[email protected]
with:
python-version: '3.x'
check-latest: true
- name: Install dependencies 📦
run: pip install -r requirements.txt
- name: Perform migrations 🗃️
run: python ./manage.py migrate
- name: Run Django Server 🏃♂️
run: |
python manage.py runserver &
sleep 10 # Espera a que el servidor esté listo
- name: Check server 🩺
run: |
curl -I http://127.0.0.1:8000/
sudo pkill python
test:
name: Test backend 👨🔬
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
DEBUG: True
POSTGRES_DB: ocialdb
POSTGRES_USER: ${{ secrets.OCIAL_USER }}
POSTGRES_PASSWORD: ${{ secrets.OCIAL_PASSWORD }}
ports:
- 5432:5432
# Necesario porque el contenedor no tiene comprobaciones de su salud
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout ⬇️
uses: actions/[email protected]
with:
show-progress: false
- name: Setup Python 🐍
uses: actions/[email protected]
with:
python-version: '3.x'
check-latest: true
- name: Install dependencies 📦
run: pip install -r requirements.txt
- name: Perform tests ⚒️
run: python ./manage.py test
pr_context:
name: Save PR context as artifact
if: ${{ always() && !cancelled() && github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
## Add needed jobs here
needs:
- dependency-review
- test
- run
steps:
- name: Save PR context
env:
PR_NUMBER: ${{ github.event.number }}
PR_SHA: ${{ github.sha }}
run: |
echo $PR_NUMBER > PR_number
echo $PR_SHA > PR_sha
- name: Upload PR number as artifact
uses: actions/[email protected]
with:
compression-level: 0
name: PR_context
path: |
PR_number
PR_sha
conventional_commits:
name: Conventional commits check 💬
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
runs-on: ubuntu-latest
steps:
- name: Checkout ⬇️
uses: actions/[email protected]
with:
show-progress: false
fetch-depth: 0
- name: Check if all commits comply with the specification
uses: webiny/[email protected]
no_merge_commits:
name: No merge commits check 🚫
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
runs-on: ubuntu-latest
steps:
- name: Checkout ⬇️
uses: actions/[email protected]
with:
show-progress: false
fetch-depth: 0
- name: Check commits
uses: greenled/[email protected]