Skip to content

Commit

Permalink
Merge branch 'main' into georgia-new-icons
Browse files Browse the repository at this point in the history
  • Loading branch information
grgia committed Nov 18, 2022
2 parents dd92428 + 46c1c7b commit b2734c3
Show file tree
Hide file tree
Showing 86 changed files with 708 additions and 775 deletions.
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ EXPENSIFY_PARTNER_PASSWORD=e21965746fd75f82bb66
PUSHER_APP_KEY=268df511a204fbb60884
USE_WEB_PROXY=false
ENVIRONMENT=production
SEND_CRASH_REPORTS=true
1 change: 1 addition & 0 deletions .env.staging
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ EXPENSIFY_PARTNER_PASSWORD=e21965746fd75f82bb66
PUSHER_APP_KEY=268df511a204fbb60884
USE_WEB_PROXY=false
ENVIRONMENT=staging
SEND_CRASH_REPORTS=true
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ This is a checklist for PR authors. Please make sure to complete all tasks and c
- [ ] I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like `Avatar`, I verified the components using `Avatar` are working as expected)
- [ ] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- [ ] I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
- [ ] I verified that if a function's arguments changed that all usages have also been updated correctly
- [ ] If a new component is created I verified that:
- [ ] A similar component doesn't exist in the codebase
- [ ] All props are defined accurately and each prop has a `/** comment above it */`
Expand Down Expand Up @@ -146,6 +147,7 @@ The reviewer will copy/paste it into a new comment and complete it after the aut
- [ ] I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like `Avatar`, I verified the components using `Avatar` have been tested & I retested again)
- [ ] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- [ ] I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
- [ ] I verified that if a function's arguments changed that all usages have also been updated correctly
- [ ] If a new component is created I verified that:
- [ ] A similar component doesn't exist in the codebase
- [ ] All props are defined accurately and each prop has a `/** comment above it */`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ function checkIssueForCompletedChecklist(numberOfChecklistItems) {
}

