-
Notifications
You must be signed in to change notification settings - Fork 3
486 lines (418 loc) · 19 KB
/
build_robotframework_aio.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
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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
name: Build RobotFramework AIO packages
on:
push:
tags:
- "rel/aio/*.*.*.*"
- "dev/aio/*.*.*.*"
pull_request:
types:
- closed
- opened
- synchronize
branches:
- develop
workflow_dispatch:
repository_dispatch:
types:
- TRIGGER_AIO
env:
GITHUB_PAT : ${{ secrets.PAT_GITHUB }}
GH_TOKEN: ${{ github.token }}
TRIGGER_BY: ${{ github.ref_type }}
TAG_NAME: ${{ github.ref_name }}
REF_NAME: ${{ github.ref_name }}
DEFAULT_REF: ${{ github.base_ref }}
GENDOC_PLANTUML_PATH: "../robotvscode/data/extensions/jebbs.plantuml-2.17.5"
INSTALLER_LOCATION: "https://github.com/test-fullautomation/RobotFramework_AIO/releases"
GITHUB_COPILOT_REF_URL: "https://docs.github.com/en/enterprise-cloud@latest/copilot/managing-copilot/managing-copilot-as-an-individual-subscriber/managing-your-copilot-subscription"
GITHUB_COPILOT_EXT_ARG: ""
VARIANT: "OSS"
jobs:
tag-repos:
name: Tag all related repositories
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install dependencies
run: python -m pip install -r ./tools/git-tag/requirements.txt
- name: Tag repositories
run: python ./tools/git-tag/git-tag.py "$TAG_NAME" ./config/repositories/tag_repos.json
trigger-aio:
runs-on: ubuntu-latest
name: Listen event trigger
if: github.event.action == 'TRIGGER_AIO'
outputs:
repository: ${{ steps.extract_data.outputs.REPOSITORY }}
branch: ${{ steps.extract_data.outputs.PULL_MERGE_BRANCH }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Extract request data
id: extract_data
run: |
# Extract value from request JSON payload
repository=$(jq -r .client_payload.repository $GITHUB_EVENT_PATH)
branch=$(jq -r .client_payload.branch $GITHUB_EVENT_PATH)
echo "REPOSITORY=${repository#test-fullautomation/}" >> "$GITHUB_OUTPUT"
echo "PULL_MERGE_BRANCH=$branch" >> "$GITHUB_OUTPUT"
build-linux:
strategy:
fail-fast: false
matrix:
version: [original, extended]
name: Build Linux packages
runs-on: ubuntu-latest
needs: [ tag-repos , trigger-aio ]
if: ${{ ! failure() && ! cancelled() }}
env:
MAINDOC_CONFIGFILE: --configfile "./maindoc/maindoc_configs/maindoc_config_OSS_${{ matrix.version }}.json"
REPO_CONFIG: "./config/repositories/repositories_${{ matrix.version }}.conf"
AIO_NAME: "RobotFramework AIO (${{ matrix.version }})"
BUNDLE_NAME: --bundle_name "RobotFramework AIO"
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install dependencies and set environment variables
run: |
sudo apt-get update
sudo apt-get install --fix-missing
chmod +x ./requirements_linux.sh
./requirements_linux.sh
echo "AIO_VERSION_DATE=$(date +%m.%Y)" >> $GITHUB_ENV
echo "AIO_VERSION=${TAG_NAME#[rd]e[vl]/aio/}" >> $GITHUB_ENV
echo "BUNDLE_VERSION_DATE=--bundle_version_date \"$(date +%m.%Y)\"" >> $GITHUB_ENV
echo "BUNDLE_VERSION=--bundle_version \"${TAG_NAME#[rd]e[vl]/aio/}\"" >> $GITHUB_ENV
# Environment variable for trigger process
echo "REPOSITORY=${{needs.trigger-aio.outputs.repository}}" >> $GITHUB_ENV
echo "PULL_REQUEST_BRANCH=${{needs.trigger-aio.outputs.branch}}" >> $GITHUB_ENV
# Update placeholders install-github-copilot-exts.sh script
sed -i "s|\$PLACEHOLDER_REF_URL|${GITHUB_COPILOT_REF_URL}|g" ./install/install-github-copilot-exts.sh
sed -i "s|\$GITHUB_COPILOT_EXT_ARG|${GITHUB_COPILOT_EXT_ARG}|g" ./config/build/dpkg_build/postinst.sh
- name: Clone repositories
run: |
chmod +x ./cloneall
./cloneall --config-file=${REPO_CONFIG}
- name: Install
run: |
chmod +x ./install/install.sh
./install/install.sh
- name: Build
run: |
chmod +x ./build
./build --config-file=${REPO_CONFIG} --sub-version=${{ matrix.version }}
- name: Update all documents
if: ${{ github.ref_type == 'tag' }}
run: |
cd ../robotframework-documentation
doc_branch=automation/task/update-rfw-documents
git config user.email "[email protected]"
git config user.name "Thong Hua"
git checkout -b $doc_branch
git remote add doc-repo https://${{ secrets.PAT_THONG }}@github.com/test-fullautomation/robotframework-documentation.git
git add RobotFrameworkAIO/Components.html
git add RobotFrameworkAIO/RobotFrameworkAIO_Reference*.pdf
git add RobotFrameworkAIO/Components.rst
git commit -m "Auto update documents of ${{ matrix.version }} version in robotframework-documents"
git push -u -f doc-repo $doc_branch
echo -e "\e[32;01mPush all changes completely ... \e[0m"
curl -f -X POST https://api.github.com/repos/test-fullautomation/robotframework-documentation/dispatches \
--header 'authorization: Bearer ${{ secrets.PAT_THONG }}' \
-H 'Accept: application/vnd.github.everest-preview+json' \
--data '{"event_type": "Document", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'", "branch" : "'"$doc_branch"'"}}'
if [ $? -ne 0 ]; then
echo "Error: curl command failed to trigger a document jobs"
exit 1
fi
echo -e "\e[32;01m Trigger jobs for pull request successfully...\e[0m"
- name: Upload built package
uses: actions/upload-artifact@v4
with:
name: linux-package-${{ matrix.version }}
path: output_lx/*.deb
- name: Upload documentation
uses: actions/upload-artifact@v4
with:
name: RobotFrameworkAIO_Reference_${{ matrix.version }}
path: ${{ runner.workspace }}/robotframework-documentation/RobotFrameworkAIO/RobotFrameworkAIO_Reference_${{ matrix.version }}.pdf
build-windows:
strategy:
fail-fast: false
matrix:
version: [original, extended]
name: Build Windows package
runs-on: windows-latest
needs: [ tag-repos , trigger-aio ]
if: ${{ ! failure() && ! cancelled() }}
env:
MAINDOC_CONFIGFILE: --configfile "./maindoc/maindoc_configs/maindoc_config_OSS_${{ matrix.version }}.json"
REPO_CONFIG: "./config/repositories/repositories_${{ matrix.version }}.conf"
AIO_NAME: "RobotFramework AIO (${{ matrix.version }})"
BUNDLE_NAME: --bundle_name "RobotFramework AIO"
steps:
- name: Support long path in git
run: git config --system core.longpaths true
- name: Checkout source
uses: actions/checkout@v4
- name: Install dependencies and set environment variables
shell: bash
run: |
. ./requirements_windows.sh
echo "GENDOC_LATEXPATH=$GENDOC_LATEXPATH" >> $GITHUB_ENV
echo "AIO_VERSION_DATE=$(date +%m.%Y)" >> $GITHUB_ENV
echo "AIO_VERSION=${TAG_NAME#[rd]e[vl]/aio/}" >> $GITHUB_ENV
echo "BUNDLE_VERSION_DATE=--bundle_version_date \"$(date +%m.%Y)\"" >> $GITHUB_ENV
echo "BUNDLE_VERSION=--bundle_version \"${TAG_NAME#[rd]e[vl]/aio/}\"" >> $GITHUB_ENV
echo "REPOSITORY=${{needs.trigger-aio.outputs.repository}}" >> $GITHUB_ENV
echo "PULL_REQUEST_BRANCH=${{needs.trigger-aio.outputs.branch}}" >> $GITHUB_ENV
# Update placeholders install-github-copilot-exts.sh script
sed -i "s|\$PLACEHOLDER_REF_URL|${GITHUB_COPILOT_REF_URL}|g" ./install/install-github-copilot-exts.ps1
- name: Clone repositories
shell: bash
run: |
chmod +x ./cloneall
./cloneall --config-file=${REPO_CONFIG}
- name: Install
shell: bash
run: ./install/install.sh
- name: Build
shell: bash
run: ./build --config-file=${REPO_CONFIG} --sub-version=${{ matrix.version }}
- name: Upload built package
uses: actions/upload-artifact@v4
with:
name: windows-package-${{ matrix.version }}
path: Output/
install-test-windows:
strategy:
fail-fast: false
matrix:
version: [original, extended]
name: Test Windows package
runs-on: windows-latest
needs: [ build-windows , trigger-aio ]
if: ${{ ! failure() && ! cancelled() }}
env:
RobotPythonPath: "C:/Program Files/RobotFramework/python39"
RobotTutorialPath: "C:/RobotTest/tutorial"
RobotPythonSitePackagesPath: "C:/Program Files/RobotFramework/python39/Lib/site-packages"
GENDOC_PLANTUML_PATH: "C:/Program Files/RobotFramework/robotvscode/data/extensions/jebbs.plantuml-2.17.5"
REPO_CONFIG: "./config/repositories/repositories_${{ matrix.version }}.conf"
TEST_CONFIG: "./config/testtrigger_config_${{ matrix.version }}.json"
steps:
- name: Support long path in git
run: git config --system core.longpaths true
- name: Checkout source
uses: actions/checkout@v4
- name: Clone repositories
shell: bash
run: |
export REPOSITORY="${{needs.trigger-aio.outputs.repository}}"
export PULL_REQUEST_BRANCH="${{needs.trigger-aio.outputs.branch}}"
chmod +x ./cloneall
./cloneall --config-file=${REPO_CONFIG}
- name: Download Windows installer package
uses: actions/download-artifact@v4
with:
name: windows-package-${{ matrix.version }}
- name: Install RobotFramework AIO on Windows
shell: cmd
run: ./scripts/install-windows.bat
- name: Run tests on Windows
shell: bash
run: |
"$RobotPythonPath/python" test/aio-test-trigger/aio-test-trigger.py --configfile ${TEST_CONFIG} 2>&1 | tee console_log.txt
# Get system error code from python program
exit_code=${PIPESTATUS[0]}
if [ $exit_code -ne 0 ]; then
exit 1
fi
- name: Run tests coverage on Windows
shell: bash
run: |
"$RobotPythonPath/python" test/aio-test-trigger/aio-test-coverage.py --configfile ${TEST_CONFIG} 2>&1 | tee console_log.txt
# Get system error code from python program
exit_code=${PIPESTATUS[0]}
- name: Generate release info
shell: cmd
run: |
"%RobotPythonPath%\python" .\tools\release_info\release_info.py --configfile ".\release_info_config_OSS_${{ matrix.version }}.json"
move .\tools\release_info\release_info_RobotFramework_AIO_*.html ..\
move .\tools\release_info\release_changelog.html ..\
- name: Generate tutorial doc
shell: cmd
run: |
"%RobotPythonPath%\python" ..\robotframework-tutorial\__setup\gen_doc_tutorial.py
- name: Upload test result as artifact
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: windows-aiotestlogfiles-${{ matrix.version }}
# long path issue on Windows when upload artifact
# https://github.com/actions/upload-artifact/issues/240
path: |
${{ runner.workspace }}/[Rr]obotframework*/**/*/aiotestlogfiles/*
${{ runner.workspace }}/[Pp]ython*/**/*/aiotestlogfiles/*
${{ runner.workspace }}/[Rr]obotframework*/**/*/testlogfiles/*
${{ runner.workspace }}/[Pp]ython*/**/*/testlogfiles/*
${{ runner.workspace }}/Robotframework_AIO/console_log.txt
${{ runner.workspace }}/[Rr]obotframework*/**/*/*/coverage_report/*
${{ runner.workspace }}/[Pp]ython*/**/*/*/coverage_report/*
${{ runner.workspace }}/[Rr]obotframework*/**/*/*/coverage_report/*
${{ runner.workspace }}/[Pp]ython*/**/*/*/coverage_report/*
${{ runner.workspace }}/release_info_RobotFramework_AIO_*.html
${{ runner.workspace }}/release_changelog.html
${{ runner.workspace }}/Robotframework_AIO/install-windows.log
install-test-linux:
strategy:
fail-fast: false
matrix:
version: [original, extended]
name: Test Linux package
runs-on: ubuntu-latest
needs: [ build-linux , trigger-aio ]
if: ${{ ! failure() && ! cancelled() }}
env:
REPO_CONFIG: "./config/repositories/repositories_${{ matrix.version }}.conf"
TEST_CONFIG: "./config/testtrigger_config_${{ matrix.version }}.json"
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Clone repositories
run: |
export REPOSITORY="${{needs.trigger-aio.outputs.repository}}"
export PULL_REQUEST_BRANCH="${{needs.trigger-aio.outputs.branch}}"
chmod +x ./cloneall
./cloneall --config-file=${REPO_CONFIG}
- name: Download Linux installer package
uses: actions/download-artifact@v4
with:
name: linux-package-${{ matrix.version }}
- name: Install on Linux
run: |
sudo apt-get update
sudo apt-get install ./*.deb --fix-missing
- name: Run tests on Linux
run: |
. /opt/rfwaio/linux/set_robotenv.sh
$RobotPythonPath/python3.9 test/aio-test-trigger/aio-test-trigger.py --configfile ${TEST_CONFIG} 2>&1 | tee console_log.txt
# Get system error code from python program
exit_code=${PIPESTATUS[0]}
if [ $exit_code -ne 0 ]; then
exit 1
fi
- name: Run tests coverage on Linux
run: |
. /opt/rfwaio/linux/set_robotenv.sh
"$RobotPythonPath/python3.9" test/aio-test-trigger/aio-test-coverage.py --configfile ${TEST_CONFIG} 2>&1 | tee console_log.txt
# Get system error code from python program
exit_code=${PIPESTATUS[0]}
- name: Generate release info
run: |
. /opt/rfwaio/linux/set_robotenv.sh
$RobotPythonPath/python3.9 tools/release_info/release_info.py --configfile ./release_info_config_OSS_${{ matrix.version }}.json
mv ./tools/release_info/release_info_RobotFramework_AIO_*.html ../
- name: Generate tutorial doc
run: |
. /opt/rfwaio/linux/set_robotenv.sh
$RobotPythonPath/python3.9 ../robotframework-tutorial/__setup/gen_doc_tutorial.py
- name: Upload test result as artifact
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: linux-aiotestlogfiles-${{ matrix.version }}
path: |
${{ runner.workspace }}/**/*/aiotestlogfiles/*
${{ runner.workspace }}/**/*/testlogfiles/*
${{ runner.workspace }}/**/*/console_log.txt
${{ runner.workspace }}/**/*/*/coverage_report/*
${{ runner.workspace }}/release_info_RobotFramework_AIO_*.html
release:
name: Release AIO
runs-on: ubuntu-latest
permissions:
contents: write
needs: [install-test-windows, install-test-linux]
if: ${{ ! failure() && ! cancelled() && github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/rel/aio/') }}
steps:
- name: Download artifact from build workflow
uses: actions/download-artifact@v4
- name: Get released version
run: |
echo "RELEASE_VERSION=${TAG_NAME#rel/aio/}" >> $GITHUB_ENV
mv windows-package-original/*.exe windows-package-original/setup_OSS_RobotFramework_AIO_Win_${TAG_NAME#rel/aio/}_original.exe
mv windows-package-extended/*.exe windows-package-extended/setup_OSS_RobotFramework_AIO_Win_${TAG_NAME#rel/aio/}_extended.exe
mv linux-package-original/*.deb linux-package-original/setup_OSS_RobotFramework_AIO_Linux_${TAG_NAME#rel/aio/}_original.deb
mv linux-package-extended/*.deb linux-package-extended/setup_OSS_RobotFramework_AIO_Linux_${TAG_NAME#rel/aio/}_extended.deb
mv windows-aiotestlogfiles-extended/release_info_RobotFramework_AIO_*.html windows-aiotestlogfiles-extended/release_info_OSS_RobotFramework_AIO_${TAG_NAME#rel/aio/}_extended.html
mv windows-aiotestlogfiles-original/release_info_RobotFramework_AIO_*.html windows-aiotestlogfiles-original/release_info_OSS_RobotFramework_AIO_${TAG_NAME#rel/aio/}_original.html
- name: Create/Update GitHub Release
id: create_update_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
omitNameDuringUpdate: true
prerelease: true
name: RobotFramework AIO version ${{ env.RELEASE_VERSION }}
artifacts: "windows-package-original/*.exe,windows-package-extended/*.exe,linux-package-original/*.deb,linux-package-extended/*.deb,windows-aiotestlogfiles-extended/release_info_*.html,windows-aiotestlogfiles-original/release_info_*.html,RobotFrameworkAIO_Reference_extended/*.pdf,RobotFrameworkAIO_Reference_original/*.pdf"
bodyFile: "windows-aiotestlogfiles-extended/release_changelog.html"
tag-to-publish-packges-to-pypi:
name: Tag Python packages to trigger workflow for publishing to PyPI
runs-on: ubuntu-latest
needs: [install-test-windows, install-test-linux]
if: ${{ ! failure() && ! cancelled() && github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/rel/aio/') }}
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install dependencies
run: python -m pip install -r ./tools/git-tag/requirements.txt
- name: Tag repositories
run: |
chmod +x ./tools/git-tag/tag_repos_with_their_version_file.sh
./tools/git-tag/tag_repos_with_their_version_file.sh ./config/repositories/publish_pypi_repos.txt
update-version-aio:
name: Update version AIO
runs-on: ubuntu-latest
needs: [install-test-windows, install-test-linux]
if: ${{ ! failure() && ! cancelled() && github.ref_type == 'tag' }}
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set Up Git User
run: |
git config user.email "[email protected]"
git config user.name "Thong Hua"
- name: Checkout automation branch
run: |
tag_branch=automation/task/update_controlfile_version
echo $tag_branch > tag_branch.txt
git checkout -b $tag_branch
- name: Update version AIO on control file
run: |
export AIO_VERSION=${TAG_NAME#[rd]e[vl]/aio/}
. ./include/bash/common.sh && update_debian_control_file
- name: Commit Changes
run: |
tag_branch=$(cat tag_branch.txt)
git add ./config/build/dpkg_build/control
git commit -m "Auto commit from GitHub Actions"
git push -u -f origin $tag_branch
- name: Create Pull Request
run: |
tag_branch=$(cat tag_branch.txt)
pr_exists=$(gh pr list --state open | grep -qw "Auto-generated pull request" && echo "found" || echo "not found")
if [ "$pr_exists" == "not found" ]; then
echo "Pull request not found. Creating a new one..."
gh pr create \
--base develop --head $tag_branch \
--title "Auto-generated pull request" \
--body "This PR was automatically generated by GitHub Actions to update version" \
--assignee test-fullautomation \
--reviewer huavanthong
else
echo "Pull request already exists. Skipping..."
fi
- name: Clean up
run: |
rm tag_branch.txt