-
Notifications
You must be signed in to change notification settings - Fork 10
639 lines (567 loc) · 24.4 KB
/
continuous_integration.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
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
name: Continuous Integration
on:
workflow_dispatch:
push:
branches: [ amd-staging, amd-mainline ]
paths-ignore:
- '*.md'
- 'source/docs/**'
- 'CODEOWNERS'
pull_request:
paths-ignore:
- '*.md'
- 'source/docs/**'
- 'CODEOWNERS'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# TODO(jrmadsen): replace LD_RUNPATH_FLAG, GPU_TARGETS, etc. with internal handling in cmake
ROCM_PATH: "/opt/rocm"
GPU_TARGETS: "gfx900 gfx906 gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100 gfx1101 gfx1102"
PATH: "/usr/bin:$PATH"
navi3_EXCLUDE_TESTS_REGEX: "^(test-page-migration-(execute|validate))$"
vega20_EXCLUDE_TESTS_REGEX: "^(test-page-migration-(execute|validate))$"
mi200_EXCLUDE_TESTS_REGEX: "^(test-page-migration-(execute|validate))$"
mi300_EXCLUDE_TESTS_REGEX: "^(test-page-migration-(execute|validate))$"
mi300a_EXCLUDE_TESTS_REGEX: "^(test-page-migration-(execute|validate))$"
mi325_EXCLUDE_TESTS_REGEX: "^(test-page-migration-(execute|validate)|counter-collection-buffer)$"
navi3_EXCLUDE_LABEL_REGEX: "^(pc-sampling|pc_sampling|openmp-target)$"
vega20_EXCLUDE_LABEL_REGEX: "^(pc-sampling|pc_sampling|openmp-target)$"
mi200_EXCLUDE_LABEL_REGEX: "^(openmp-target)$"
mi300_EXCLUDE_LABEL_REGEX: "^(pc-sampling|pc_sampling)$"
mi300a_EXCLUDE_LABEL_REGEX: ""
mi325_EXCLUDE_LABEL_REGEX: "^(pc-sampling|pc_sampling)$"
jobs:
core-deb:
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
strategy:
fail-fast: false
matrix:
runner: ['vega20', 'mi300a']
os: ['ubuntu-22.04']
build-type: ['RelWithDebInfo']
ci-flags: ['--linter clang-tidy']
runs-on: ${{ matrix.runner }}-emu-runner-set
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
CORE_EXT_RUNNER: mi300
steps:
- uses: actions/checkout@v4
- name: Install requirements
timeout-minutes: 10
shell: bash
run: |
git config --global --add safe.directory '*'
apt-get update
apt-get install -y build-essential cmake g++-11 g++-12 python3-pip libdw-dev rccl-dev rccl-unittests
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 20 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
python3 -m pip install -r requirements.txt
- name: List Files
shell: bash
run: |
echo "PATH: ${PATH}"
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
cat /opt/rocm/.info/version
ls -la
- name: Enable PC Sampling
if: ${{ contains(matrix.runner, 'mi200') || contains(matrix.runner, 'mi300a') }}
shell: bash
run: |
echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV
- name: Configure, Build, and Test
timeout-minutes: 30
shell: bash
run:
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-core
--build-jobs 16
--site ${RUNNER_HOSTNAME}
--gpu-targets ${{ env.GPU_TARGETS }}
--run-attempt ${{ github.run_attempt }}
--
-DROCPROFILER_DEP_ROCMCORE=ON
-DROCPROFILER_BUILD_DOCS=OFF
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-sdk
-DCPACK_GENERATOR='DEB;RPM;TGZ'
-DCPACK_PACKAGING_INSTALL_PREFIX="$(realpath /opt/rocm)"
-DPython3_EXECUTABLE=$(which python3)
--
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
- name: Install
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
timeout-minutes: 10
run:
cmake --build build --target install --parallel 16
- name: Build Packaging
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
timeout-minutes: 10
run:
cmake --build build --target package --parallel 16
- name: Test Install Build
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
timeout-minutes: 10
shell: bash
run: |
CMAKE_PREFIX_PATH=/opt/rocprofiler-sdk cmake -B build-samples samples
CMAKE_PREFIX_PATH=/opt/rocprofiler-sdk cmake -B build-tests tests
export LD_LIBRARY_PATH=/opt/rocprofiler-sdk/lib:${LD_LIBRARY_PATH}
cmake --build build-samples --target all --parallel 16
cmake --build build-tests --target all --parallel 16
ctest --test-dir build-samples -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
ctest --test-dir build-tests -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
- name: Install Packages
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
timeout-minutes: 5
shell: bash
run: |
export PATH=${PATH}:/usr/local/sbin:/usr/sbin:/sbin
ls -la
ls -la ./build
dpkg -i ./build/rocprofiler-sdk-roctx_*.deb
for i in $(ls -S ./build/rocprofiler-sdk*.deb | egrep -v roctx); do dpkg -i ${i}; done;
- name: Test Installed Packages
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
timeout-minutes: 20
shell: bash
run: |
CMAKE_PREFIX_PATH=/opt/rocm cmake -B build-samples-deb /opt/rocm/share/rocprofiler-sdk/samples
CMAKE_PREFIX_PATH=/opt/rocm cmake -B build-tests-deb /opt/rocm/share/rocprofiler-sdk/tests
cmake --build build-samples-deb --target all --parallel 16
cmake --build build-tests-deb --target all --parallel 16
ctest --test-dir build-samples-deb -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
ctest --test-dir build-tests-deb -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
- name: Archive production artifacts
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
uses: actions/upload-artifact@v4
with:
name: installers-deb
path: |
${{github.workspace}}/build/*.deb
${{github.workspace}}/build/*.rpm
${{github.workspace}}/build/*.tgz
core-rpm:
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
strategy:
fail-fast: false
matrix:
runner: ['mi325']
os: ['rhel-emu', 'sles-emu']
build-type: ['RelWithDebInfo']
ci-flags: ['--linter clang-tidy']
runs-on: ${{ matrix.os }}-runner-set
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
CORE_EXT_RUNNER: navi3
steps:
- uses: actions/checkout@v4
- name: Install requirements
timeout-minutes: 10
shell: bash
run: |
sudo python3 -m pip install 'perfetto<0.9.0'
sudo python3 -m pip install -r requirements.txt
- name: List Files
shell: bash
run: |
echo "PATH: ${PATH}"
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
cat /opt/rocm/.info/version
ls -la
- name: Enable PC Sampling
if: ${{ contains(matrix.runner, 'mi200') || contains(matrix.runner, 'mi300a') }}
shell: bash
run: |
echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV
- name: Configure, Build, and Test
timeout-minutes: 30
shell: bash
run:
sudo LD_LIBRARY_PATH=./build/lib:$LD_LIBRARY_PATH python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-core
--build-jobs 16
--site ${RUNNER_HOSTNAME}
--gpu-targets ${{ env.GPU_TARGETS }}
--run-attempt ${{ github.run_attempt }}
--
-DROCPROFILER_DEP_ROCMCORE=ON
-DROCPROFILER_BUILD_DOCS=OFF
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-sdk
-DCPACK_GENERATOR='DEB;RPM;TGZ'
-DCPACK_PACKAGING_INSTALL_PREFIX="$(realpath /opt/rocm)"
-DPython3_EXECUTABLE=$(which python3)
--
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
- name: Install
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
timeout-minutes: 10
run:
cmake --build build --target install --parallel 16
- name: Build Packaging
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
timeout-minutes: 10
run:
cmake --build build --target package --parallel 16
- name: Test Install Build
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
timeout-minutes: 10
shell: bash
run: |
CMAKE_PREFIX_PATH=/opt/rocprofiler-sdk cmake -B build-samples samples
CMAKE_PREFIX_PATH=/opt/rocprofiler-sdk cmake -B build-tests tests
export LD_LIBRARY_PATH=/opt/rocprofiler-sdk/lib:${LD_LIBRARY_PATH}
cmake --build build-samples --target all --parallel 16
cmake --build build-tests --target all --parallel 16
ctest --test-dir build-samples -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
ctest --test-dir build-tests -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
- name: Install Packages
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
timeout-minutes: 5
shell: bash
run: |
export PATH=${PATH}:/usr/local/sbin:/usr/sbin:/sbin
ls -la
ls -la ./build
dpkg -i ./build/rocprofiler-sdk-roctx_*.deb
for i in $(ls -S ./build/rocprofiler-sdk*.deb | egrep -v roctx); do dpkg -i ${i}; done;
- name: Test Installed Packages
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
timeout-minutes: 20
shell: bash
run: |
CMAKE_PREFIX_PATH=/opt/rocm cmake -B build-samples-deb /opt/rocm/share/rocprofiler-sdk/samples
CMAKE_PREFIX_PATH=/opt/rocm cmake -B build-tests-deb /opt/rocm/share/rocprofiler-sdk/tests
cmake --build build-samples-deb --target all --parallel 16
cmake --build build-tests-deb --target all --parallel 16
ctest --test-dir build-samples-deb -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
ctest --test-dir build-tests-deb -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
- name: Archive production artifacts
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
uses: actions/upload-artifact@v4
with:
name: installers-rpm
path: |
${{github.workspace}}/build/*.deb
${{github.workspace}}/build/*.rpm
${{github.workspace}}/build/*.tgz
code-coverage:
if: ${{ contains(github.event_name, 'pull_request') }}
strategy:
# fail-fast: false
matrix:
runner: ['mi200']
os: ['ubuntu-22.04']
build-type: ['Release']
runs-on: ${{ matrix.runner }}-emu-runner-set
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
GCC_COMPILER_VERSION: 11
ROCPROFILER_PC_SAMPLING_BETA_ENABLED: 1
steps:
- name: Patch Git
timeout-minutes: 25
run: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository -y ppa:git-core/ppa
apt-get update
apt-get install -y git
- uses: actions/checkout@v4
- name: Load Existing XML Code Coverage
if: github.event_name == 'pull_request'
id: load-coverage
uses: actions/cache@v4
with:
key: ${{ github.event.pull_request.base.sha }}-codecov
path: .codecov/**
- name: Copy Existing XML Code Coverage
if: github.event_name == 'pull_request'
shell: bash
run: |
if [ -d .codecov ]; then cp -r .codecov .codecov.ref; fi
- name: Configure Env
shell: bash
run: |
echo "${PATH}:/usr/local/bin:${HOME}/.local/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:${HOME}/.local/lib" >> $GITHUB_ENV
- name: Install requirements
timeout-minutes: 10
shell: bash
run: |
git config --global --add safe.directory '*'
apt-get update
apt-get install -y build-essential cmake python3-pip gcovr wkhtmltopdf xvfb xfonts-base xfonts-75dpi xfonts-100dpi xfonts-utils xfonts-encodings libfontconfig libdw-dev
python3 -m pip install -r requirements.txt
- name: Sync gcov with compilers
timeout-minutes: 10
shell: bash
run:
apt-get install -y gcc-${{ env.GCC_COMPILER_VERSION }} g++-${{ env.GCC_COMPILER_VERSION }} &&
update-alternatives
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_COMPILER_VERSION }} 500
--slave /usr/bin/g++ g++ /usr/bin/g++-${{ env.GCC_COMPILER_VERSION }}
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_COMPILER_VERSION }}
- name: List Files
shell: bash
run: |
echo "PATH: ${PATH}"
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
cat /opt/rocm/.info/version
ls -la
- name: Enable PC Sampling
if: ${{ contains(matrix.runner, 'mi200') || contains(matrix.runner, 'mi300a') }}
shell: bash
run: |
echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV
- name: Configure, Build, and Test (Total Code Coverage)
timeout-minutes: 30
shell: bash
run:
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-codecov
--build-jobs 16
--site ${RUNNER_HOSTNAME}
--gpu-targets ${{ env.GPU_TARGETS }}
--coverage all
--run-attempt ${{ github.run_attempt }}
--
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DPython3_EXECUTABLE=$(which python3)
--
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
- name: Configure, Build, and Test (Tests Code Coverage)
timeout-minutes: 30
shell: bash
run:
find build -type f | egrep '\.gcda$' | xargs rm &&
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-codecov-tests
--build-jobs 16
--site ${RUNNER_HOSTNAME}
--gpu-targets ${{ env.GPU_TARGETS }}
--coverage tests
--run-attempt ${{ github.run_attempt }}
--
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DPython3_EXECUTABLE=$(which python3)
--
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
- name: Configure, Build, and Test (Samples Code Coverage)
timeout-minutes: 30
shell: bash
run:
find build -type f | egrep '\.gcda$' | xargs rm &&
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-codecov-samples
--build-jobs 16
--site ${RUNNER_HOSTNAME}
--gpu-targets ${{ env.GPU_TARGETS }}
--coverage samples
--run-attempt ${{ github.run_attempt }}
--
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DPython3_EXECUTABLE=$(which python3)
--
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
- name: Save XML Code Coverage
id: save-coverage
uses: actions/cache/save@v4
with:
key: ${{ github.sha }}-codecov
path: |
.codecov/*.xml
- id: generatereport
name: Generate Code Coverage Comment
if: github.event_name == 'pull_request'
timeout-minutes: 5
shell: bash
run: |
echo "PWD: ${PWD}"
ls -la
for i in "all" "tests" "samples"; do
wkhtmltoimage --enable-local-file-access --quality 70 .codecov/${i}.html .codecov/${i}.png
done
ls -la .codecov
which -a git
git --version
./source/scripts/upload-image-to-github.py --bot --token ${{ secrets.TOKEN }} --files .codecov/{all,tests,samples}.png --output-dir .codecov --name pr-${{ github.event.pull_request.number }}
echo -e "\n${PWD}:"
ls -la .
echo -e "\n.codecov:"
ls -la .codecov
get-base-md-contents() { cat .codecov/${1}.png.md; }
get-full-md-contents() { cat .codecov/${1}.png.md .codecov/${1}.md; }
cat << EOF > .codecov/report.md
# Code Coverage Report
## Tests Only
$(get-base-md-contents tests)
## Samples Only
$(get-base-md-contents samples)
## Tests + Samples
$(get-full-md-contents all)
<!-- code-coverage-comment-identifier -->
EOF
echo 'CODECOVERAGE_REPORT<<EOF' > $GITHUB_OUTPUT
cat .codecov/report.md >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Write Code Coverage Comment
if: github.event_name == 'pull_request'
timeout-minutes: 5
uses: actions/github-script@v6
env:
COMMENT_BODY: ${{ steps.generatereport.outputs.CODECOVERAGE_REPORT }}
with:
github-token: ${{ secrets.TOKEN }}
script: |
const commentIdentifier = '<!-- code-coverage-comment-identifier -->'; // Used to identify codecov comment
const commentBody = process.env.COMMENT_BODY;
// Fetch existing comments
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
});
// Check for an existing comment
const existingComment = comments.find(comment => comment.body.includes(commentIdentifier));
if (existingComment) {
// Update the existing comment
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
body: commentBody,
});
core.info(`Updated comment with ID: ${existingComment.id}`);
} else {
// Create a new comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: commentBody,
});
core.info('Created a new comment.');
}
- name: Archive Code Coverage Data
uses: actions/upload-artifact@v4
with:
name: code-coverage-details
path: |
${{github.workspace}}/.codecov/*
- name: Verify Test Labels
timeout-minutes: 5
shell: bash
run: |
pushd build
#
# if following fails, there is a test that does not have
# a label identifying it as sample or test (unit or integration).
# Recommended labels are:
# - samples
# - unittests
# - integration-tests
#
ctest -N -LE 'samples|tests' -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" -O ctest.mislabeled.log
grep 'Total Tests: 0' ctest.mislabeled.log
#
# if following fails, then there is overlap between the labels.
# A test cannot both be a sample and (unit/integration) test.
#
ctest -N -O ctest.all.log
ctest -N -O ctest.samples.log -L samples
ctest -N -O ctest.tests.log -L tests
NUM_ALL=$(grep 'Total Tests:' ctest.all.log | awk '{print $NF}')
NUM_SAMPLE=$(grep 'Total Tests:' ctest.samples.log | awk '{print $NF}')
NUM_TEST=$(grep 'Total Tests:' ctest.tests.log | awk '{print $NF}')
NUM_SUM=$((${NUM_SAMPLE} + ${NUM_TEST}))
echo "Total tests: ${NUM_ALL}"
echo "Total labeled tests: ${NUM_SUM}"
if [ ${NUM_ALL} != ${NUM_SUM} ]; then
echo "Test label overlap"
exit 1
fi
popd
sanitizers:
strategy:
fail-fast: false
matrix:
runner: ['vega20', 'navi3', 'mi300']
sanitizer: ['AddressSanitizer', 'ThreadSanitizer', 'LeakSanitizer', 'UndefinedBehaviorSanitizer']
os: ['ubuntu-22.04']
build-type: ['RelWithDebInfo']
exclude:
- { runner: 'vega20', sanitizer: 'ThreadSanitizer' }
- { runner: 'vega20', sanitizer: 'AddressSanitizer' }
- { runner: 'vega20', sanitizer: 'UndefinedBehaviorSanitizer' }
- { runner: 'mi300', sanitizer: 'AddressSanitizer' }
- { runner: 'mi300', sanitizer: 'LeakSanitizer' }
- { runner: 'navi3', sanitizer: 'LeakSanitizer' }
- { runner: 'navi3', sanitizer: 'ThreadSanitizer' }
- { runner: 'navi3', sanitizer: 'UndefinedBehaviorSanitizer' }
if: ${{ contains(github.event_name, 'pull_request') }}
runs-on: ${{ matrix.runner }}-emu-runner-set
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
GCC_COMPILER_VERSION: 13
steps:
- uses: actions/checkout@v4
- name: Install requirements
timeout-minutes: 10
shell: bash
run: |
git config --global --add safe.directory '*'
apt-get update
apt-get install -y build-essential cmake python3-pip libasan8 libtsan2 software-properties-common
add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update
apt-get install -y gcc-${{ env.GCC_COMPILER_VERSION }} g++-${{ env.GCC_COMPILER_VERSION }} libdw-dev
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_COMPILER_VERSION }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ env.GCC_COMPILER_VERSION }} --slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_COMPILER_VERSION }}
python3 -m pip install -r requirements.txt
- name: List Files
shell: bash
run: |
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
cat /opt/rocm/.info/version
ls -la
- name: Enable PC Sampling
if: ${{ contains(matrix.runner, 'mi200') || contains(matrix.runner, 'mi300a') }}
shell: bash
run: |
echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV
- name: Configure, Build, and Test
timeout-minutes: 45
shell: bash
run:
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-${{ matrix.sanitizer }}
--build-jobs 16
--site ${RUNNER_HOSTNAME}
--gpu-targets ${{ env.GPU_TARGETS }}
--memcheck ${{ matrix.sanitizer }}
--run-attempt ${{ github.run_attempt }}
--
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DCMAKE_INSTALL_PREFIX="${{ env.ROCM_PATH }}"
-DPython3_EXECUTABLE=$(which python3)
--
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"