Skip to content

Commit

Permalink
Merge branch 'main' into fix/47903
Browse files Browse the repository at this point in the history
  • Loading branch information
daledah committed Sep 11, 2024
2 parents 379897f + 74f1083 commit 39b6311
Show file tree
Hide file tree
Showing 452 changed files with 16,325 additions and 9,431 deletions.
2 changes: 1 addition & 1 deletion .github/actions/composite/buildAndroidE2EAPK/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ runs:
- uses: Expensify/App/.github/actions/composite/setupNode@main

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: "oracle"
java-version: "17"
Expand Down
6 changes: 5 additions & 1 deletion .github/actions/composite/setupNode/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ outputs:
runs:
using: composite
steps:
- name: Remove E/App version from package-lock.json
shell: bash
run: jq 'del(.version, .packages[""].version)' package-lock.json > normalized-package-lock.json

- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm
cache-dependency-path: |
package-lock.json
normalized-package-lock.json
desktop/package-lock.json
- id: cache-node-modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function run() {
GitHubUtils.octokit.actions.listWorkflowRuns({
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
workflow_id: 'platformDeploy.yml',
workflow_id: 'deploy.yml',
event: 'push',
branch: tag,
}),
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 @@ -12138,7 +12138,7 @@ function run() {
GithubUtils_1.default.octokit.actions.listWorkflowRuns({
owner: CONST_1.default.GITHUB_OWNER,
repo: CONST_1.default.APP_REPO,
workflow_id: 'platformDeploy.yml',
workflow_id: 'deploy.yml',
event: 'push',
branch: tag,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async function isReleaseValidBaseForEnvironment(releaseTag: string, isProduction
}

/**
* Was a given platformDeploy workflow run successful on at least one platform?
* Was a given deploy workflow run successful on at least one platform?
*/
async function wasDeploySuccessful(runID: number) {
const jobsForWorkflowRun = (
Expand Down Expand Up @@ -82,7 +82,7 @@ async function run() {

console.log(`Looking for PRs deployed to ${deployEnv} in ${inputTag}...`);

const completedDeploys = (
const platformDeploys = (
await GithubUtils.octokit.actions.listWorkflowRuns({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
Expand All @@ -95,6 +95,24 @@ async function run() {
// because if a build fails on even one platform, then it will have the status 'failure'
.filter((workflowRun) => workflowRun.conclusion !== 'cancelled');

const deploys = (
await GithubUtils.octokit.actions.listWorkflowRuns({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
// eslint-disable-next-line @typescript-eslint/naming-convention
workflow_id: 'deploy.yml',
status: 'completed',
})
).data.workflow_runs
// Note: we filter out cancelled runs instead of looking only for success runs
// because if a build fails on even one platform, then it will have the status 'failure'
.filter((workflowRun) => workflowRun.conclusion !== 'cancelled');

// W've combined platformDeploy.yml and deploy.yml
// TODO: Remove this once there are successful staging and production deploys using the new deploy.yml workflow
const completedDeploys = [...deploys, ...platformDeploys];
completedDeploys.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());

// Find the most recent deploy workflow targeting the correct environment, for which at least one of the build jobs finished successfully
let lastSuccessfulDeploy = completedDeploys.shift();

Expand Down
18 changes: 16 additions & 2 deletions .github/actions/javascript/getDeployPullRequestList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11526,7 +11526,7 @@ async function isReleaseValidBaseForEnvironment(releaseTag, isProductionDeploy)
return !isPrerelease;
}
/**
* Was a given platformDeploy workflow run successful on at least one platform?
* Was a given deploy workflow run successful on at least one platform?
*/
async function wasDeploySuccessful(runID) {
const jobsForWorkflowRun = (await GithubUtils_1.default.octokit.actions.listJobsForWorkflowRun({
Expand Down Expand Up @@ -11566,7 +11566,7 @@ async function run() {
const isProductionDeploy = !!(0, ActionUtils_1.getJSONInput)('IS_PRODUCTION_DEPLOY', { required: false }, false);
const deployEnv = isProductionDeploy ? 'production' : 'staging';
console.log(`Looking for PRs deployed to ${deployEnv} in ${inputTag}...`);
const completedDeploys = (await GithubUtils_1.default.octokit.actions.listWorkflowRuns({
const platformDeploys = (await GithubUtils_1.default.octokit.actions.listWorkflowRuns({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
// eslint-disable-next-line @typescript-eslint/naming-convention
Expand All @@ -11576,6 +11576,20 @@ async function run() {
// Note: we filter out cancelled runs instead of looking only for success runs
// because if a build fails on even one platform, then it will have the status 'failure'
.filter((workflowRun) => workflowRun.conclusion !== 'cancelled');
const deploys = (await GithubUtils_1.default.octokit.actions.listWorkflowRuns({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
// eslint-disable-next-line @typescript-eslint/naming-convention
workflow_id: 'deploy.yml',
status: 'completed',
})).data.workflow_runs
// Note: we filter out cancelled runs instead of looking only for success runs
// because if a build fails on even one platform, then it will have the status 'failure'
.filter((workflowRun) => workflowRun.conclusion !== 'cancelled');
// W've combined platformDeploy.yml and deploy.yml
// TODO: Remove this once there are successful staging and production deploys using the new deploy.yml workflow
const completedDeploys = [...deploys, ...platformDeploys];
completedDeploys.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
// Find the most recent deploy workflow targeting the correct environment, for which at least one of the build jobs finished successfully
let lastSuccessfulDeploy = completedDeploys.shift();
if (!lastSuccessfulDeploy) {
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/createHelpRedirects.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
#
# Adds new routes to the Cloudflare Bulk Redirects list for communityDot to helpDot
# pages. Does some basic sanity checking.
# pages. Sanity checking is done upstream in the PRs themselves in verifyRedirect.sh.

set -e

Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/validateActionsAndWorkflows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ for ((i=0; i < ${#WORKFLOWS[@]}; i++)); do
# Skip linting e2e workflow due to bug here: https://github.com/SchemaStore/schemastore/issues/2579
if [[ "$WORKFLOW" == './workflows/e2ePerformanceTests.yml'
|| "$WORKFLOW" == './workflows/testBuild.yml'
|| "$WORKFLOW" == './workflows/platformDeploy.yml' ]]; then
|| "$WORKFLOW" == './workflows/deploy.yml' ]]; then
continue
fi

Expand Down
28 changes: 16 additions & 12 deletions .github/scripts/verifyRedirect.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
#!/bin/bash

# HelpDot - Verifies that redirects.csv does not have any duplicates
# Duplicate sourceURLs break redirection on cloudflare pages
# HelpDot - Verifies that redirects.csv does not have any errors that would prevent
# the bulk redirects in Cloudflare from working. This includes:
# Duplicate sourceURLs
# Source URLs containing anchors or URL params
# URLs pointing to themselves
#
# We also prevent adding source or destination URLs outside of an allowed list
# of domains. That's because these redirects run on our zone as a whole, so you
# could add a redirect for sites outside of help/community and Cloudflare would allow it
# and it would work.

source scripts/shellUtils.sh

declare -r REDIRECTS_FILE="docs/redirects.csv"
declare -a ITEMS_TO_ADD

declare -r RED='\033[0;31m'
declare -r GREEN='\033[0;32m'
declare -r NC='\033[0m'

duplicates=$(awk -F, 'a[$1]++{print $1}' $REDIRECTS_FILE)
if [[ -n "$duplicates" ]]; then
echo "${RED}duplicate redirects are not allowed: $duplicates ${NC}"
echo "${RED}duplicate redirects are not allowed: $duplicates ${RESET}"
exit 1
fi

npm run detectRedirectCycle
DETECT_CYCLE_EXIT_CODE=$?
if [[ DETECT_CYCLE_EXIT_CODE -eq 1 ]]; then
echo -e "${RED}The redirects.csv has a cycle. Please remove the redirect cycle because it will cause an infinite redirect loop ${NC}"
echo -e "${RED}The redirects.csv has a cycle. Please remove the redirect cycle because it will cause an infinite redirect loop ${RESET}"
exit 1
fi

Expand All @@ -46,8 +50,8 @@ while read -r line; do

# Basic sanity checking to make sure that the source and destination are in expected
# subdomains.
if ! [[ $SOURCE_URL =~ ^https://(community|help)\.expensify\.com ]] || [[ $SOURCE_URL =~ \# ]]; then
error "Found source URL that is not a communityDot or helpDot URL, or contains a '#': $SOURCE_URL"
if ! [[ $SOURCE_URL =~ ^https://(community|help)\.expensify\.com ]] || [[ $SOURCE_URL =~ (\#|\?) ]]; then
error "Found source URL that is not a communityDot or helpDot URL, or contains a '#' or '?': $SOURCE_URL"
exit 1
fi

Expand All @@ -66,9 +70,9 @@ done <<< "$(tail +2 $REDIRECTS_FILE)"
# Sanity check that we should actually be running this and we aren't about to delete
# every single redirect.
if [[ "${#ITEMS_TO_ADD[@]}" -lt 1 ]]; then
error "No items found to add, why are we running?"
error "${RED}No items found to add, why are we running?${RESET}"
exit 1
fi

echo -e "${GREEN}The redirects.csv is valid!${NC}"
echo -e "${GREEN}The redirects.csv is valid!${RESET}"
exit 0
Loading

0 comments on commit 39b6311

Please sign in to comment.