-
Notifications
You must be signed in to change notification settings - Fork 2
901 lines (804 loc) · 37.2 KB
/
Copy pathgenerate-summary.yaml
File metadata and controls
901 lines (804 loc) · 37.2 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
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
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
name: Generate-Summary
# Generate a github issue summarizing the testsuite results for a given hash.
# Searches for the most recent successful build/test artifacts to use as a
# comparison baseline.
on:
workflow_call:
inputs:
gcchash:
required: true
type: string
issue_num:
required: false
type: string
issue_hash_prefix:
required: true
type: string
prefix:
required: false
type: string
gcc_branch:
required: false
type: string
binutils_branch:
required: false
type: string
workflow_dispatch:
branches:
- main
inputs:
gcchash:
description: 'GCC Hash'
required: true
issue_num:
description: 'Bisection Issue Number (Optional)'
required: false
issue_hash_prefix:
description: 'Issue title'
default: 'Testsuite Status'
prefix:
required: false
description: 'Prefix (Optional)'
type: choice
default: ""
options:
- ""
- "binutils_"
- "checking_"
- "coord_"
- "release_14_"
- "release_15_"
- "rv32_zvl_"
- "rv64_zvl_"
- "zve_"
gcc_branch:
description: 'GCC branch'
default: 'master'
type: choice
options:
- 'master'
- 'coordination'
- 'release-14'
binutils_branch:
description: 'Binutils branch'
default: 'master'
type: choice
options:
- 'master'
jobs:
check-early-exit:
if: always()
runs-on: ubuntu-24.04
environment: production
steps:
- uses: actions/checkout@v3
- name: Check name
id: check-issue-name
run: |
if [ '${{ inputs.prefix }}' != '' ] && [ '${{ inputs.issue_hash_prefix }}' == 'Testsuite Status' ];
then
echo "Stopping bad issue name generation. Use generate-summary workflow with title that won't be picked up by precommit"
echo "bad_name=true" >> $GITHUB_OUTPUT
fi
- name: Check duplicate issue
id: check-duplicate-issue
if: ${{ github.event_name == 'schedule' }}
run: |
ISSUE_NAME='${{ inputs.issue_hash_prefix }} ${{ inputs.gcchash }}'
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Token ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/patrick-rivos/gcc-postcommit-ci/issues \
-o issues.txt
FOUND_ISSUE=$(cat issues.txt | jq "map(select(.title == \"$ISSUE_NAME\"))" | tr '\n' ' ' | tr -d [:space:])
# if no issue of that name is found, jq returns '[]'
echo "found_issue=$FOUND_ISSUE" >> $GITHUB_OUTPUT
- name: Check early exit
id: early-exit
if: ${{ steps.check-issue-name.outputs.bad_name == 'true' || (steps.check-duplicate-issue.outcome != 'skipped' && steps.check-duplicate-issue.outputs.found_issue != '[]') }}
run: |
echo "early_exit=true" >> $GITHUB_OUTPUT
outputs:
early_exit: ${{ steps.early-exit.outputs.early_exit }}
compare-artifacts:
if: ${{ always() && needs.check-early-exit.outputs.early_exit != 'true' }} # ensure comparison always runs even on error
needs: [check-early-exit]
runs-on: ubuntu-24.04
environment: production
defaults:
run:
working-directory: riscv-gnu-toolchain
steps:
- uses: actions/checkout@v4
- name: Setup env
uses: ./.github/actions/common/setup-env
with:
free_up_space: false
- name: Retrieve cache
id: retrieve-cache
uses: actions/cache@v4
with:
path: |
riscv-gnu-toolchain/.git
riscv-gnu-toolchain/binutils
riscv-gnu-toolchain/dejagnu
riscv-gnu-toolchain/gcc
riscv-gnu-toolchain/gdb
riscv-gnu-toolchain/glibc
riscv-gnu-toolchain/newlib
riscv-gnu-toolchain/qemu
key: ${{ inputs.prefix }}submodules-archive-16 # Numbered archive to allow for easy transition when bumping submodules
- name: Initialize gcc
if: ${{ steps.retrieve-cache.outputs.cache-hit != 'true' }}
id: gcc-cache
uses: ./.github/actions/common/init-and-pull-gcc
with:
init: true
branch: ${{ inputs.gcc_branch }}
# Does not remove and reclone gcc if we hit cache
- name: Checkout GCC
if: ${{ steps.gcc-cache.outcome == 'skipped' }}
uses: ./.github/actions/common/init-and-pull-gcc
with:
init: false
branch: ${{ inputs.gcc_branch }}
- name: Initialize binutils
if: ${{ inputs.prefix == 'binutils_' && steps.retrieve-cache.outputs.cache-hit != 'true' }}
working-directory: ./riscv-gnu-toolchain
run: |
rm -rf binutils
# Use the mirror since github tends to be pretty reliable for cloning.
git clone https://github.com/bminor/binutils-gdb.git binutils
cd binutils
git checkout ${{ inputs.binutils_branch }}
git pull
- name: Checkout binutils
if: ${{ inputs.prefix == 'binutils_' && steps.gcc-cache.outcome == 'skipped' }}
working-directory: ./riscv-gnu-toolchain
run: |
cd binutils
git checkout ${{ inputs.binutils_branch }}
git pull
- name: Create directories
run: |
mkdir current_logs
mkdir previous_logs
mkdir temp
mkdir summaries
- name: Bump pyopenssl and crypto
run: |
sudo apt remove python3-pip
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
pip install -U pyopenssl cryptography
# Download all workload artifacts
- name: Print API usage info
run: |
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/rate_limit
- name: Download All targets
uses: ./.github/actions/download-all-comparison-artifacts
if: ${{ inputs.prefix == '' || inputs.prefix == 'coord_' || inputs.prefix == 'release_14_' || inputs.prefix == 'release_15_' }}
with:
gcchash: ${{ inputs.gcchash }}
token: ${{ secrets.GITHUB_TOKEN }}
prefix: ${{ inputs.prefix }}
- name: Download All targets
uses: ./.github/actions/download-all-weekly-artifacts
if: ${{ inputs.prefix != '' && inputs.prefix != 'coord_' && inputs.prefix != 'release_14_' || inputs.prefix == 'release_15_' }}
with:
gcchash: ${{ inputs.gcchash }}
token: ${{ secrets.GITHUB_TOKEN }}
prefix: ${{ inputs.prefix }}
- name: Print API usage info
run: |
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/rate_limit
- name: Extract artifacts
run: |
ls ./temp/
mkdir -p current_logs
unzip ./temp/*report.log.zip -d ./current_logs || true
ls current_logs
- name: Build Log Comparison Setup
id: build-log-setup
run: |
mkdir -p previous_build_logs
echo "previous_build_logs_path=$(readlink -f previous_build_logs)" >> $GITHUB_OUTPUT
mkdir -p previous_build_log_zips
echo "previous_build_log_zips_path=$(readlink -f previous_build_log_zips)" >> $GITHUB_OUTPUT
mkdir -p current_build_logs
echo "current_build_logs_path=$(readlink -f current_build_logs)" >> $GITHUB_OUTPUT
mkdir -p current_build_log_zips
echo "current_build_log_zips_path=$(readlink -f current_build_log_zips)" >> $GITHUB_OUTPUT
mkdir build_warnings
echo "build_warnings_directory=$(readlink -f ./build_warnings/)" >> $GITHUB_OUTPUT
echo "new_build_warnings_path=$(readlink -f ./build_warnings/new_build_warnings.md)" >> $GITHUB_OUTPUT
echo "resolved_build_warnings_path=$(readlink -f ./build_warnings/resolved_build_warnings.md)" >> $GITHUB_OUTPUT
- name: Download artifacts
run: |
pip install pygithub requests
python ./scripts/download_artifacts.py -hash ${{ inputs.gcchash }} -repo patrick-rivos/gcc-postcommit-ci -token ${{ secrets.GITHUB_TOKEN }} -prefix "${{ inputs.prefix }}" -build-logs -build-logs-dir ${{ steps.build-log-setup.outputs.previous_build_log_zips_path }}
ls previous_logs
if [ -d "${{ steps.build-log-setup.outputs.previous_build_log_zips_path }}" ]; then
ls ${{ steps.build-log-setup.outputs.previous_build_log_zips_path }}
fi
- name: Unzip previous build log artifacts
uses: ./.github/actions/common/unzip-all-zips
with:
input-dir: ${{ steps.build-log-setup.outputs.previous_build_log_zips_path }}
output-dir: ${{ steps.build-log-setup.outputs.previous_build_logs_path }}
include-pattern: "*-stderr.log"
- name: Download current build log artifacts
uses: ./.github/actions/download-all-build-log-artifacts
with:
gcchash: ${{ inputs.gcchash }}
github-token: ${{ secrets.GITHUB_TOKEN }}
prefix: ${{ inputs.prefix }}
output-dir: ${{ steps.build-log-setup.outputs.current_build_log_zips_path }}
- name: Unzip current build log artifacts
uses: ./.github/actions/common/unzip-all-zips
with:
input-dir: ${{ steps.build-log-setup.outputs.current_build_log_zips_path }}
output-dir: ${{ steps.build-log-setup.outputs.current_build_logs_path }}
include-pattern: "*-stderr.log"
- name: Parse Build Warnings
run: |
python ./scripts/parse_build_warnings.py --old-dir ${{ steps.build-log-setup.outputs.previous_build_logs_path }}/build --new-dir ${{ steps.build-log-setup.outputs.current_build_logs_path }}/build --new-warnings-output ${{ steps.build-log-setup.outputs.new_build_warnings_path }} --resolved-warnings-output ${{ steps.build-log-setup.outputs.resolved_build_warnings_path }} --repo post-commit
if [ -f "${{ steps.build-log-setup.outputs.new_build_warnings_path }}" ]; then
cat ${{ steps.build-log-setup.outputs.new_build_warnings_path }}
else
echo "New build logs didn't exist"
fi
if [ -f "${{ steps.build-log-setup.outputs.resolved_build_warnings_path }}" ]; then
cat ${{ steps.build-log-setup.outputs.resolved_build_warnings_path }}
else
echo "Resolved build logs didn't exist"
fi
continue-on-error: true
- name: Upload Build Warnings
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.prefix }}${{ inputs.gcchash }}-build-warnings
path: ${{ steps.build-log-setup.outputs.build_warnings_directory }}
retention-days: 90
continue-on-error: true
- name: Compare artifacts
run: |
python ./scripts/compare_all_artifacts.py -hash ${{ inputs.gcchash }} --current-hash-committed --prefix "${{ inputs.prefix }}"
- name: Make artifact zips
run: |
zip -r summaries.zip summaries
zip -r current_logs.zip current_logs
zip -r previous_logs.zip previous_logs
- name: Upload compare summaries
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.prefix }}${{ inputs.gcchash }}-summaries
path: |
riscv-gnu-toolchain/summaries.zip
retention-days: 90
- name: Upload current log failures
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.prefix }}${{ inputs.gcchash }}-current-logs
path: |
riscv-gnu-toolchain/current_logs.zip
retention-days: 90
- name: Upload previous log failures
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.prefix }}${{ inputs.gcchash }}-previous-logs
path: |
riscv-gnu-toolchain/previous_logs.zip
retention-days: 90
generate-issues:
if: ${{ always() && needs.check-early-exit.outputs.early_exit != 'true' }} # ensure generate issues always runs even on error
needs: [check-early-exit, compare-artifacts]
runs-on: ubuntu-24.04
permissions:
issues: write
defaults:
run:
working-directory: riscv-gnu-toolchain
steps:
- uses: actions/checkout@v4
- name: Setup env
uses: ./.github/actions/common/setup-env
with:
free_up_space: false
- name: Download summaries artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.prefix }}${{ inputs.gcchash }}-summaries
path: ./riscv-gnu-toolchain
- name: Download current logs artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.prefix }}${{ inputs.gcchash }}-current-logs
path: ./riscv-gnu-toolchain
- name: Download previous logs artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.prefix }}${{ inputs.gcchash }}-previous-logs
path: ./riscv-gnu-toolchain
- name: Download build warning artifact
uses: actions/download-artifact@v4
id: download-build-warning-artifact
with:
name: ${{ inputs.prefix }}${{ inputs.gcchash }}-build-warnings
path: ./riscv-gnu-toolchain
continue-on-error: true
- name: Print API usage info
run: |
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/rate_limit
- name: Aggregate information
run: |
unzip summaries.zip
unzip current_logs.zip
unzip previous_logs.zip
python ./scripts/aggregate.py \
-chash ${{ inputs.gcchash }} \
-o temp_issue.md \
-title "${{ inputs.issue_hash_prefix }}"
cat temp_issue.md
tail -n+5 temp_issue.md > issue.md
cat issue.md
- name: Get labels
id: issue-labels
run: |
ISSUE_LABELS=$(cat labels.txt)
echo "issue_labels=$ISSUE_LABELS" >> $GITHUB_OUTPUT
IFS=',' read -r -a labels <<< $ISSUE_LABELS
for label in "${labels[@]}"
do
if [[ "$label" == "build-failure" ]] || [[ "$label" == "testsuite-failure" ]];
then
echo "valid_baseline=false" >> $GITHUB_OUTPUT
break
fi
done
- name: Label aggregation preset
id: label-aggregation-preset
run: |
mkdir aggregated_labels
LABEL_FILE=$(readlink -f ./aggregated_labels/aggregated_labels.md)
> "$LABEL_FILE"
echo "label_file=$LABEL_FILE" >> $GITHUB_OUTPUT
- name: Print API usage info
run: |
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/rate_limit
- name: Trim issue length # reduce the number of lines in final issue so github always creates issue
run: |
head -c 65000 issue.md > trimmed_issue.md
if [ $(stat -c%s issue.md) -gt 65000 ]; then
printf "\n\`\`\`\nIssue text has been trimmed. Please check the following Gist Link for the untrimmed issue.\n" >> trimmed_issue.md
FILE_SIZE=$(stat -c%s "issue.md")
ONE_MB_IN_BYTES=1048000
if [ "$FILE_SIZE" -gt "$ONE_MB_IN_BYTES" ]; then
printf "\nThe file was greater than 1 MB and has been trimmed to fit the Gist limit. Please check logs for the untrimmed issue." > trimmed_issue_gist.md
fi
head -c $ONE_MB_IN_BYTES "issue.md" >> trimmed_issue_gist.md
if [ "$FILE_SIZE" -gt "$ONE_MB_IN_BYTES" ]; then
printf "\nThe file was greater than 1 MB and has been trimmed to fit the Gist limit. Please check logs for the untrimmed issue." >> trimmed_issue_gist.md
fi
fi
run_id=${{ github.run_id }} && echo "Associated run is: https://github.com/patrick-rivos/gcc-postcommit-ci/actions/runs/$run_id" >> trimmed_issue.md
cat trimmed_issue.md
- name: Create Issue Gist
run: |
if [ -e "trimmed_issue_gist.md" ]; then
python3 -m pip install pygithub requests pyopenssl --upgrade
python3 ./scripts/create_gist.py --token ${{ secrets.GIST_TOKEN }} --input trimmed_issue_gist.md --output issue_gist_url.txt --title "${{ inputs.issue_hash_prefix }}_${{ inputs.gcchash }}_issue.md"
printf "\nGist URL: $(cat issue_gist_url.txt)" >> trimmed_issue.md
fi
continue-on-error: true
- name: Create or update summary issue
uses: peter-evans/create-issue-from-file@v5
id: create-issue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
content-filepath: riscv-gnu-toolchain/trimmed_issue.md
title: '${{ inputs.issue_hash_prefix }} ${{ inputs.gcchash }}'
labels: ${{ steps.issue-labels.outputs.issue_labels }}
- name: Trim comment length # reduce the number of lines in final comment so github always create comment
run: |
printf "## Important unresolved errors\n" > trimmed_comment.md
printf 'A list of all unresolved "internal compiler error", "Segmentation fault", "test for excess errors" failures present at this hash\n\n' >> trimmed_comment.md
printf -- '---\n\n' >> trimmed_comment.md
head -c 65000 unresolved_important_failures.md >> trimmed_comment.md
if [ $(stat -c%s unresolved_important_failures.md) -gt 65000 ]; then
printf "\nComment text has been trimmed. Check the following Gist URL for full list.\n" >> trimmed_comment.md
FILE_SIZE=$(stat -c%s "unresolved_important_failures.md")
ONE_MB_IN_BYTES=1048000
if [ "$FILE_SIZE" -gt "$ONE_MB_IN_BYTES" ]; then
printf "\nThe file was greater than 1 MB and has been trimmed to fit the gist limit. Please check logs for the untrimmed issue." > trimmed_unresolved_errors_gist.md
fi
head -c $ONE_MB_IN_BYTES "unresolved_important_failures.md" >> trimmed_unresolved_errors_gist.md
if [ "$FILE_SIZE" -gt "$ONE_MB_IN_BYTES" ]; then
printf "\nThe file was greater than 1 MB and has been trimmed to fit the gist limit. Please check logs for the untrimmed issue." >> trimmed_unresolved_errors_gist.md
fi
fi
cat trimmed_comment.md
- name: Create Unresolved Errors Comment Gist
run: |
if [ -e "trimmed_unresolved_errors_gist.md" ]; then
python3 -m pip install pygithub requests pyopenssl --upgrade
python3 ./scripts/create_gist.py --token ${{ secrets.GIST_TOKEN }} --input trimmed_unresolved_errors_gist.md --output unresolved_import_failures_gist_url.txt --title "${{ steps.create-issue.outputs.issue-number }}_${{ inputs.issue_hash_prefix }}_${{ inputs.gcchash }}_unresolved_errors.md"
printf "\nGist URL: $(cat unresolved_import_failures_gist_url.txt)" >> trimmed_comment.md
fi
continue-on-error: true
- name: Create unresolved regressions comment
uses: peter-evans/create-or-update-comment@v4
id: unresolved-comment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
issue-number: ${{ steps.create-issue.outputs.issue-number }}
body-path: riscv-gnu-toolchain/trimmed_comment.md
- name: Trim new build warnings # reduce the number of lines in final comment so github always create comment
if: ${{ steps.download-build-warning-artifact.outcome == 'success' }}
run: |
head -c 65000 new_build_warnings.md >> trimmed_new_build_warnings.md
if [ $(stat -c%s new_build_warnings.md) -gt 65000 ]; then
printf "\nBuild warnings comment has been trimmed. Check the following Gist URL for full list.\n" >> trimmed_new_build_warnings.md
FILE_SIZE=$(stat -c%s "new_build_warnings.md")
ONE_MB_IN_BYTES=1048000
if [ "$FILE_SIZE" -gt "$ONE_MB_IN_BYTES" ]; then
printf "\nThe file was greater than 1 MB and has been trimmed to fit the gist limit. Please check logs for the untrimmed issue." > trimmed_new_build_warnings_gist.md
fi
head -c $ONE_MB_IN_BYTES "new_build_warnings.md" >> trimmed_new_build_warnings_gist.md
if [ "$FILE_SIZE" -gt "$ONE_MB_IN_BYTES" ]; then
printf "\nThe file was greater than 1 MB and has been trimmed to fit the gist limit. Please check logs for the untrimmed issue." >> trimmed_new_build_warnings_gist.md
fi
fi
cat trimmed_new_build_warnings.md
- name: Trim resolved build warnings # reduce the number of lines in final comment so github always create comment
if: ${{ steps.download-build-warning-artifact.outcome == 'success' }}
run: |
head -c 65000 resolved_build_warnings.md >> trimmed_resolved_build_warnings.md
if [ $(stat -c%s resolved_build_warnings.md) -gt 65000 ]; then
printf "\nBuild warnings comment has been trimmed. Check the following Gist URL for full list.\n" >> trimmed_resolved_build_warnings.md
FILE_SIZE=$(stat -c%s "resolved_build_warnings.md")
ONE_MB_IN_BYTES=1048000
if [ "$FILE_SIZE" -gt "$ONE_MB_IN_BYTES" ]; then
printf "\nThe file was greater than 1 MB and has been trimmed to fit the gist limit. Please check logs for the untrimmed issue." > trimmed_resolved_build_warnings_gist.md
fi
head -c $ONE_MB_IN_BYTES "resolved_build_warnings.md" >> trimmed_resolved_build_warnings_gist.md
if [ "$FILE_SIZE" -gt "$ONE_MB_IN_BYTES" ]; then
printf "\nThe file was greater than 1 MB and has been trimmed to fit the gist limit. Please check logs for the untrimmed issue." >> trimmed_resolved_build_warnings_gist.md
fi
fi
cat trimmed_resolved_build_warnings.md
- name: Build warnings label check
id: build-warnings-label-check
if: ${{ steps.download-build-warning-artifact.outcome == 'success' }}
run: |
if [[ $(head -c 32 new_build_warnings.md) == "New build warnings doesn't exist" && \
$(head -c 37 resolved_build_warnings.md) == "Resolved build warnings doesn't exist" ]]; then
echo "build_warning_label=false" >> $GITHUB_OUTPUT
else
echo "build_warning_label=true" >> $GITHUB_OUTPUT
fi
- name: Add Build warnings Label to New Issue
if: ${{ steps.download-build-warning-artifact.outcome == 'success' && steps.build-warnings-label-check.outputs.build_warning_label == 'true' }}
uses: ./.github/actions/common/save-label
with:
label: "'build-warnings'"
output: ${{ steps.label-aggregation-preset.outputs.label_file }}
- name: Create New Build Warnings Gist
run: |
if [ -e "trimmed_new_build_warnings_gist.md" ]; then
python3 -m pip install pygithub requests pyopenssl --upgrade
python3 ./scripts/create_gist.py --token ${{ secrets.GIST_TOKEN }} --input trimmed_new_build_warnings_gist.md --output new_build_warning_gist_url.txt --title "${{ steps.create-issue.outputs.issue-number }}_${{ inputs.issue_hash_prefix }}_${{ inputs.gcchash }}_new_build_warnings.md"
printf "Gist URL: $(cat new_build_warning_gist_url.txt)" >> trimmed_new_build_warnings.md
fi
continue-on-error: true
- name: Create new build warnings comment
uses: peter-evans/create-or-update-comment@v4
if: ${{ steps.download-build-warning-artifact.outcome == 'success' }}
with:
issue-number: ${{ steps.create-issue.outputs.issue-number }}
body-path: riscv-gnu-toolchain/trimmed_new_build_warnings.md
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create Resolved Build Warnings Gist
run: |
if [ -e "trimmed_resolved_build_warnings_gist.md" ]; then
python3 -m pip install pygithub requests pyopenssl --upgrade
python3 ./scripts/create_gist.py --token ${{ secrets.GIST_TOKEN }} --input trimmed_resolved_build_warnings_gist.md --output resolved_build_warning_gist_url.txt --title "${{ steps.create-issue.outputs.issue-number }}_${{ inputs.issue_hash_prefix }}_${{ inputs.gcchash }}_resolved_build_warnings.md"
printf "Gist URL: $(cat resolved_build_warning_gist_url.txt)" >> trimmed_resolved_build_warnings.md
fi
continue-on-error: true
- name: Create resolved build warnings comment
uses: peter-evans/create-or-update-comment@v4
if: ${{ steps.download-build-warning-artifact.outcome == 'success' }}
with:
issue-number: ${{ steps.create-issue.outputs.issue-number }}
body-path: riscv-gnu-toolchain/trimmed_resolved_build_warnings.md
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get prefix label name
if: ${{ inputs.prefix != '' }}
id: prefix-label
run: |
LABEL=$(echo ${{ inputs.prefix }} | cut -d '_' -f 1)
echo "label=$LABEL" >> $GITHUB_OUTPUT
- name: Add Prefix Label to New Issue
if: ${{ inputs.prefix != '' }}
uses: ./.github/actions/common/save-label
with:
label: "'${{ steps.prefix-label.outputs.label }}'"
output: ${{ steps.label-aggregation-preset.outputs.label_file }}
- name: Add Staging Label to New Issue
if: ${{ github.workflow == 'Staging' }}
uses: ./.github/actions/common/save-label
with:
label: "'staging'"
output: ${{ steps.label-aggregation-preset.outputs.label_file }}
# Adds comment which links issue to PR
- name: Link Staging PR
uses: actions/github-script@v6
if: ${{ github.workflow == 'Staging' && github.event.pull_request }}
with:
script: |
github.rest.issues.createComment({
issue_number: ${{ steps.create-issue.outputs.issue-number }},
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Pull request: ${{ github.event.pull_request.html_url }}'
})
# These three conditions should be equivalent, however, add them just in case
# we change something accidentally which breaks it
- name: Add Valid-Baseline Label to New Issue
if: ${{ github.workflow == 'Run-Frequent' && inputs.prefix == '' && inputs.issue_hash_prefix == 'Testsuite Status' && steps.issue-labels.outputs.valid_baseline != 'false' }}
uses: ./.github/actions/common/save-label
with:
label: "'valid-baseline'"
output: ${{ steps.label-aggregation-preset.outputs.label_file }}
# Execute this step even if there was a previous failure. Labels must always be uploaded to the issue
- name: Labels upload setup
id: labels-upload-setup
if: ${{ !cancelled() }}
run: |
if [[ -e "${{ steps.label-aggregation-preset.outputs.label_file }}" && -s "${{ steps.label-aggregation-preset.outputs.label_file }}" ]]; then
echo "labels_created=true" >> "$GITHUB_OUTPUT"
echo "aggregated_labels=$(cat ${{ steps.label-aggregation-preset.outputs.label_file }})" >> "$GITHUB_OUTPUT"
else
echo "labels_created=false" >> "$GITHUB_OUTPUT"
fi
- name: Add all the labels to New Issue
uses: actions/github-script@v6
if: ${{ !cancelled() && steps.labels-upload-setup.outputs.labels_created == 'true' }}
with:
script: |
github.rest.issues.addLabels({
issue_number: ${{ steps.create-issue.outputs.issue-number }},
owner: context.repo.owner,
repo: context.repo.repo,
labels: [${{ steps.labels-upload-setup.outputs.aggregated_labels }}]
})
outputs:
new_issue_num: ${{ steps.create-issue.outputs.issue-number }}
regenerate-issues:
runs-on: ubuntu-24.04
permissions:
issues: write
defaults:
run:
working-directory: riscv-gnu-toolchain
needs: [generate-issues, compare-artifacts, check-early-exit]
if: ${{ inputs.issue_num != '' && needs.check-early-exit.outputs.early_exit != 'true' }} # Only run if has bisection hash
steps:
- name: Add Bisect Label to New Issue
uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({
issue_number: ${{ needs.generate-issues.outputs.new_issue_num }},
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['bisect']
})
- name: Link New Issue to Bisection Issue
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: ${{ needs.generate-issues.outputs.new_issue_num }},
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Bisection of #${{ inputs.issue_num }}'
})
- name: Link to Bisection Issue to New Issue
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: ${{ inputs.issue_num }},
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Bisecting with #${{ needs.generate-issues.outputs.new_issue_num }}'
})
- uses: actions/checkout@v4
- name: Setup env
uses: ./.github/actions/common/setup-env
with:
free_up_space: false
- name: Bump pyopenssl and crypto
run: |
sudo apt remove python3-pip
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
pip install -U pyopenssl cryptography
- name: Retrieve cache
id: retrieve-cache
uses: actions/cache@v4
with:
path: |
riscv-gnu-toolchain/.git
riscv-gnu-toolchain/binutils
riscv-gnu-toolchain/dejagnu
riscv-gnu-toolchain/gcc
riscv-gnu-toolchain/gdb
riscv-gnu-toolchain/glibc
riscv-gnu-toolchain/newlib
riscv-gnu-toolchain/qemu
key: ${{ inputs.prefix }}submodules-archive-16 # Numbered archive to allow for easy transition when bumping submodules
- name: Initialize gcc
if: ${{ steps.retrieve-cache.outputs.cache-hit != 'true' }}
id: gcc-cache
uses: ./.github/actions/common/init-and-pull-gcc
with:
init: true
branch: ${{ inputs.gcc_branch }}
# Does not remove and reclone gcc if we hit cache
- name: Checkout GCC
if: ${{ steps.gcc-cache.outcome == 'skipped' }}
uses: ./.github/actions/common/init-and-pull-gcc
with:
init: false
branch: ${{ inputs.gcc_branch }}
- name: Initialize binutils
if: ${{ inputs.prefix == 'binutils_' && steps.retrieve-cache.outputs.cache-hit != 'true' }}
working-directory: ./riscv-gnu-toolchain
run: |
rm -rf binutils
# Use the mirror since github tends to be pretty reliable for cloning.
git clone https://github.com/bminor/binutils-gdb.git binutils
cd binutils
git checkout ${{ inputs.binutils_branch }}
git pull
- name: Checkout binutils
if: ${{ inputs.prefix == 'binutils_' && steps.gcc-cache.outcome == 'skipped' }}
working-directory: ./riscv-gnu-toolchain
run: |
cd binutils
git checkout ${{ inputs.binutils_branch }}
git pull
- name: Initialize Bisection Hash
id: bisection-hash
run: |
sudo apt remove python3-pip
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
pip install pygithub requests
export ORIG_GCCHASH=$(python ./scripts/scrape_issue_info.py -num ${{ inputs.issue_num }} -token ${{ secrets.GITHUB_TOKEN }})
echo $ORIG_GCCHASH
echo "orig_gcchash=$ORIG_GCCHASH" >> "$GITHUB_OUTPUT"
- name: Create directories
run: |
mkdir -p current_logs
mkdir -p previous_logs
mkdir -p temp
mkdir summaries
# Download all workload artifacts
- name: Print API usage info
run: |
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/rate_limit
- name: Download All targets
uses: ./.github/actions/download-all-comparison-artifacts
if: ${{ inputs.prefix == '' || inputs.prefix == 'coord_' || inputs.prefix == 'release_14_' || inputs.prefix == 'release_15_' }}
with:
gcchash: ${{ steps.bisection-hash.outputs.orig_gcchash }}
token: ${{ secrets.GITHUB_TOKEN }}
prefix: ${{ inputs.prefix }}
- name: Download All targets
uses: ./.github/actions/download-all-weekly-artifacts
if: ${{ inputs.prefix != '' && inputs.prefix != 'coord_' && inputs.prefix != 'release_14_' || inputs.prefix == 'release_15_' }}
with:
gcchash: ${{ steps.bisection-hash.outputs.orig_gcchash }}
token: ${{ secrets.GITHUB_TOKEN }}
prefix: ${{ inputs.prefix }}
- name: Print API usage info
run: |
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/rate_limit
- name: Extract artifacts
run: |
ls ./temp/
mkdir -p current_logs
unzip ./temp/*report.log.zip -d ./current_logs || true
ls current_logs
- name: Download artifacts
run: |
pip install pygithub requests
python ./scripts/download_artifacts.py -hash ${{ steps.bisection-hash.outputs.orig_gcchash }} -repo patrick-rivos/gcc-postcommit-ci -token ${{ secrets.GITHUB_TOKEN }} -prefix "${{ inputs.prefix }}"
ls previous_logs
- name: Compare artifacts
run: |
python ./scripts/compare_all_artifacts.py -hash ${{ steps.bisection-hash.outputs.orig_gcchash }} --current-hash-committed --prefix "${{ inputs.prefix }}"
- name: Make artifact zips
run: |
zip -r summaries.zip summaries
zip -r current_logs.zip current_logs
zip -r previous_logs.zip previous_logs
- name: Upload compare summaries
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.prefix }}${{ steps.bisection-hash.outputs.orig_gcchash }}-regenerated-summaries
path: |
riscv-gnu-toolchain/summaries.zip
retention-days: 90
- name: Upload current log failures
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.prefix }}${{ steps.bisection-hash.outputs.orig_gcchash }}-regenerated-current-logs
path: |
riscv-gnu-toolchain/current_logs.zip
retention-days: 90
- name: Upload previous log failures
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.prefix }}${{ steps.bisection-hash.outputs.orig_gcchash }}-regenerated-previous-logs
path: |
riscv-gnu-toolchain/previous_logs.zip
retention-days: 90
- name: Aggregate information
run: |
python ./scripts/aggregate.py \
-chash ${{ inputs.gcchash }} \
-o issue.md \
-title "${{ inputs.issue_hash_prefix }}"
cat issue.md
- name: Print API usage info
run: |
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/rate_limit
- name: Trim issue length # reduce the number of lines in final issue so github always creates issue
run: |
head -c 65000 issue.md > trimmed_issue.md
if [ $(cat trimmed_issue.md | wc -l) -ne $(cat issue.md | wc -l) ]; then printf "\n\`\`\`\nIssue text has been trimmed. Please check logs for the untrimmed issue.\n" >> trimmed_issue.md; fi
run_id=${{ github.run_id }} && echo "Associated run is: https://github.com/patrick-rivos/gcc-postcommit-ci/actions/runs/$run_id" >> trimmed_issue.md
cat trimmed_issue.md
# Leave this for now since peter-evans doesn't have a good way
# of updating the original issue comment since all the create
# an issue outputs is the issue number and not the issue comment
# id https://github.com/peter-evans/create-issue-from-file?tab=readme-ov-file#outputs.
# Therefore will need toquery for issue comment id and then use that
# with peter-evans/create-or-update-comment.
- name: Create or update summary issue
uses: JasonEtco/create-an-issue@v2
id: create-issue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: riscv-gnu-toolchain/trimmed_issue.md
update_existing: true