-
Notifications
You must be signed in to change notification settings - Fork 0
330 lines (251 loc) · 10.5 KB
/
python-integration.yaml
File metadata and controls
330 lines (251 loc) · 10.5 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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
---
name: 'Integration Test'
on:
workflow_call:
inputs:
POSTGRES_VERSIONS:
default: '[ "13", "14", "15", "16", "17" ]'
description: PostgreSQL Versions to test
required: false
type: string
PYTHON_VERSION:
default: '3.11'
description: Python Version to use
required: false
type: string
RABBITMQ_VERSIONS:
default: '[ "3.12", "3.13", "4.0", "4.1" ]'
description: PostgreSQL Versions to test
required: false
type: string
secrets:
WORKFLOW_TOKEN:
description: "token to clone with"
required: true
jobs:
integration-test:
name: Integration Test
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
postgres-version: ${{ fromJSON(inputs.POSTGRES_VERSIONS) }}
rabbitmq-version: ${{ fromJSON(inputs.RABBITMQ_VERSIONS) }}
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: 'true'
- name: Git
run: |
git fetch -fpvt
echo "latest tag commit $(git rev-list -n 1 $(git describe --tags --abbrev=0))"
- name: Set up Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
- name: Set up Python ${{ inputs.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.PYTHON_VERSION }}
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_dev.txt
- run: |
echo "::remove-matcher owner=python::"
- name: Run Tests
id: run-integration-test
continue-on-error: true
shell: bash
env:
CENTURION_RABBITMQ_IMAGE_TAG: ${{ matrix.rabbitmq-version }}
CENTURION_POSTGRES_IMAGE_TAG: ${{ matrix.postgres-version }}
run: |
export CENTURION_IMAGE_TAG=${GITHUB_SHA};
make test-integration
- name: Trace
run: |
echo "PWD is [${PWD}]";
ls -laR
- name: Test Report
if: success() || failure()
uses: dorny/test-reporter@dc3a92680fcc15842eef52e8c4606ea7ce6bd3f3
id: test-report
with:
name: Integration Test Report [python_${{ inputs.PYTHON_VERSION }}-postgres_${{ matrix.postgres-version }}-rabbitmq_${{ matrix.rabbitmq-version }}]
path: 'integration.JUnit.xml'
reporter: java-junit
use-actions-summary: false
- name: Upload Junit Test Report
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: integration-test-report-junit-python_${{ inputs.PYTHON_VERSION }}-postgres_${{ matrix.postgres-version }}-rabbitmq_${{ matrix.rabbitmq-version }}
path: integration.JUnit.xml
- name: Upload Artifacts
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: integration-logs-python_${{ inputs.PYTHON_VERSION }}-postgres_${{ matrix.postgres-version }}-rabbitmq_${{ matrix.rabbitmq-version }}
path: |
app/log/
artifacts/
log/
test/volumes/log/
test/volumes/artifacts/
- name: log file check
if: success() || failure()
run: |
ls -la log/ || true;
ls -la app/log/ || true;
badge-endpoint-versions:
name: Publish Version Badge endpoint files
if: ${{ github.ref_name == 'master' || github.ref_name == 'development' }}
needs:
- integration-test
runs-on: ubuntu-latest
steps:
- name: Create PostgreSQL Shields.io Endpoint.json
shell: bash
run: |
versions=$(echo '${{ inputs.POSTGRES_VERSIONS }}' | tr -d "[]\"" | tr ',' ' |' | xargs)
cat <<EOF > badge_endpoint_integration_postgres_versions.json
{
"schemaVersion": 1,
"label": "PostgreSQL",
"message": "$versions",
"color": "#336791",
"style": "plastic"
}
EOF
- name: Upload Badge Endpoint json
uses: actions/upload-artifact@v4
with:
name: badge_endpoint_integration_postgres_versions
path: badge_endpoint_integration_postgres_versions.json
- name: Create RabbitMQ Shields.io Endpoint.json
shell: bash
run: |
versions=$(echo '${{ inputs.RABBITMQ_VERSIONS }}' | tr -d "[]\"" | tr ',' ' |' | xargs)
cat <<EOF > badge_endpoint_integration_rabbitmq_versions.json
{
"schemaVersion": 1,
"label": "RabbitMQ",
"message": "$versions",
"logoSvg": "<svg width=\"800px\" height=\"800px\" viewBox=\"-7.5 0 271 271\" xmlns=\"http://www.w3.org/2000/svg\" preserveAspectRatio=\"xMidYMid\"><path d=\"M245.44 108.308h-85.09a7.738 7.738 0 0 1-7.735-7.734v-88.68C152.615 5.327 147.29 0 140.726 0h-30.375c-6.568 0-11.89 5.327-11.89 11.894v88.143c0 4.573-3.697 8.29-8.27 8.31l-27.885.133c-4.612.025-8.359-3.717-8.35-8.325l.173-88.241C54.144 5.337 48.817 0 42.24 0H11.89C5.321 0 0 5.327 0 11.894V260.21c0 5.834 4.726 10.56 10.555 10.56H245.44c5.834 0 10.56-4.726 10.56-10.56V118.868c0-5.834-4.726-10.56-10.56-10.56zm-39.902 93.233c0 7.645-6.198 13.844-13.843 13.844H167.69c-7.646 0-13.844-6.199-13.844-13.844v-24.005c0-7.646 6.198-13.844 13.844-13.844h24.005c7.645 0 13.843 6.198 13.843 13.844v24.005z\" fill=\"#F60\"/></svg>",
"color": "#F60",
"style": "plastic"
}
EOF
- name: Upload Badge Endpoint json
uses: actions/upload-artifact@v4
with:
name: badge_endpoint_integration_rabbitmq_versions
path: badge_endpoint_integration_rabbitmq_versions.json
- name: Checkout Endpoint Repo
uses: actions/checkout@v4
with:
repository: 'nofusscomputing/.github'
ref: 'master'
token: ${{ secrets.WORKFLOW_TOKEN }}
path: 'endpoint_publish'
fetch-depth: '1'
show-progress: true
submodules: false
- name: Create Publish Directories
shell: bash
run: |
echo "[Debug] PWD[${PWD}]";
cd endpoint_publish;
echo "[Debug] PWD[${PWD}]";
mkdir -p repositories/${{ github.repository }}/${{ github.ref_name }};
ls -la;
- name: Create Publish Directories
shell: bash
run: |
echo "[Debug] PWD[${PWD}]";
# cd repositories/${{ github.repository }}/${{ github.ref_name }};
echo "[Debug] PWD[${PWD}]";
- name: Download Postgres Version Badge Endpoint json
uses: actions/download-artifact@v4
with:
name: badge_endpoint_integration_postgres_versions
- name: Download RabbitMQ Version Badge Endpoint json
uses: actions/download-artifact@v4
with:
name: badge_endpoint_integration_rabbitmq_versions
- name: Add endpoint file
shell: bash
run: |
echo "[Debug] PWD[${PWD}]";
echo "[Debug] **************************** - cd endpoint_publish";
cd endpoint_publish;
echo "[Debug] **************************** - ls -la";
ls -la
echo "[Debug] ****************************";
echo "[Debug] PWD[${PWD}]";
echo "[Debug] **************************** - ls -la ../";
ls -la ../
echo "[Debug] **************************** - cp ../badge_endpoint_integration_postgres_versions.json repositories/${{ github.repository }}/${{ github.ref_name }}/badge_endpoint_integration_postgres_versions.json";
cp ../badge_endpoint_integration_postgres_versions.json repositories/${{ github.repository }}/${{ github.ref_name }}/badge_endpoint_integration_postgres_versions.json;
echo "[Debug] **************************** - cp ../badge_endpoint_integration_rabbitmq_versions.json repositories/${{ github.repository }}/${{ github.ref_name }}/badge_endpoint_integration_rabbitmq_versions.json";
cp ../badge_endpoint_integration_rabbitmq_versions.json repositories/${{ github.repository }}/${{ github.ref_name }}/badge_endpoint_integration_rabbitmq_versions.json;
echo "[Debug] **************************** - ls -la repositories/${{ github.repository }}/${{ github.ref_name }}/";
ls -la repositories/${{ github.repository }}/${{ github.ref_name }}/;
- name: Configure git
shell: bash
run: |
git config --global user.email "helpdesk@nofusscomputing.com";
git config --global user.name "nfc-bot";
- name: Git add
id: git-add
shell: bash
run: |
echo "[Debug] PWD[${PWD}]";
echo "[Debug] ****************************";
cd endpoint_publish;
echo "[Debug] ****************************";
ls -la
echo "[Debug] ****************************";
echo "[Debug] PWD[${PWD}]";
echo "[Debug] ****************************";
git status;
echo "[Debug] ****************************";
if [ "$(git status -s)" ]; then
echo "changed=true" > $GITHUB_OUTPUT;
echo "[Info] Changes need to be committed";
else
echo "changed=false" > $GITHUB_OUTPUT;
echo "[Info] NO changes to be committed";
fi
echo "[Debug] ****************************";
git add .
- name: Git commit
if: ${{ steps.git-add.outputs.changed == 'true' }}
shell: bash
run: |
echo "[Debug] PWD[${PWD}]";
echo "[Debug] ****************************";
cd endpoint_publish;
echo "[Debug] ****************************";
ls -la
echo "[Debug] ****************************";
echo "[Debug] PWD[${PWD}]";
echo "[Debug] ****************************";
git commit -m "chore: add versions badge endpount file ${{ github.repository }}/${{ github.ref_name }}"
- name: git push
if: ${{ steps.git-add.outputs.changed == 'true' }}
shell: bash
run: |
echo "[Debug] PWD[${PWD}]";
echo "[Debug] ****************************";
cd endpoint_publish;
echo "[Debug] ****************************";
ls -la
echo "[Debug] ****************************";
echo "[Debug] PWD[${PWD}]";
echo "[Debug] ****************************";
git push