-
Notifications
You must be signed in to change notification settings - Fork 23
220 lines (190 loc) · 7.18 KB
/
parsing-tests.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
name: Parsing Tests
on:
workflow_call:
secrets:
SSH_DEPLOY_KEY:
description: 'SSH key used to push logs'
required: true
env:
GHA_CUSTOM_LINE_PREFIX: "▌"
jobs:
parsing-tests:
strategy:
fail-fast: false
matrix:
include:
# release build #
- job_name: 'Test read_systemverilog release'
artifact_name: 'binaries-release'
build_type: 'release'
run_command: 'read_systemverilog'
- job_name: 'Test read_uhdm release'
artifact_name: 'binaries-release'
build_type: 'release'
run_command: 'read_uhdm'
# plugin build #
- job_name: 'Test read_systemverilog plugin'
artifact_name: 'binaries-plugin'
build_type: 'plugin'
run_command: 'read_systemverilog'
- job_name: 'Test read_uhdm plugin'
artifact_name: 'binaries-plugin'
build_type: 'plugin'
run_command: 'read_uhdm'
# asan build #
- job_name: 'Test read_systemverilog asan'
artifact_name: 'binaries-asan'
build_type: 'asan'
run_command: 'read_systemverilog'
- job_name: 'Test read_uhdm asan'
artifact_name: 'binaries-asan'
build_type: 'asan'
run_command: 'read_uhdm'
name: ${{ matrix.job_name }}
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
container: ubuntu:jammy
env:
GIT_HTTP_LOW_SPEED_LIMIT: 1
GIT_HTTP_LOW_SPEED_TIME: 600
DEBIAN_FRONTEND: noninteractive
GHA_MACHINE_TYPE: "n2-standard-2"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up common Ubuntu configuration
run: |
./.github/scripts/set-up-common-ubuntu-configuration.sh
./.github/scripts/set-up-common-git-configuration.sh
- name: Install dependencies
run: |
./tests/scripts/run_parsing.sh --type ${{ matrix.build_type }} install_dependencies
- name: Checkout submodules
run: |
./tests/scripts/run_parsing.sh --type ${{ matrix.build_type }} load_submodules
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact_name }}
# See https://github.com/actions/upload-artifact/issues/38
- name: Extract
run: tar -xf ${{ matrix.artifact_name }}.tar
- name: Test
run: |
./tests/scripts/run_parsing.sh --type ${{ matrix.build_type }} ${{matrix.run_command }}
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: results_parsing_tests_${{ matrix.build_type }}_${{ matrix.run_command }}
path: build/parsing/*
retention-days: 1
- name: Upload load graphs
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: plots_tests_${{ matrix.build_type }}_${{ matrix.run_command }}
path: |
**/plot_*.svg
push-logs:
name: Generate AST diff
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
container: ubuntu:jammy
if: (github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'))
needs:
- parsing-tests
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Download test results
uses: /actions/download-artifact@v4
with:
name: results_parsing_tests_release_read_systemverilog
path: logs
- name: Set up common Ubuntu configuration
run: |
./.github/scripts/set-up-common-ubuntu-configuration.sh
./.github/scripts/set-up-common-git-configuration.sh
- name: Install dependencies
run: |
apt-get update -q
apt-get install -y git
- name: Generate push branch name
run: |
branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
PUSH_BRANCH=$branch
echo "PUSH_BRANCH=$PUSH_BRANCH" >> "$GITHUB_ENV"
CURRENT_LOGS_SHA=$(git ls-remote https://github.com/${{ github.repository }}-logs main | cut -d $'\t' -f1)
COMMENT_MSG="https://github.com/${{ github.repository }}-logs/compare/$CURRENT_LOGS_SHA..$PUSH_BRANCH"
echo "COMMENT_MSG=$COMMENT_MSG" >> "$GITHUB_ENV"
echo "COMMENT_HEADER=Logs difference between main branch:" >> "$GITHUB_ENV"
- name: Push logs
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
run: |
# Do not push asan logs
rm -f logs/*/*asan*
.github/scripts/push_to_logs_repository.sh "$GITHUB_REPOSITORY_OWNER" "$PUSH_BRANCH" "$GITHUB_RUN_ID" logs tests
- name: Post comment
if: ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v6
with:
script: |
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
const newFirstLine = process.env.COMMENT_HEADER;
const newComment = newFirstLine + '\n' + process.env.COMMENT_MSG;
let commentUpdated = false;
for (const comment of comments) {
const oldFirstLine = comment.body.split('\n')[0];
if (oldFirstLine == newFirstLine) {
github.rest.issues.updateComment({
comment_id: comment.id,
owner: context.repo.owner,
repo: context.repo.repo,
body: newComment
});
commentUpdated = true;
break;
}
}
if (!commentUpdated) {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: newComment
});
}
- name: Create summary
run: |
echo "${{ env.COMMENT_HEADER }}" >> $GITHUB_STEP_SUMMARY
echo "${{ env.COMMENT_MSG }}" >> $GITHUB_STEP_SUMMARY
generate-tests-summary:
name: Summary Generation
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
container: ubuntu:jammy
if: ${{ !cancelled() }}
needs:
- parsing-tests
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up common Ubuntu configuration
run: |
./.github/scripts/set-up-common-ubuntu-configuration.sh
./.github/scripts/set-up-common-git-configuration.sh
- name: Download test results
uses: /actions/download-artifact@v4
with:
pattern: results_parsing_tests_*_*
merge-multiple: true
- name: Generate summary
run: |
./.github/scripts/generate_summary.sh release . > $GITHUB_STEP_SUMMARY
./.github/scripts/generate_summary.sh asan . >> $GITHUB_STEP_SUMMARY
./.github/scripts/generate_summary.sh plugin . >> $GITHUB_STEP_SUMMARY