Skip to content

Commit e98b5a2

Browse files
authored
Merge pull request #33 from dscho/msys2-runtime-3.3-vs-3.4
Prepare for the architecture split between MSYS2 runtime 3.3.* vs 3.4.* From here on out, we will build `msys2-runtime-3.3` only for i686, and `msys2-runtime` only for x86_64. This is a necessary prerequisite for upgrading `msys2-runtime` to the current version, v3.4.6, because that simply does not support i686 anymore (and to accommodate for that, we move `git-sdk-32` to using `msys2-runtime-3.3` instead of `msys2-runtime`).
2 parents 29b1c99 + 1da3d8a commit e98b5a2

3 files changed

Lines changed: 149 additions & 76 deletions

File tree

.vscode/launch.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"name": "Debug Tests",
88
"program": "${workspaceRoot}/node_modules/.bin/jest",
99
"cwd": "${workspaceRoot}",
10+
// to restrict running to a particular test case, add something like "--testNamePattern=/deploy"
1011
"args": ["--runInBand", "--config", "jest.config.js"],
1112
"windows": {
1213
"program": "${workspaceFolder}/node_modules/jest/bin/jest"

GitForWindowsHelper/slash-commands.js

Lines changed: 48 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -156,104 +156,76 @@ module.exports = async (context, req) => {
156156
commentId,
157157
text
158158
)
159-
if (!isMSYSPackage(package_name)) {
160-
let aarch64Answer
161-
if (needsSeparateARM64Build(package_name)) {
162-
const aarch64Id = await queueCheckRun(
163-
context,
164-
await getToken(),
165-
'git-for-windows',
166-
repo,
167-
ref,
168-
'deploy_aarch64',
169-
`Build and deploy ${package_name}`,
170-
`Deploying ${package_name}`
159+
160+
const toTrigger = []
161+
if (isMSYSPackage(package_name)) {
162+
if (package_name !== 'msys2-runtime-3.3') {
163+
toTrigger.push(
164+
{ architecture: 'x86_64' }
171165
)
172-
aarch64Answer = await triggerBuild('aarch64')
173-
await updateCheckRun(
174-
context,
175-
await getToken(),
176-
'git-for-windows',
177-
repo,
178-
aarch64Id, {
179-
details_url: aarch64Answer.html_url
180-
}
166+
}
167+
168+
if (package_name !== 'msys2-runtime') {
169+
toTrigger.push(
170+
{ architecture: 'i686' }
171+
)
172+
}
173+
} else {
174+
toTrigger.push(
175+
{ displayArchitecture: 'i686/x86_64' }
176+
)
177+
if (needsSeparateARM64Build(package_name)) {
178+
toTrigger.push(
179+
{ architecture: 'aarch64', displayArchitecture: 'arm64' }
181180
)
182181
}
182+
}
183183

184-
const id = await queueCheckRun(
184+
for (const e of toTrigger) {
185+
const deployLabel = e.architecture ? `deploy_${e.architecture}` : 'deploy'
186+
e.id = await queueCheckRun(
185187
context,
186188
await getToken(),
187189
'git-for-windows',
188190
repo,
189191
ref,
190-
'deploy',
192+
deployLabel,
191193
`Build and deploy ${package_name}`,
192194
`Deploying ${package_name}`
193195
)
196+
}
194197

195-
const answer = await triggerBuild()
196-
const answer2 = await appendToComment(aarch64Answer
197-
? `The [i686/x86_64](${answer.html_url}) and the [arm64](${aarch64Answer.html_url}) workflow runs were started.`
198-
: `The workflow run [was started](${answer.html_url}).`
199-
)
198+
for (const e of toTrigger) {
199+
e.answer = await triggerBuild(e.architecture)
200+
}
201+
202+
const answer = await appendToComment(
203+
toTrigger.length === 1
204+
? `The workflow run [was started](${toTrigger[0].answer.html_url}).`
205+
: `${toTrigger.map((e, index) => {
206+
return `${
207+
index === 0 ? 'The' : index === toTrigger.length - 1 ? ' and the' : ', the'
208+
} [${
209+
e.displayArchitecture || e.architecture
210+
}](${
211+
e.answer.html_url
212+
})`
213+
}).join('')} workflow runs were started.`
214+
)
215+
216+
for (const e of toTrigger) {
200217
await updateCheckRun(
201218
context,
202219
await getToken(),
203220
'git-for-windows',
204221
repo,
205-
id, {
206-
details_url: answer.html_url
222+
e.id, {
223+
details_url: e.answer.html_url
207224
}
208225
)
209-
return `I edited the comment: ${answer2.html_url}`
210226
}
211227

212-
const x86_64Id = await queueCheckRun(
213-
context,
214-
await getToken(),
215-
'git-for-windows',
216-
repo,
217-
ref,
218-
'deploy_x86_64',
219-
`Build and deploy ${package_name}`,
220-
`Deploying ${package_name}`
221-
)
222-
const i686Id = await queueCheckRun(
223-
context,
224-
await getToken(),
225-
'git-for-windows',
226-
repo,
227-
ref,
228-
'deploy_i686',
229-
`Build and deploy ${package_name}`,
230-
`Deploying ${package_name}`
231-
)
232-
233-
const x86_64Answer = await triggerBuild('x86_64')
234-
const i686Answer = await triggerBuild('i686')
235-
const answer2 = await appendToComment(
236-
`The [x86_64](${x86_64Answer.html_url}) and the [i686](${i686Answer.html_url}) workflow runs were started.`
237-
)
238-
await updateCheckRun(
239-
context,
240-
await getToken(),
241-
'git-for-windows',
242-
repo,
243-
x86_64Id, {
244-
details_url: x86_64Answer.html_url
245-
}
246-
)
247-
await updateCheckRun(
248-
context,
249-
await getToken(),
250-
'git-for-windows',
251-
repo,
252-
i686Id, {
253-
details_url: i686Answer.html_url
254-
}
255-
)
256-
return `I edited the comment: ${answer2.html_url}`
228+
return `I edited the comment: ${answer.html_url}`
257229
}
258230

259231
if (command == '/git-artifacts') {

__tests__/index.test.js

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,18 @@ let mockGitHubApiRequest = jest.fn((_context, _token, method, requestPath, paylo
103103
if (method === 'GET' && requestPath.endsWith('/pulls/86')) return {
104104
head: { sha: '707a11ee' }
105105
}
106+
if (method === 'GET' && requestPath.endsWith('/pulls/500')) return {
107+
head: { sha: '82e8648' }
108+
}
109+
if (method === 'GET' && requestPath.endsWith('/pulls/74')) return {
110+
head: { sha: 'a7e4b90' }
111+
}
112+
if (method === 'GET' && requestPath.endsWith('/pulls/90')) return {
113+
head: { sha: '265d07e' }
114+
}
115+
if (method === 'GET' && requestPath.endsWith('/pulls/96')) return {
116+
head: { sha: 'b7b0dfc' }
117+
}
106118
if (method === 'GET' && requestPath.endsWith('/pulls/4322')) return {
107119
head: { sha: 'c8edb521bdabec14b07e9142e48cab77a40ba339' }
108120
}
@@ -339,6 +351,94 @@ The [x86_64](dispatched-workflow-build-and-deploy.yml) and the [i686](dispatched
339351
expect(dispatchedWorkflows.map(e => e.payload.inputs.architecture)).toEqual(['i686', 'x86_64'])
340352
})
341353

354+
testIssueComment('/deploy mingw-w64-git-credential-manager', {
355+
issue: {
356+
number: 500,
357+
title: 'mingw-w64-git-credential-manager: update to 2.1.2',
358+
body: 'This closes https://github.com/git-for-windows/git/issues/4415',
359+
pull_request: {
360+
html_url: 'https://github.com/git-for-windows/build-extra/pull/500'
361+
}
362+
},
363+
repository: {
364+
name: 'build-extra'
365+
}
366+
}, async (context) => {
367+
expect(await index(context, context.req)).toBeUndefined()
368+
expect(context.res.body).toEqual(`I edited the comment: appended-comment-body-existing comment body
369+
370+
The workflow run [was started](dispatched-workflow-build-and-deploy.yml).`)
371+
expect(mockQueueCheckRun).toHaveBeenCalledTimes(1)
372+
expect(mockUpdateCheckRun).toHaveBeenCalledTimes(1)
373+
expect(dispatchedWorkflows.map(e => e.payload.inputs.architecture)).toEqual([undefined])
374+
})
375+
376+
testIssueComment('/deploy mingw-w64-curl', {
377+
issue: {
378+
number: 74,
379+
title: 'mingw-w64-curl: update to 8.0.1',
380+
body: 'This closes https://github.com/git-for-windows/git/issues/4354',
381+
pull_request: {
382+
html_url: 'https://github.com/git-for-windows/MINGW-packages/pull/74'
383+
}
384+
},
385+
repository: {
386+
name: 'MINGW-packages'
387+
}
388+
}, async (context) => {
389+
expect(await index(context, context.req)).toBeUndefined()
390+
expect(context.res.body).toEqual(`I edited the comment: appended-comment-body-existing comment body
391+
392+
The [i686/x86_64](dispatched-workflow-build-and-deploy.yml) and the [arm64](dispatched-workflow-build-and-deploy.yml) workflow runs were started.`)
393+
expect(mockQueueCheckRun).toHaveBeenCalledTimes(2)
394+
expect(mockUpdateCheckRun).toHaveBeenCalledTimes(2)
395+
expect(dispatchedWorkflows.map(e => e.payload.inputs.architecture)).toEqual(['aarch64', undefined])
396+
})
397+
398+
testIssueComment('/deploy msys2-runtime', {
399+
issue: {
400+
number: 90,
401+
title: 'msys2-runtime: avoid sharing incompatible cygheaps, take two',
402+
body: 'This is a companion to https://github.com/git-for-windows/msys2-runtime/pull/49.',
403+
pull_request: {
404+
html_url: 'https://github.com/git-for-windows/MSYS2-packages/pull/90'
405+
}
406+
},
407+
repository: {
408+
name: 'MSYS2-packages'
409+
}
410+
}, async (context) => {
411+
expect(await index(context, context.req)).toBeUndefined()
412+
expect(context.res.body).toEqual(`I edited the comment: appended-comment-body-existing comment body
413+
414+
The workflow run [was started](dispatched-workflow-build-and-deploy.yml).`)
415+
expect(mockQueueCheckRun).toHaveBeenCalledTimes(1)
416+
expect(mockUpdateCheckRun).toHaveBeenCalledTimes(1)
417+
expect(dispatchedWorkflows.map(e => e.payload.inputs.architecture)).toEqual(['x86_64'])
418+
})
419+
420+
testIssueComment('/deploy msys2-runtime-3.3', {
421+
issue: {
422+
number: 96,
423+
title: 'add a msys2-runtime-3.3 package',
424+
body: 'The first step of phase 2 of the current timeline(https://github.com/git-for-windows/git/issues/4279#issue-1577622335)',
425+
pull_request: {
426+
html_url: 'https://github.com/git-for-windows/MSYS2-packages/pull/96'
427+
}
428+
},
429+
repository: {
430+
name: 'MSYS2-packages'
431+
}
432+
}, async (context) => {
433+
expect(await index(context, context.req)).toBeUndefined()
434+
expect(context.res.body).toEqual(`I edited the comment: appended-comment-body-existing comment body
435+
436+
The workflow run [was started](dispatched-workflow-build-and-deploy.yml).`)
437+
expect(mockQueueCheckRun).toHaveBeenCalledTimes(1)
438+
expect(mockUpdateCheckRun).toHaveBeenCalledTimes(1)
439+
expect(dispatchedWorkflows.map(e => e.payload.inputs.architecture)).toEqual(['i686'])
440+
})
441+
342442
testIssueComment('/add release note', {
343443
issue: {
344444
number: 4281,

0 commit comments

Comments
 (0)