Skip to content

Commit

Permalink
Merge pull request #9806 from Expensify/stites-removeAccessibilityChe…
Browse files Browse the repository at this point in the history
…cklist
  • Loading branch information
roryabraham authored Aug 15, 2022
2 parents 82dc866 + a98fcce commit 72b8153
Show file tree
Hide file tree
Showing 17 changed files with 330 additions and 384 deletions.
41 changes: 20 additions & 21 deletions .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,20 +280,19 @@ 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(?:\s+-\s.*\r?\n)+\r?\n)+)/) || [];
let PRListSection = issue.body.match(/pull requests:\*\*\r?\n((?:-.*\r?\n)+)\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 PRList = _.map(
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[([ x])] QA\\s+- \\[([ x])] Accessibility`, 'g'))],
[...PRListSection.matchAll(new RegExp(`- \\[([ x])] (${PULL_REQUEST_REGEX.source})`, 'g'))],
match => ({
url: match[1],
number: Number.parseInt(match[2], 10),
isVerified: match[3] === 'x',
isAccessible: match[4] === 'x',
url: match[2],
number: Number.parseInt(match[3], 10),
isVerified: match[1] === 'x',
}),
);
return _.sortBy(PRList, 'number');
Expand All @@ -308,7 +307,7 @@ class GithubUtils {
* @returns {Array<Object>} - [{URL: String, number: Number, isResolved: Boolean}]
*/
static getStagingDeployCashDeployBlockers(issue) {
let deployBlockerSection = issue.body.match(/Deploy Blockers:\*\*\r?\n((?:.*\r?\n)+)/) || [];
let deployBlockerSection = issue.body.match(/Deploy Blockers:\*\*\r?\n((?:-.*\r?\n)+)/) || [];
if (deployBlockerSection.length !== 2) {
return [];
}
Expand All @@ -330,7 +329,7 @@ class GithubUtils {
* @private
*
* @param {Object} issue
* @returns {Array<Object>} - [{URL: String, number: Number, isResolved: Boolean, isAccessible: Boolean}]
* @returns {Array<Object>} - [{URL: String, number: Number, isResolved: Boolean}]
*/
static getStagingDeployCashInternalQA(issue) {
let internalQASection = issue.body.match(/Internal QA:\*\*\r?\n((?:- \[[ x]].*\r?\n)+)/) || [];
Expand All @@ -344,7 +343,6 @@ class GithubUtils {
url: match[2].split('-')[0].trim(),
number: Number.parseInt(match[3], 10),
isResolved: match[1] === 'x',
isAccessible: false,
}),
);
return _.sortBy(internalQAPRs, 'number');
Expand All @@ -356,7 +354,6 @@ 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} [accessiblePRList] - 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.
* @param {Array} [resolvedInternalQAPRs] - The list of Internal QA PR URLs which have been resolved.
Expand All @@ -368,7 +365,6 @@ class GithubUtils {
tag,
PRList,
verifiedPRList = [],
accessiblePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
resolvedInternalQAPRs = [],
Expand Down Expand Up @@ -405,7 +401,6 @@ class GithubUtils {
);
console.log('Found the following NO QA PRs:', noQAPRs);
const verifiedOrNoQAPRs = _.union(verifiedPRList, noQAPRs);
const accessibleOrNoQAPRs = _.union(accessiblePRList, noQAPRs);

const sortedPRList = _.chain(PRList)
.difference(automatedPRs)
Expand All @@ -424,36 +419,40 @@ class GithubUtils {

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

// Internal QA PR list
if (!_.isEmpty(internalQAPRMap)) {
console.log('Found the following verified Internal QA PRs:', resolvedInternalQAPRs);
issueBody += '\r\n\r\n\r\n**Internal QA:**';
issueBody += '**Internal QA:**\r\n';
_.each(internalQAPRMap, (assignees, URL) => {
const assigneeMentions = _.reduce(assignees, (memo, assignee) => `${memo} @${assignee}`, '');
issueBody += `\r\n${_.contains(resolvedInternalQAPRs, URL) ? '- [x]' : '- [ ]'} `;
issueBody += `${_.contains(resolvedInternalQAPRs, URL) ? '- [x]' : '- [ ]'} `;
issueBody += `${URL}`;
issueBody += ` -${assigneeMentions}`;
issueBody += '\r\n';
});
issueBody += '\r\n\r\n';
}

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

issueBody += '\r\n\r\n**Deployer verifications:**';
issueBody += '**Deployer verifications:**';
// eslint-disable-next-line max-len
issueBody += `\r\n- [${isTimingDashboardChecked ? 'x' : ' '}] I checked the [App Timing Dashboard](https://graphs.expensify.com/grafana/d/yj2EobAGz/app-timing?orgId=1) and verified this release does not cause a noticeable performance regression.`;
// eslint-disable-next-line max-len
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const run = function () {
console.log('Checking for unverified PRs or unresolved deploy blockers', data);

// Check the issue description to see if there are any unfinished/un-QAed items in the checklist.
const uncheckedBoxRegex = /-\s\[\s]\s(?!Accessibility)/;
const uncheckedBoxRegex = /-\s\[\s]\s/;
if (uncheckedBoxRegex.test(data.body)) {
console.log('An unverified PR or unresolved deploy blocker was found.');
core.setOutput('HAS_DEPLOY_BLOCKERS', true);
Expand Down
43 changes: 21 additions & 22 deletions .github/actions/javascript/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const run = function () {
console.log('Checking for unverified PRs or unresolved deploy blockers', data);

// Check the issue description to see if there are any unfinished/un-QAed items in the checklist.
const uncheckedBoxRegex = /-\s\[\s]\s(?!Accessibility)/;
const uncheckedBoxRegex = /-\s\[\s]\s/;
if (uncheckedBoxRegex.test(data.body)) {
console.log('An unverified PR or unresolved deploy blocker was found.');
core.setOutput('HAS_DEPLOY_BLOCKERS', true);
Expand Down Expand Up @@ -250,20 +250,19 @@ 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(?:\s+-\s.*\r?\n)+\r?\n)+)/) || [];
let PRListSection = issue.body.match(/pull requests:\*\*\r?\n((?:-.*\r?\n)+)\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 PRList = _.map(
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[([ x])] QA\\s+- \\[([ x])] Accessibility`, 'g'))],
[...PRListSection.matchAll(new RegExp(`- \\[([ x])] (${PULL_REQUEST_REGEX.source})`, 'g'))],
match => ({
url: match[1],
number: Number.parseInt(match[2], 10),
isVerified: match[3] === 'x',
isAccessible: match[4] === 'x',
url: match[2],
number: Number.parseInt(match[3], 10),
isVerified: match[1] === 'x',
}),
);
return _.sortBy(PRList, 'number');
Expand All @@ -278,7 +277,7 @@ class GithubUtils {
* @returns {Array<Object>} - [{URL: String, number: Number, isResolved: Boolean}]
*/
static getStagingDeployCashDeployBlockers(issue) {
let deployBlockerSection = issue.body.match(/Deploy Blockers:\*\*\r?\n((?:.*\r?\n)+)/) || [];
let deployBlockerSection = issue.body.match(/Deploy Blockers:\*\*\r?\n((?:-.*\r?\n)+)/) || [];
if (deployBlockerSection.length !== 2) {
return [];
}
Expand All @@ -300,7 +299,7 @@ class GithubUtils {
* @private
*
* @param {Object} issue
* @returns {Array<Object>} - [{URL: String, number: Number, isResolved: Boolean, isAccessible: Boolean}]
* @returns {Array<Object>} - [{URL: String, number: Number, isResolved: Boolean}]
*/
static getStagingDeployCashInternalQA(issue) {
let internalQASection = issue.body.match(/Internal QA:\*\*\r?\n((?:- \[[ x]].*\r?\n)+)/) || [];
Expand All @@ -314,7 +313,6 @@ class GithubUtils {
url: match[2].split('-')[0].trim(),
number: Number.parseInt(match[3], 10),
isResolved: match[1] === 'x',
isAccessible: false,
}),
);
return _.sortBy(internalQAPRs, 'number');
Expand All @@ -326,7 +324,6 @@ 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} [accessiblePRList] - 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.
* @param {Array} [resolvedInternalQAPRs] - The list of Internal QA PR URLs which have been resolved.
Expand All @@ -338,7 +335,6 @@ class GithubUtils {
tag,
PRList,
verifiedPRList = [],
accessiblePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
resolvedInternalQAPRs = [],
Expand Down Expand Up @@ -375,7 +371,6 @@ class GithubUtils {
);
console.log('Found the following NO QA PRs:', noQAPRs);
const verifiedOrNoQAPRs = _.union(verifiedPRList, noQAPRs);
const accessibleOrNoQAPRs = _.union(accessiblePRList, noQAPRs);

const sortedPRList = _.chain(PRList)
.difference(automatedPRs)
Expand All @@ -394,36 +389,40 @@ class GithubUtils {

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

// Internal QA PR list
if (!_.isEmpty(internalQAPRMap)) {
console.log('Found the following verified Internal QA PRs:', resolvedInternalQAPRs);
issueBody += '\r\n\r\n\r\n**Internal QA:**';
issueBody += '**Internal QA:**\r\n';
_.each(internalQAPRMap, (assignees, URL) => {
const assigneeMentions = _.reduce(assignees, (memo, assignee) => `${memo} @${assignee}`, '');
issueBody += `\r\n${_.contains(resolvedInternalQAPRs, URL) ? '- [x]' : '- [ ]'} `;
issueBody += `${_.contains(resolvedInternalQAPRs, URL) ? '- [x]' : '- [ ]'} `;
issueBody += `${URL}`;
issueBody += ` -${assigneeMentions}`;
issueBody += '\r\n';
});
issueBody += '\r\n\r\n';
}

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

issueBody += '\r\n\r\n**Deployer verifications:**';
issueBody += '**Deployer verifications:**';
// eslint-disable-next-line max-len
issueBody += `\r\n- [${isTimingDashboardChecked ? 'x' : ' '}] I checked the [App Timing Dashboard](https://graphs.expensify.com/grafana/d/yj2EobAGz/app-timing?orgId=1) and verified this release does not cause a noticeable performance regression.`;
// eslint-disable-next-line max-len
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ 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 and isAccessible will be preserved.
// and the original value of isVerified will be preserved.
isVerified: false,
isAccessible: false,
}))),
false,
item => item.number,
Expand Down Expand Up @@ -132,7 +131,6 @@ const run = function () {
newTag,
_.pluck(PRList, 'url'),
_.pluck(_.where(PRList, {isVerified: true}), 'url'),
_.pluck(_.where(PRList, {isAccessible: true}), 'url'),
_.pluck(deployBlockers, 'url'),
_.pluck(_.where(deployBlockers, {isResolved: true}), 'url'),
_.pluck(_.where(internalQAPRList, {isResolved: true}), 'url'),
Expand Down
Loading

0 comments on commit 72b8153

Please sign in to comment.