-
Notifications
You must be signed in to change notification settings - Fork 1
259 lines (256 loc) · 10.6 KB
/
release.yml
File metadata and controls
259 lines (256 loc) · 10.6 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
name: release
on:
workflow_dispatch:
inputs:
version:
description: Version to publish (3.8, all,...) (only one)
required: true
push:
branches:
- 'main'
- 'feature/*'
- 'feat/*'
jobs:
build:
runs-on: ubuntu-latest
env:
MYSQL_HOST: 127.0.0.1
MYSQL_DATABASE: test_db
MYSQL_USER: test_user
MYSQL_PASSWORD: password
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MYSQL_PORT: 33061
MYSQL_8_HOST: 127.0.0.1
MYSQL_8_DATABASE: test_db
MYSQL_8_USER: test_user
MYSQL_8_PASSWORD: password
MYSQL_8_ALLOW_EMPTY_PASSWORD: 'yes'
MYSQL_8_PORT: 33063
MARIADB_HOST: 127.0.0.1
MARIADB_DATABASE: test_db
MARIADB_USER: test_user
MARIADB_PASSWORD: password
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 'yes'
MARIADB_PORT: 33062
MARIADB_MYSQL_LOCALHOST_USER: true
MARIADB_10_HOST: 127.0.0.1
MARIADB_10_DATABASE: test_db
MARIADB_10_USER: test_user
MARIADB_10_PASSWORD: password
MARIADB_10_ALLOW_EMPTY_ROOT_PASSWORD: 'yes'
MARIADB_10_PORT: 33064
MARIADB_10_MYSQL_LOCALHOST_USER: true
POSTGRES_HOST: 127.0.0.1
POSTGRES_DB: test_db
POSTGRES_USER: test_user
POSTGRES_PASSWORD: password
POSTGRES_PORT: 5432
POSTGRES_16_HOST: 127.0.0.1
POSTGRES_16_DB: test_db
POSTGRES_16_USER: test_user
POSTGRES_16_PASSWORD: password
POSTGRES_16_PORT: 54316
POSTGRES_15_HOST: 127.0.0.1
POSTGRES_15_DB: test_db
POSTGRES_15_USER: test_user
POSTGRES_15_PASSWORD: password
POSTGRES_15_PORT: 54315
MSSQL_HOST: 127.0.0.1
MSSQL_DATABASE: test_db
MSSQL_USER: sa
MSSQL_PASSWORD: yourStrong(!)Password
MSSQL_PORT: 1433
services:
# Label used to access the service container
mssql:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
MSSQL_SA_PASSWORD: ${{env.MSSQL_PASSWORD}}
ACCEPT_EULA: Y
ports:
- 1433:1433
# todo: dont hardcode password
# options: >-
# --health-cmd "/opt/mssql-tools/bin/sqlcmd -U sa -P yourStrong(!)Password -Q 'SELECT 1' -b -o /dev/null"
# --health-interval 60s
# --health-timeout 30s
# --health-start-period 20s
# --health-retries 3
mysql:
image: mysql
env:
MYSQL_ALLOW_EMPTY_PASSWORD: ${{env.MYSQL_ALLOW_EMPTY_PASSWORD}}
MYSQL_USER: ${{env.MYSQL_USER}}
MYSQL_PASSWORD: ${{env.MYSQL_PASSWORD}}
MYSQL_ROOT_PASSWORD: ${{env.MYSQL_ROOT_PASSWORD}}
MYSQL_DATABASE: ${{env.MYSQL_DATABASE}}
ports:
- 33061:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
mysql-8:
image: mysql:8
env:
MYSQL_ALLOW_EMPTY_PASSWORD: ${{env.MYSQL_8_ALLOW_EMPTY_PASSWORD}}
MYSQL_USER: ${{env.MYSQL_8_USER}}
MYSQL_PASSWORD: ${{env.MYSQL_8_PASSWORD}}
MYSQL_ROOT_PASSWORD: ${{env.MYSQL_8_ROOT_PASSWORD}}
MYSQL_DATABASE: ${{env.MYSQL_8_DATABASE}}
ports:
- 33063:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
mariadb:
image: mariadb
env:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: ${{env.MARIADB_ALLOW_EMPTY_ROOT_PASSWORD}}
MARIADB_USER: ${{env.MARIADB_USER}}
MARIADB_PASSWORD: ${{env.MARIADB_PASSWORD}}
MARIADB_DATABASE: ${{env.MARIADB_DATABASE}}
MARIADB_MYSQL_LOCALHOST_USER: ${{env.MARIADB_MYSQL_LOCALHOST_USER}}
ports:
- 33062:3306
options: --health-cmd="healthcheck.sh --su-mysql --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3
mariadb-10:
image: mariadb:10
env:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: ${{env.MARIADB_10_ALLOW_EMPTY_ROOT_PASSWORD}}
MARIADB_USER: ${{env.MARIADB_10_USER}}
MARIADB_PASSWORD: ${{env.MARIADB_10_PASSWORD}}
MARIADB_DATABASE: ${{env.MARIADB_10_DATABASE}}
MARIADB_MYSQL_LOCALHOST_USER: ${{env.MARIADB_10_MYSQL_LOCALHOST_USER}}
ports:
- 33064:3306
options: --health-cmd="healthcheck.sh --su-mysql --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres
env:
POSTGRES_DB: ${{env.POSTGRES_DB}}
POSTGRES_USER: ${{env.POSTGRES_USER}}
POSTGRES_PASSWORD: ${{env.POSTGRES_PASSWORD}}
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres-16:
image: postgres:16
env:
POSTGRES_DB: ${{env.POSTGRES_16_DB}}
POSTGRES_USER: ${{env.POSTGRES_16_USER}}
POSTGRES_PASSWORD: ${{env.POSTGRES_16_PASSWORD}}
ports:
- 54316:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres-15:
image: postgres:15
env:
POSTGRES_DB: ${{env.POSTGRES_15_DB}}
POSTGRES_USER: ${{env.POSTGRES_15_USER}}
POSTGRES_PASSWORD: ${{env.POSTGRES_15_PASSWORD}}
ports:
- 54315:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
fail-fast: false
matrix:
version: [ "3.8","3.9","3.10","3.11","3.12","3.13" ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- '${{matrix.version}}/**'
docker:
- 'Dockerfile'
- name: Login to Docker Hub
uses: docker/login-action@v2
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Python Docker image
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version
run: docker build ./${{matrix.version}} --tag my-temp-python-image:latest
- name: Set actual python version
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version
run: echo "PYTHON_VERSION=$(docker run my-temp-python-image:latest python -V 2>&1 | grep -Po '(?<=Python )(.+)')" >> $GITHUB_ENV
- name: Build the Docker image
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version
run: docker build . --tag orbisk/django-test:${{env.PYTHON_VERSION}} --tag orbisk/django-test:${{matrix.version}}
- name: Mysql Grant
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version
run: |
echo "GRANT ALL on *.* to '${{env.MYSQL_USER}}';"| mysql -u root -h ${{env.MYSQL_HOST}} --port=${{env.MYSQL_PORT}}
- name: Mysql 8 Grant
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version
run: |
echo "GRANT ALL on *.* to '${{env.MYSQL_8_USER}}';"| mysql -u root -h ${{env.MYSQL_8_HOST}} --port=${{env.MYSQL_8_PORT}}
- name: MariaDB Grant
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version
run: |
echo "GRANT ALL on *.* to '${{env.MARIADB_USER}}';"| mysql -u root -h ${{env.MARIADB_HOST}} --port=${{env.MARIADB_PORT}}
- name: MariaDB 10 Grant
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version
run: |
echo "GRANT ALL on *.* to '${{env.MARIADB_10_USER}}';"| mysql -u root -h ${{env.MARIADB_10_HOST}} --port=${{env.MARIADB_10_PORT}}
- name: Test Databases
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version
run: |
docker run --network host -v /"$(pwd)/tests":/app -w /app \
-e MYSQL_HOST \
-e MYSQL_DATABASE \
-e MYSQL_USER \
-e MYSQL_PORT \
-e MYSQL_PASSWORD \
-e MYSQL_8_HOST \
-e MYSQL_8_DATABASE \
-e MYSQL_8_USER \
-e MYSQL_8_PORT \
-e MYSQL_8_PASSWORD \
-e MARIADB_HOST \
-e MARIADB_DATABASE \
-e MARIADB_USER \
-e MARIADB_PORT \
-e MARIADB_PASSWORD \
-e MARIADB_10_HOST \
-e MARIADB_10_DATABASE \
-e MARIADB_10_USER \
-e MARIADB_10_PORT \
-e MARIADB_10_PASSWORD \
-e POSTGRES_HOST \
-e POSTGRES_DB \
-e POSTGRES_USER \
-e POSTGRES_PORT \
-e POSTGRES_PASSWORD \
-e POSTGRES_16_HOST \
-e POSTGRES_16_DB \
-e POSTGRES_16_USER \
-e POSTGRES_16_PORT \
-e POSTGRES_16_PASSWORD \
-e POSTGRES_15_HOST \
-e POSTGRES_15_DB \
-e POSTGRES_15_USER \
-e POSTGRES_15_PORT \
-e POSTGRES_15_PASSWORD \
-e MSSQL_HOST \
-e MSSQL_PORT \
-e MSSQL_DATABASE \
-e MSSQL_USER \
-e MSSQL_PASSWORD \
-e UV_SYSTEM_PYTHON=true \
orbisk/django-test:${{env.PYTHON_VERSION}} sh -c "cd /app && uv pip install -r requirements.txt && python manage.py test"
- name: Push Image
if: (steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version) && github.ref == 'refs/heads/main'
run: docker push -a orbisk/django-test