-
-
Notifications
You must be signed in to change notification settings - Fork 314
227 lines (222 loc) · 8.5 KB
/
runAqa.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
name: "PR Comment Build Action for aqa-tests"
on:
issue_comment:
types: [created]
permissions:
contents: write
issues: write
jobs:
parseComment:
runs-on: ubuntu-latest
if: startsWith(github.event.comment.body, 'run aqa') && github.event.issue.pull_request
outputs:
workflow_url: ${{ steps.workflow_run_info.outputs.url }}
workflow_id: ${{ steps.workflow_run_info.outputs.id }}
build_parameters: ${{ steps.argparse.outputs.build_parameters }}
failed: ${{ steps.failure_report.outputs.failed }} # For reportStatus to check if parseComment has already reported a failure (in parsing).
steps:
- name: Get workflow run info
run: |
echo ::set-output name=url::$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
echo ::set-output name=id::$GITHUB_RUN_ID
id: workflow_run_info
# Checkout current repo to access the repo-specific config file `.github/workflows/runAqaConfig.json`
- name: Checkout current repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: 'main'
# Checkout the main TKG repo to access the shared script `scripts/testRepo/runAqaArgParse.py`
- name: Checkout main TKG repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: 'adoptium/TKG.git'
ref: 'master'
path: 'TKG'
- name: Parse parameters
env:
args: ${{ github.event.comment.body }}
run: python3 TKG/scripts/testBot/runAqaArgParse.py $args 2> log.txt
id: argparse
- name: Output log
if: failure()
# Store the contents of log.txt into an environment variable and escape characters to preserve newlines and other symbols.
run: |
log=$(cat log.txt)
log="${log//'%'/'%25'}"
log="${log//$'\n'/'%0A'}"
log="${log//$'\r'/'%0D'}"
log="${log/$'`'/'\`'}"
echo ::set-output name=log::$log
id: output_log
- name: Create error comment
if: failure()
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }}
\`\`\`
${{ steps.output_log.outputs.log }}
\`\`\`
No builds were started.
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})
- name: Failure report
if: failure()
run: echo ::set-output name=failed::true
id: failure_report
- name: Create success comment
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }} Build(s) started with the following parameters:
- sdk_resource: ${{ steps.argparse.outputs.sdk_resource }}
- customized_sdk_url: ${{ steps.argparse.outputs.customized_sdk_url }}
- archive_extension: ${{ steps.argparse.outputs.archive_extension }}
- build_list: ${{ steps.argparse.outputs.build_list }}
- target: ${{ steps.argparse.outputs.target }}
- platform: ${{ steps.argparse.outputs.platform }}
- jdk_version: ${{ steps.argparse.outputs.jdk_version }}
- jdk_impl: ${{ steps.argparse.outputs.jdk_impl }}
- tkg_repo: ${{ steps.argparse.outputs.tkg_repo }}
Workflow Run ID: [${{ steps.workflow_run_info.outputs.id }}](${{ steps.workflow_run_info.outputs.url }})
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})
- name: Echo parameters
run: |
echo build_parameters: ${{ steps.argparse.outputs.build_parameters }}
echo sdk_resource: ${{ steps.argparse.outputs.sdk_resource }}
echo customized_sdk_url: ${{ steps.argparse.outputs.customized_sdk_url }}
echo archive_extension: ${{ steps.argparse.outputs.archive_extension }}
echo build_list: ${{ steps.argparse.outputs.build_list }}
echo target: ${{ steps.argparse.outputs.target }}
echo platform: ${{ steps.argparse.outputs.platform }}
echo jdk_version: ${{ steps.argparse.outputs.jdk_version }}
echo jdk_impl: ${{ steps.argparse.outputs.jdk_impl }}
echo tkg_repo: ${{ steps.argparse.outputs.tkg_repo }}
runBuild:
runs-on: ${{ matrix.platform }}
needs: parseComment
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.parseComment.outputs.build_parameters) }}
steps:
- uses: AdoptOpenJDK/install-jdk@v1
if: matrix.sdk_resource != 'customized'
with:
version: ${{ matrix.jdk_version }}
source: ${{ matrix.sdk_resource }}
sourceType: 'buildType'
impl: ${{ matrix.jdk_impl }}
- uses: AdoptOpenJDK/install-jdk@v1
if: matrix.sdk_resource == 'customized'
with:
version: ${{ matrix.jdk_version }}
source: ${{ matrix.customized_sdk_url }}
archiveExtension: ${{ matrix.archive_extension }}
sourceType: 'url'
impl: ${{ matrix.jdk_impl }}
# get-pr step by @Simran-B https://github.com/actions/checkout/issues/331#issuecomment-707103442
- uses: actions/github-script@v7
id: get-pr
with:
script: |
const request = {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
}
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`)
try {
const result = await github.pulls.get(request)
return result.data
} catch (err) {
core.setFailed(`Request failed with error ${err}`)
}
- name: AQA
uses: adoptium/run-aqa@v2
with:
build_list: ${{ matrix.build_list }}
target: ${{ matrix.target }}
jdksource: 'install-jdk'
version: ${{ matrix.jdk_version }}
openjdk_testRepo: '${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }}:${{ fromJSON(steps.get-pr.outputs.result).head.ref }}'
tkg_Repo: ${{ matrix.tkg_repo }}
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
if: failure()
with:
name: test_output
path: ./**/output_*/
reportFailure:
runs-on: ubuntu-latest
needs: [parseComment, runBuild]
if: failure() && !needs.parseComment.outputs.failed
steps:
- name: Create comment
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }} Build(s) failed.
Workflow Run ID: [${{ needs.parseComment.outputs.workflow_id }}](${{ needs.parseComment.outputs.workflow_url }})
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})
reportCancelled:
runs-on: ubuntu-latest
needs: [parseComment, runBuild]
if: cancelled()
steps:
- name: Create comment
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }} Build(s) cancelled.
Workflow Run ID: [${{ needs.parseComment.outputs.workflow_id }}](${{ needs.parseComment.outputs.workflow_url }})
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})
reportSuccess:
runs-on: ubuntu-latest
needs: [parseComment, runBuild]
if: success()
steps:
- name: Create comment
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }} Build(s) successful.
Workflow Run ID: [${{ needs.parseComment.outputs.workflow_id }}](${{ needs.parseComment.outputs.workflow_url }})
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})