getNumberOfItemsFromAuthorChecklist()
.then(checkIssueForCompletedChecklist, (err) => {
.then(checkIssueForCompletedChecklist)
.catch((err) => {
console.error(err);
core.setFailed(err);
});
6 changes: 4 additions & 2 deletions .github/actions/javascript/authorChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ function checkIssueForCompletedChecklist(numberOfChecklistItems) {
}

getNumberOfItemsFromAuthorChecklist()
.then(checkIssueForCompletedChecklist, (err) => {
.then(checkIssueForCompletedChecklist)
.catch((err) => {
console.error(err);
core.setFailed(err);
});


Expand Down Expand Up @@ -355,7 +357,7 @@ class GithubUtils {
console.log('Found the following Internal QA PRs:', internalQAPRMap);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
_.filter(data, PR => /\[No\s?QA]/i.test(PR.title)),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ class GithubUtils {
console.log('Found the following Internal QA PRs:', internalQAPRMap);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
_.filter(data, PR => /\[No\s?QA]/i.test(PR.title)),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ class GithubUtils {
console.log('Found the following Internal QA PRs:', internalQAPRMap);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
_.filter(data, PR => /\[No\s?QA]/i.test(PR.title)),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ class GithubUtils {
console.log('Found the following Internal QA PRs:', internalQAPRMap);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
_.filter(data, PR => /\[No\s?QA]/i.test(PR.title)),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ class GithubUtils {
console.log('Found the following Internal QA PRs:', internalQAPRMap);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
_.filter(data, PR => /\[No\s?QA]/i.test(PR.title)),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/getPullRequestDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ class GithubUtils {
console.log('Found the following Internal QA PRs:', internalQAPRMap);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
_.filter(data, PR => /\[No\s?QA]/i.test(PR.title)),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/getReleaseBody/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ class GithubUtils {
console.log('Found the following Internal QA PRs:', internalQAPRMap);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
_.filter(data, PR => /\[No\s?QA]/i.test(PR.title)),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/isPullRequestMergeable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ class GithubUtils {
console.log('Found the following Internal QA PRs:', internalQAPRMap);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
_.filter(data, PR => /\[No\s?QA]/i.test(PR.title)),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/isStagingDeployLocked/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class GithubUtils {
console.log('Found the following Internal QA PRs:', internalQAPRMap);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
_.filter(data, PR => /\[No\s?QA]/i.test(PR.title)),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ class GithubUtils {
console.log('Found the following Internal QA PRs:', internalQAPRMap);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
_.filter(data, PR => /\[No\s?QA]/i.test(PR.title)),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/reopenIssueWithComment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ class GithubUtils {
console.log('Found the following Internal QA PRs:', internalQAPRMap);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
_.filter(data, PR => /\[No\s?QA]/i.test(PR.title)),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
Expand Down
32 changes: 27 additions & 5 deletions .github/actions/javascript/reviewerChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const combinedComments = [];
* @returns {Promise}
*/
function getNumberOfItemsFromReviewerChecklist() {
console.log('Getting the number of items in the reviewer checklist...');
return new Promise((resolve, reject) => {
https.get(pathToReviewerChecklist, (res) => {
let fileContents = '';
Expand All @@ -30,10 +31,14 @@ function getNumberOfItemsFromReviewerChecklist() {
});
res.on('end', () => {
const numberOfChecklistItems = (fileContents.match(/- \[ \]/g) || []).length;
console.log(`There are ${numberOfChecklistItems} items in the reviewer checklist.`);
resolve(numberOfChecklistItems);
});
})
.on('error', reject);
.on('error', (err) => {
console.error(err);
reject(err);
});
});
}

Expand All @@ -42,10 +47,17 @@ function getNumberOfItemsFromReviewerChecklist() {
*/
function checkIssueForCompletedChecklist(numberOfChecklistItems) {
GitHubUtils.getAllReviewComments(issue)
.then(reviewComments => combinedComments.push(...reviewComments))
.then((reviewComments) => {
console.log(`Pulled ${reviewComments.length} review comments, now adding them to the list...`);
combinedComments.push(...reviewComments);
})
.then(() => GitHubUtils.getAllComments(issue))
.then(comments => combinedComments.push(...comments))
.then((comments) => {
console.log(`Pulled ${comments.length} comments, now adding them to the list...`);
combinedComments.push(...comments);
})
.then(() => {
console.log(`Looking through all ${combinedComments.length} comments for the reviewer checklist...`);
let foundReviewerChecklist = false;
let numberOfFinishedChecklistItems = 0;
let numberOfUnfinishedChecklistItems = 0;
Expand All @@ -60,14 +72,22 @@ function checkIssueForCompletedChecklist(numberOfChecklistItems) {
const whitespace = /([\n\r])/gm;
const comment = combinedComments[i].replace(whitespace, '');

console.log(`Comment ${i} starts with: ${comment.slice(0, 20)}...`);

// Found the reviewer checklist, so count how many completed checklist items there are
if (comment.startsWith(reviewerChecklistStartsWith)) {
console.log('Found the reviewer checklist!');
foundReviewerChecklist = true;
numberOfFinishedChecklistItems = (comment.match(/- \[x\]/gi) || []).length;
numberOfUnfinishedChecklistItems = (comment.match(/- \[ \]/g) || []).length;
}
}

if (!foundReviewerChecklist) {
core.setFailed('No PR Reviewer Checklist was found');
return;
}

const maxCompletedItems = numberOfChecklistItems + 2;
const minCompletedItems = numberOfChecklistItems - 2;

Expand All @@ -86,8 +106,10 @@ function checkIssueForCompletedChecklist(numberOfChecklistItems) {
}

getNumberOfItemsFromReviewerChecklist()
.then(checkIssueForCompletedChecklist, (err) => {
.then(checkIssueForCompletedChecklist)
.catch((err) => {
console.error(err);
core.setFailed(err);
});


Expand Down Expand Up @@ -369,7 +391,7 @@ class GithubUtils {
console.log('Found the following Internal QA PRs:', internalQAPRMap);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
_.filter(data, PR => /\[No\s?QA]/i.test(PR.title)),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
Expand Down
30 changes: 26 additions & 4 deletions .github/actions/javascript/reviewerChecklist/reviewerChecklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const combinedComments = [];
* @returns {Promise}
*/
function getNumberOfItemsFromReviewerChecklist() {
console.log('Getting the number of items in the reviewer checklist...');
return new Promise((resolve, reject) => {
https.get(pathToReviewerChecklist, (res) => {
let fileContents = '';
Expand All @@ -20,10 +21,14 @@ function getNumberOfItemsFromReviewerChecklist() {
});
res.on('end', () => {
const numberOfChecklistItems = (fileContents.match(/- \[ \]/g) || []).length;
console.log(`There are ${numberOfChecklistItems} items in the reviewer checklist.`);
resolve(numberOfChecklistItems);
});
})
.on('error', reject);
.on('error', (err) => {
console.error(err);
reject(err);
});
});
}

Expand All @@ -32,10 +37,17 @@ function getNumberOfItemsFromReviewerChecklist() {
*/
function checkIssueForCompletedChecklist(numberOfChecklistItems) {
GitHubUtils.getAllReviewComments(issue)
.then(reviewComments => combinedComments.push(...reviewComments))
.then((reviewComments) => {
console.log(`Pulled ${reviewComments.length} review comments, now adding them to the list...`);
combinedComments.push(...reviewComments);
})
.then(() => GitHubUtils.getAllComments(issue))
.then(comments => combinedComments.push(...comments))
.then((comments) => {
console.log(`Pulled ${comments.length} comments, now adding them to the list...`);
combinedComments.push(...comments);
})
.then(() => {
console.log(`Looking through all ${combinedComments.length} comments for the reviewer checklist...`);
let foundReviewerChecklist = false;
let numberOfFinishedChecklistItems = 0;
let numberOfUnfinishedChecklistItems = 0;
Expand All @@ -50,14 +62,22 @@ function checkIssueForCompletedChecklist(numberOfChecklistItems) {
const whitespace = /([\n\r])/gm;
const comment = combinedComments[i].replace(whitespace, '');

console.log(`Comment ${i} starts with: ${comment.slice(0, 20)}...`);

// Found the reviewer checklist, so count how many completed checklist items there are
if (comment.startsWith(reviewerChecklistStartsWith)) {
console.log('Found the reviewer checklist!');
foundReviewerChecklist = true;
numberOfFinishedChecklistItems = (comment.match(/- \[x\]/gi) || []).length;
numberOfUnfinishedChecklistItems = (comment.match(/- \[ \]/g) || []).length;
}
}

if (!foundReviewerChecklist) {
core.setFailed('No PR Reviewer Checklist was found');
return;
}

const maxCompletedItems = numberOfChecklistItems + 2;
const minCompletedItems = numberOfChecklistItems - 2;

Expand All @@ -76,6 +96,8 @@ function checkIssueForCompletedChecklist(numberOfChecklistItems) {
}

getNumberOfItemsFromReviewerChecklist()
.then(checkIssueForCompletedChecklist, (err) => {
.then(checkIssueForCompletedChecklist)
.catch((err) => {
console.error(err);
core.setFailed(err);
});
2 changes: 1 addition & 1 deletion .github/actions/javascript/triggerWorkflowAndWait/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ class GithubUtils {
console.log('Found the following Internal QA PRs:', internalQAPRMap);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
_.filter(data, PR => /\[No\s?QA]/i.test(PR.title)),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/verifySignedCommits/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class GithubUtils {
console.log('Found the following Internal QA PRs:', internalQAPRMap);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
_.filter(data, PR => /\[No\s?QA]/i.test(PR.title)),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
Expand Down
2 changes: 1 addition & 1 deletion .github/libs/GithubUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class GithubUtils {
console.log('Found the following Internal QA PRs:', internalQAPRMap);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
_.filter(data, PR => /\[No\s?QA]/i.test(PR.title)),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ The GitHub workflows require a large list of secrets to deploy, notify and test
1. `LARGE_SECRET_PASSPHRASE` - decrypts secrets stored in various encrypted files stored in GitHub repository. To create updated versions of these encrypted files, refer to steps 1-4 of [this encrypted secrets help page](https://docs.github.com/en/actions/reference/encrypted-secrets#limits-for-secrets) using the `LARGE_SECRET_PASSPHRASE`.
1. `android/app/my-upload-key.keystore.gpg`
1. `android/app/android-fastlane-json-key.json.gpg`
1. `ios/chat_expensify_appstore.mobileprovision`
1. `ios/chat_expensify_adhoc.mobileprovision.gpg`
1. `ios/chat_expensify_appstore.mobileprovision.gpg`
1. `ios/Certificates.p12.gpg`
1. `SLACK_WEBHOOK` - Sends Slack notifications via Slack WebHook https://expensify.slack.com/services/B01AX48D7MM
1. `OS_BOTIFY_TOKEN` - Personal access token for @OSBotify user in GitHub
Expand All @@ -75,6 +76,7 @@ The GitHub workflows require a large list of secrets to deploy, notify and test
1. `APPLE_CONTACT_PHONE` - Phone number used for contact between Expensify and Apple for https://appstoreconnect.apple.com/
1. `APPLE_DEMO_EMAIL` - Demo account email used for https://appstoreconnect.apple.com/
1. `APPLE_DEMO_PASSWORD` - Demo account password used for https://appstoreconnect.apple.com/
1. `BROWSERSTACK` - Used to access Browserstack's API

## Actions

Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/platformDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ jobs:
MYAPP_UPLOAD_STORE_PASSWORD: ${{ secrets.MYAPP_UPLOAD_STORE_PASSWORD }}
MYAPP_UPLOAD_KEY_PASSWORD: ${{ secrets.MYAPP_UPLOAD_KEY_PASSWORD }}


- name: Run Fastlane production
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: bundle exec fastlane android production
Expand All @@ -71,6 +70,12 @@ jobs:
name: android-sourcemap
path: android/app/build/generated/sourcemaps/react/release/*.map

- name: Upload Android version to Browser Stack
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: curl -u "$BROWSERSTACK" -X POST "https://api-cloud.browserstack.com/app-live/upload" -F "file=@./android/app/build/outputs/bundle/release/app-release.aab"
env:
BROWSERSTACK: ${{ secrets.BROWSERSTACK }}

- name: Warn deployers if Android production deploy failed
if: ${{ failure() && fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
uses: 8398a7/action-slack@v3
Expand Down Expand Up @@ -174,6 +179,12 @@ jobs:
name: ios-sourcemap
path: main.jsbundle.map

- name: Upload iOS version to Browser Stack
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: curl -u "$BROWSERSTACK" -X POST "https://api-cloud.browserstack.com/app-live/upload" -F "file=@/Users/runner/work/App/App/New Expensify.ipa"
env:
BROWSERSTACK: ${{ secrets.BROWSERSTACK }}

- name: Set iOS version in ENV
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: echo "IOS_VERSION=$(echo '${{ github.event.release.tag_name }}' | tr '-' '.')" >> "$GITHUB_ENV"
Expand Down
Loading

0 comments on commit b2734c3

Please sign in to comment.