Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[No QA] Add accessibility check to each PR in the deployChecklist #5117

Merged
merged 44 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
dcfb429
create test with desired format
Julesssss Sep 7, 2021
821c371
implement new issue formatting, to match test
Julesssss Sep 7, 2021
90112c5
update first 3 tests using the new formatting, replace example test
Julesssss Sep 7, 2021
e1fa3f5
modify new formatting of deploy blocker header
Julesssss Sep 8, 2021
2833a20
resolve remaining tests, improve test formatting
Julesssss Sep 8, 2021
e6befa3
attempt to preserve the accessibility status
Julesssss Sep 8, 2021
c247f82
Style
stitesExpensify Sep 28, 2021
b5a6148
Style
stitesExpensify Sep 28, 2021
e2e835d
Style
stitesExpensify Sep 28, 2021
74a9fcd
more style:
stitesExpensify Sep 28, 2021
cd9e8f0
Update to have reusable snippets instead of hard coding the body
stitesExpensify Oct 4, 2021
08d93d9
Update regex to find new format
stitesExpensify Oct 5, 2021
ebbd613
Update tests for new format
stitesExpensify Oct 5, 2021
c2d23ac
Merge branch 'main' of github.com:Expensify/App into jules-deployChec…
stitesExpensify Oct 5, 2021
1a32a5a
Fix regex to properly capture new groups
stitesExpensify Oct 5, 2021
0045660
Merge branch 'main' of github.com:Expensify/App into jules-deployChec…
stitesExpensify Oct 8, 2021
1dcb806
Add more PRs to the list and chagne hard-coded list
stitesExpensify Oct 8, 2021
e09df24
Fix capture grouping
stitesExpensify Oct 8, 2021
f4ce0e6
Fix match
stitesExpensify Oct 8, 2021
36139d9
Fix tests to check for the correct checkbox
stitesExpensify Oct 8, 2021
d45c3e3
Update test to fix version that I didn't properly convert
stitesExpensify Oct 8, 2021
9e8d6be
Update test to look for new format
stitesExpensify Oct 8, 2021
0a05279
Merge branch 'main' of github.com:Expensify/App into jules-deployChec…
stitesExpensify Oct 11, 2021
37aa160
Update regex for deploy blockers
stitesExpensify Oct 11, 2021
5b4ebe0
Update tests for proper format
stitesExpensify Oct 11, 2021
9819985
Update param order
stitesExpensify Oct 11, 2021
438f5d9
style
stitesExpensify Oct 11, 2021
232dfdc
Fix duplicated PR in list
stitesExpensify Oct 11, 2021
b03a026
Also make sure accessibility issues get checked off
stitesExpensify Oct 11, 2021
52676ec
Update regex again for the possibility of different spacing
stitesExpensify Oct 12, 2021
32db6a0
Update tests to match the ones we had originally
stitesExpensify Oct 12, 2021
eeb0c1d
Swap everything back to issues like it was in the original tests
stitesExpensify Oct 12, 2021
84ebbe4
Update compiled actions build
stitesExpensify Oct 12, 2021
6e47e40
Remove the - before the PR name
stitesExpensify Oct 12, 2021
8176df1
Remove listStart
stitesExpensify Oct 12, 2021
1e10a0e
Remove - to fix tests
stitesExpensify Oct 12, 2021
1db0b22
Update compiled build actions
stitesExpensify Oct 12, 2021
e267340
Change accessabilityPRList to accessablePRList
stitesExpensify Oct 12, 2021
2abbea9
Remove accessilibty from deploy blocker list
stitesExpensify Oct 12, 2021
bfe3eca
Update regex to de-duplicate logic
stitesExpensify Oct 12, 2021
d7fea21
Should be 2 spaces, not 8
stitesExpensify Oct 12, 2021
fc8c27a
Add duplicate back
stitesExpensify Oct 12, 2021
983de3b
re-add initial - for issue
stitesExpensify Oct 12, 2021
b78918e
Update actions build
stitesExpensify Oct 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions .github/actions/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,23 +206,23 @@ class GithubUtils {
* @returns {Array<Object>} - [{url: String, number: Number, isVerified: Boolean}]
*/
static getStagingDeployCashPRList(issue) {
let PRListSection = issue.body.match(/pull requests:\*\*\r?\n((?:.*\r?\n)+)\r?\n/) || [];
let PRListSection = issue.body.match(/pull requests:\*\*(?:\r?\n)*((?:.*\r?\n(?:\s+-\s.*\r?\n)+\r?\n)+)/) || [];
if (PRListSection.length !== 2) {
// No PRs, return an empty array
console.log('Hmmm...The open StagingDeployCash does not list any pull requests, continuing...');
return [];
}
PRListSection = PRListSection[1];
const unverifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- \\[ ] (${PULL_REQUEST_REGEX.source})`, 'g'))],
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
isVerified: false,
}),
);
const verifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- \\[x] (${PULL_REQUEST_REGEX.source})`, 'g'))],
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
Expand Down Expand Up @@ -250,15 +250,15 @@ class GithubUtils {
}
deployBlockerSection = deployBlockerSection[1];
const unresolvedDeployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- \\[ ] (${ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))],
[...deployBlockerSection.matchAll(new RegExp(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
isResolved: false,
}),
);
const resolvedDeployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- \\[x] (${ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))],
[...deployBlockerSection.matchAll(new RegExp(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
Expand All @@ -277,6 +277,7 @@ class GithubUtils {
* @param {String} tag
* @param {Array} PRList - The list of PR URLs which are included in this StagingDeployCash
* @param {Array} [verifiedPRList] - The list of PR URLs which have passed QA.
* @param {Array} [accessablePRList] - The list of PR URLs which have passed the accessability check.
* @param {Array} [deployBlockers] - The list of DeployBlocker URLs.
* @param {Array} [resolvedDeployBlockers] - The list of DeployBlockers URLs which have been resolved.
* @returns {Promise}
Expand All @@ -285,6 +286,7 @@ class GithubUtils {
tag,
PRList,
verifiedPRList = [],
accessablePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
) {
Expand All @@ -311,23 +313,24 @@ class GithubUtils {

// PR list
if (!_.isEmpty(sortedPRList)) {
issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n';
issueBody += '\r\n**This release contains changes from the following pull requests:**';
_.each(sortedPRList, (URL) => {
issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]';
issueBody += ` ${URL}\r\n`;
issueBody += `\r\n\r\n- ${URL}`;
issueBody += _.contains(verifiedPRList, URL) ? '\r\n - [x] QA' : '\r\n - [ ] QA';
issueBody += _.contains(accessablePRList, URL) ? '\r\n - [x] Accessibility' : '\r\n - [ ] Accessibility';
});
}

// Deploy blockers
if (!_.isEmpty(deployBlockers)) {
issueBody += '\r\n**Deploy Blockers:**\r\n';
issueBody += '\r\n\r\n\r\n**Deploy Blockers:**';
_.each(sortedDeployBlockers, (URL) => {
issueBody += _.contains(resolvedDeployBlockers, URL) ? '- [x]' : '- [ ]';
issueBody += ` ${URL}\r\n`;
issueBody += `\r\n\r\n- ${URL}`;
issueBody += _.contains(resolvedDeployBlockers, URL) ? '\r\n - [x] QA' : '\r\n - [ ] QA';
});
}

issueBody += '\r\ncc @Expensify/applauseleads\r\n';
issueBody += '\r\n\r\ncc @Expensify/applauseleads\r\n';
return issueBody;
})
.catch(err => console.warn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ const run = function () {
// Since this is the second argument to _.union,
// it will appear later in the array than any duplicate.
// Since it is later in the array, it will be truncated by _.unique,
// and the original value of isVerified will be preserved.
// and the original value of isVerified and isAccessible will be preserved.
isVerified: false,
isAccessible: false,
}))),
false,
item => item.number,
Expand All @@ -124,6 +125,7 @@ const run = function () {
tag,
_.pluck(PRList, 'url'),
_.pluck(_.where(PRList, {isVerified: true}), 'url'),
_.pluck(_.where(PRList, {isAccessible: true}), 'url'),
_.pluck(deployBlockers, 'url'),
_.pluck(_.where(deployBlockers, {isResolved: true}), 'url'),
);
Expand Down
31 changes: 18 additions & 13 deletions .github/actions/createOrUpdateStagingDeploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ const run = function () {
// Since this is the second argument to _.union,
// it will appear later in the array than any duplicate.
// Since it is later in the array, it will be truncated by _.unique,
// and the original value of isVerified will be preserved.
// and the original value of isVerified and isAccessible will be preserved.
isVerified: false,
isAccessible: false,
}))),
false,
item => item.number,
Expand All @@ -134,6 +135,7 @@ const run = function () {
tag,
_.pluck(PRList, 'url'),
_.pluck(_.where(PRList, {isVerified: true}), 'url'),
_.pluck(_.where(PRList, {isAccessible: true}), 'url'),
_.pluck(deployBlockers, 'url'),
_.pluck(_.where(deployBlockers, {isResolved: true}), 'url'),
);
Expand Down Expand Up @@ -333,23 +335,23 @@ class GithubUtils {
* @returns {Array<Object>} - [{url: String, number: Number, isVerified: Boolean}]
*/
static getStagingDeployCashPRList(issue) {
let PRListSection = issue.body.match(/pull requests:\*\*\r?\n((?:.*\r?\n)+)\r?\n/) || [];
let PRListSection = issue.body.match(/pull requests:\*\*(?:\r?\n)*((?:.*\r?\n(?:\s+-\s.*\r?\n)+\r?\n)+)/) || [];
if (PRListSection.length !== 2) {
// No PRs, return an empty array
console.log('Hmmm...The open StagingDeployCash does not list any pull requests, continuing...');
return [];
}
PRListSection = PRListSection[1];
const unverifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- \\[ ] (${PULL_REQUEST_REGEX.source})`, 'g'))],
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
isVerified: false,
}),
);
const verifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- \\[x] (${PULL_REQUEST_REGEX.source})`, 'g'))],
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
Expand Down Expand Up @@ -377,15 +379,15 @@ class GithubUtils {
}
deployBlockerSection = deployBlockerSection[1];
const unresolvedDeployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- \\[ ] (${ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))],
[...deployBlockerSection.matchAll(new RegExp(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
isResolved: false,
}),
);
const resolvedDeployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- \\[x] (${ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))],
[...deployBlockerSection.matchAll(new RegExp(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
Expand All @@ -404,6 +406,7 @@ class GithubUtils {
* @param {String} tag
* @param {Array} PRList - The list of PR URLs which are included in this StagingDeployCash
* @param {Array} [verifiedPRList] - The list of PR URLs which have passed QA.
* @param {Array} [accessablePRList] - The list of PR URLs which have passed the accessability check.
* @param {Array} [deployBlockers] - The list of DeployBlocker URLs.
* @param {Array} [resolvedDeployBlockers] - The list of DeployBlockers URLs which have been resolved.
* @returns {Promise}
Expand All @@ -412,6 +415,7 @@ class GithubUtils {
tag,
PRList,
verifiedPRList = [],
accessablePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
) {
Expand All @@ -438,23 +442,24 @@ class GithubUtils {

// PR list
if (!_.isEmpty(sortedPRList)) {
issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n';
issueBody += '\r\n**This release contains changes from the following pull requests:**';
_.each(sortedPRList, (URL) => {
issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]';
issueBody += ` ${URL}\r\n`;
issueBody += `\r\n\r\n- ${URL}`;
issueBody += _.contains(verifiedPRList, URL) ? '\r\n - [x] QA' : '\r\n - [ ] QA';
issueBody += _.contains(accessablePRList, URL) ? '\r\n - [x] Accessibility' : '\r\n - [ ] Accessibility';
});
}

// Deploy blockers
if (!_.isEmpty(deployBlockers)) {
issueBody += '\r\n**Deploy Blockers:**\r\n';
issueBody += '\r\n\r\n\r\n**Deploy Blockers:**';
_.each(sortedDeployBlockers, (URL) => {
issueBody += _.contains(resolvedDeployBlockers, URL) ? '- [x]' : '- [ ]';
issueBody += ` ${URL}\r\n`;
issueBody += `\r\n\r\n- ${URL}`;
issueBody += _.contains(resolvedDeployBlockers, URL) ? '\r\n - [x] QA' : '\r\n - [ ] QA';
});
}

issueBody += '\r\ncc @Expensify/applauseleads\r\n';
issueBody += '\r\n\r\ncc @Expensify/applauseleads\r\n';
return issueBody;
})
.catch(err => console.warn(
Expand Down
27 changes: 15 additions & 12 deletions .github/actions/getPullRequestDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,23 +259,23 @@ class GithubUtils {
* @returns {Array<Object>} - [{url: String, number: Number, isVerified: Boolean}]
*/
static getStagingDeployCashPRList(issue) {
let PRListSection = issue.body.match(/pull requests:\*\*\r?\n((?:.*\r?\n)+)\r?\n/) || [];
let PRListSection = issue.body.match(/pull requests:\*\*(?:\r?\n)*((?:.*\r?\n(?:\s+-\s.*\r?\n)+\r?\n)+)/) || [];
if (PRListSection.length !== 2) {
// No PRs, return an empty array
console.log('Hmmm...The open StagingDeployCash does not list any pull requests, continuing...');
return [];
}
PRListSection = PRListSection[1];
const unverifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- \\[ ] (${PULL_REQUEST_REGEX.source})`, 'g'))],
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
isVerified: false,
}),
);
const verifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- \\[x] (${PULL_REQUEST_REGEX.source})`, 'g'))],
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
Expand Down Expand Up @@ -303,15 +303,15 @@ class GithubUtils {
}
deployBlockerSection = deployBlockerSection[1];
const unresolvedDeployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- \\[ ] (${ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))],
[...deployBlockerSection.matchAll(new RegExp(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
isResolved: false,
}),
);
const resolvedDeployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- \\[x] (${ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))],
[...deployBlockerSection.matchAll(new RegExp(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
Expand All @@ -330,6 +330,7 @@ class GithubUtils {
* @param {String} tag
* @param {Array} PRList - The list of PR URLs which are included in this StagingDeployCash
* @param {Array} [verifiedPRList] - The list of PR URLs which have passed QA.
* @param {Array} [accessablePRList] - The list of PR URLs which have passed the accessability check.
* @param {Array} [deployBlockers] - The list of DeployBlocker URLs.
* @param {Array} [resolvedDeployBlockers] - The list of DeployBlockers URLs which have been resolved.
* @returns {Promise}
Expand All @@ -338,6 +339,7 @@ class GithubUtils {
tag,
PRList,
verifiedPRList = [],
accessablePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
) {
Expand All @@ -364,23 +366,24 @@ class GithubUtils {

// PR list
if (!_.isEmpty(sortedPRList)) {
issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n';
issueBody += '\r\n**This release contains changes from the following pull requests:**';
_.each(sortedPRList, (URL) => {
issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]';
issueBody += ` ${URL}\r\n`;
issueBody += `\r\n\r\n- ${URL}`;
issueBody += _.contains(verifiedPRList, URL) ? '\r\n - [x] QA' : '\r\n - [ ] QA';
issueBody += _.contains(accessablePRList, URL) ? '\r\n - [x] Accessibility' : '\r\n - [ ] Accessibility';
});
}

// Deploy blockers
if (!_.isEmpty(deployBlockers)) {
issueBody += '\r\n**Deploy Blockers:**\r\n';
issueBody += '\r\n\r\n\r\n**Deploy Blockers:**';
_.each(sortedDeployBlockers, (URL) => {
issueBody += _.contains(resolvedDeployBlockers, URL) ? '- [x]' : '- [ ]';
issueBody += ` ${URL}\r\n`;
issueBody += `\r\n\r\n- ${URL}`;
issueBody += _.contains(resolvedDeployBlockers, URL) ? '\r\n - [x] QA' : '\r\n - [ ] QA';
});
}

issueBody += '\r\ncc @Expensify/applauseleads\r\n';
issueBody += '\r\n\r\ncc @Expensify/applauseleads\r\n';
return issueBody;
})
.catch(err => console.warn(
Expand Down
Loading