Skip to content

Commit 4b7a275

Browse files
committed
Merge remote-tracking branch 'upstream/main' into perf/recalculate-changed-options
2 parents bc2ad1b + 069891a commit 4b7a275

357 files changed

Lines changed: 9825 additions & 3489 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ This is a checklist for PR authors. Please make sure to complete all tasks and c
8787
- [ ] MacOS: Chrome / Safari
8888
- [ ] MacOS: Desktop
8989
- [ ] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
90+
- [ ] I verified there are no new alerts related to the `canBeMissing` param for `useOnyx`
9091
- [ ] I followed proper code patterns (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
9192
- [ ] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. `toggleReport` and not `onIconClick`)
9293
- [ ] I verified that comments were added to code that is not self explanatory

.github/actions/composite/announceFailedWorkflowInSlack/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ inputs:
55
SLACK_WEBHOOK:
66
description: 'URL of the slack webhook'
77
required: true
8+
CHANNEL:
9+
description: 'Slack channel to post announcement in'
10+
required: false
11+
default: '#announce'
812

913
runs:
1014
using: composite
@@ -16,7 +20,7 @@ runs:
1620
fields: workflow, repo
1721
custom_payload: |
1822
{
19-
channel: '#announce',
23+
channel: '${{ inputs.CHANNEL }}',
2024
attachments: [{
2125
color: "#DB4545",
2226
pretext: `<!subteam^S4TJJ3PSL>`,
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
if [ -z "$GITHUB_TOKEN" ]; then
4+
echo "GITHUB_TOKEN env variable is not set"
5+
exit 1
6+
fi
7+
8+
if [[ "$IS_HYBRID_BUILD" == "true" ]]; then
9+
readonly PACKAGE="react-hybrid"
10+
else
11+
readonly PACKAGE="react-standalone"
12+
fi
13+
14+
VERSION="$(jq -r '.dependencies["react-native"]' package.json)"
15+
readonly VERSION
16+
17+
# List all versions of the package
18+
PACKAGE_VERSIONS="$(gh api "/orgs/Expensify/packages/maven/com.expensify.${PACKAGE}.react-android/versions" --paginate --jq '.[].name')"
19+
20+
# Filter only versions matching the base React Native version
21+
PACKAGE_VERSIONS="$(echo "$PACKAGE_VERSIONS" | grep "$VERSION")"
22+
23+
# Grab the highest patch version from there
24+
LATEST_PATCHED_VERSION="$(echo "$PACKAGE_VERSIONS" | sort | tail -n1)"
25+
26+
if [[ -n "$LATEST_PATCHED_VERSION" ]]; then
27+
PATCH_ITERATION=${LATEST_PATCHED_VERSION##*-}
28+
INCREMENTED_PATCH_ITERATION=$((PATCH_ITERATION + 1))
29+
echo "${VERSION}-${INCREMENTED_PATCH_ITERATION}"
30+
else
31+
echo "$VERSION-0"
32+
fi

.github/workflows/cherryPick.yml

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,43 @@ jobs:
1616
needs: createNewVersion
1717
runs-on: ubuntu-latest
1818
steps:
19-
- name: Checkout staging branch
20-
# v4
21-
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
22-
with:
23-
ref: staging
24-
token: ${{ secrets.OS_BOTIFY_TOKEN }}
25-
submodules: true
26-
2719
- name: Extract PR information
2820
id: getPRInfo
2921
run: |
30-
echo "REPO_FULL_NAME=$(echo '${{ github.event.inputs.PULL_REQUEST_URL }}' | sed -E 's|https://github.com/([^/]+/[^/]+)/pull/.*|\1|')" >> "$GITHUB_OUTPUT"
22+
echo "REPO_FULL_NAME=$(echo '${{ github.event.inputs.PULL_REQUEST_URL }}' | sed -E 's|https?://github.com/([^/]+/[^/]+)/pull/.*|\1|')" >> "$GITHUB_OUTPUT"
3123
echo "PR_NUMBER=$(echo '${{ github.event.inputs.PULL_REQUEST_URL }}' | sed -E 's|.*/pull/([0-9]+).*|\1|')" >> "$GITHUB_OUTPUT"
3224
3325
- name: Verify repository
3426
run: |
35-
if [ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/App" ]; then
36-
echo "::error::❌ Cherry picks are only supported for the Expensify/App repository. Found: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}"
27+
if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != ${{ github.repository }} ]] && [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/Mobile-Expensify" ]]; then
28+
echo "::error::❌ Cherry picks are only supported for the Expensify/App and Expensify/Mobile-Expensify repositories. Found: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}"
3729
exit 1
3830
fi
3931
4032
- name: Set conflict branch name
4133
id: getBranchName
4234
run: echo "CONFLICT_BRANCH_NAME=cherry-pick-staging-${{ steps.getPRInfo.outputs.PR_NUMBER }}-${{ github.run_id }}-${{ github.run_attempt }}" >> "$GITHUB_OUTPUT"
4335

36+
- name: Checkout staging branch with full history if cherry picking Mobile-Expensify
37+
if: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify' }}
38+
# v4
39+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
40+
with:
41+
ref: staging
42+
token: ${{ secrets.OS_BOTIFY_TOKEN }}
43+
submodules: true
44+
# Only fetch depth 0 for Mobile-Expensify, because it's a submodule and we need more history to cherry pick successfully
45+
fetch-depth: 0
46+
47+
- name: Checkout staging branch without full history if cherry picking App
48+
if: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/App' }}
49+
# v4
50+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
51+
with:
52+
ref: staging
53+
token: ${{ secrets.OS_BOTIFY_TOKEN }}
54+
submodules: true
55+
4456
# This command is necessary to fetch any branch other than main in the submodule.
4557
# See https://github.com/actions/checkout/issues/1815#issuecomment-2777836442 for further context.
4658
- name: Enable branch-switching in submodules
@@ -64,15 +76,15 @@ jobs:
6476
with:
6577
SEMVER_LEVEL: "PATCH"
6678

67-
- name: Fetch history of relevant refs
79+
- name: Fetch history of relevant refs if cherry picking an App change
80+
if: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/App' }}
6881
run: |
6982
# Temporary hack during transition when -staging suffix is being added to tags
7083
if git ls-remote origin refs/tags/${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} | grep -q . ; then
7184
git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}
7285
else
7386
git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}-staging
7487
fi
75-
7688
cd Mobile-Expensify
7789
# Temporary hack during transition when -staging suffix is being added to tags
7890
if git ls-remote origin refs/tags/${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} | grep -q . ; then
@@ -108,13 +120,14 @@ jobs:
108120
fi
109121
echo "VERSION_BUMP_SHA=$VERSION_BUMP_COMMIT" >> "$GITHUB_OUTPUT"
110122
111-
- name: Get merge commit for E/App pull request to CP
123+
- name: Get merge commit for pull request to CP
112124
id: getCPMergeCommit
113-
uses: ./.github/actions/javascript/getPullRequestDetails
114-
with:
115-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116-
USER: ${{ github.actor }}
117-
PULL_REQUEST_NUMBER: ${{ steps.getPRInfo.outputs.PR_NUMBER }}
125+
run: |
126+
read -r MERGE_COMMIT_SHA MERGE_ACTOR <<< "$(gh pr view ${{ github.event.inputs.PULL_REQUEST_URL }} --json mergeCommit,author --jq '"\(.mergeCommit.oid) \(.author.login)"')"
127+
echo "MERGE_COMMIT_SHA=$MERGE_COMMIT_SHA" >> "$GITHUB_OUTPUT"
128+
echo "MERGE_ACTOR=$MERGE_ACTOR" >> "$GITHUB_OUTPUT"
129+
env:
130+
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
118131

119132
- name: Cherry-pick the Mobile-Expensify version bump to Mobile-Expensify staging
120133
working-directory: Mobile-Expensify
@@ -135,6 +148,8 @@ jobs:
135148
136149
- name: Cherry-pick the merge commit of target PR
137150
id: cherryPick
151+
# If cherry picking a Mobile-Expensify change, we need to run the cherry pick in the Mobile-Expensify directory
152+
working-directory: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify' && 'Mobile-Expensify' || '.' }}
138153
run: |
139154
echo "Attempting to cherry-pick ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}"
140155
if git cherry-pick -S -x --mainline 1 ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}; then
@@ -154,6 +169,18 @@ jobs:
154169
git checkout -b ${{ steps.getBranchName.outputs.CONFLICT_BRANCH_NAME }}
155170
git push --set-upstream origin ${{ steps.getBranchName.outputs.CONFLICT_BRANCH_NAME }}
156171
else
172+
if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify" ]]; then
173+
# Push Mobile-Expensify changes first
174+
cd Mobile-Expensify
175+
git push origin staging
176+
cd ..
177+
178+
# Update and commit the submodule reference in E/App
179+
git add Mobile-Expensify
180+
git commit -m "Update Mobile-Expensify submodule to include cherry-picked PR #${{ steps.getPRInfo.outputs.PR_NUMBER }}"
181+
fi
182+
183+
# Push E/App changes
157184
git push origin staging
158185
fi
159186
@@ -212,9 +239,9 @@ jobs:
212239
continue-on-error: true
213240

214241
- name: Label original PR with CP Staging
215-
run: gh pr edit ${{ github.event.inputs.PULL_REQUEST_URL }} --add-label 'CP Staging'
242+
run: gh pr edit ${{ github.event.inputs.PULL_REQUEST_URL }} --add-label 'CP Staging'
216243
env:
217-
GITHUB_TOKEN: ${{ github.token }}
244+
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
218245

219246
- name: "Announces a CP failure in the #announce Slack room"
220247
# v3
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
name: Publish React Native Android Artifacts
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- package.json
9+
- patches/react-native+*.patch
10+
- patches/@react-native+*.patch
11+
- Mobile-Expensify
12+
13+
jobs:
14+
publish:
15+
runs-on: ${{ github.repository_owner == 'Expensify' && 'ubuntu-latest-xl' || 'ubuntu-latest' }}
16+
strategy:
17+
matrix:
18+
is_hybrid: [true, false]
19+
steps:
20+
# v4
21+
- name: Checkout
22+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
23+
with:
24+
submodules: ${{ matrix.is_hybrid }}
25+
ref: ${{ github.event.before }}
26+
token: ${{ secrets.OS_BOTIFY_TOKEN }}
27+
28+
- name: Get previous App commit hash
29+
id: getOldAppHash
30+
run: echo "HASH=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
31+
32+
- name: Get previous Mobile-Expensify commit hash
33+
if: ${{ matrix.is_hybrid == 'true' }}
34+
id: getOldMobileExpensifyHash
35+
run: echo "HASH=$(git rev-parse :Mobile-Expensify)" >> "$GITHUB_OUTPUT"
36+
37+
- name: Get previous react-native version
38+
id: getOldVersion
39+
run: echo "VERSION=$(jq -r '.dependencies["react-native"]' package.json)" >> "$GITHUB_OUTPUT"
40+
41+
- name: Checkout new ref
42+
run: |
43+
git fetch origin ${{ github.event.after }} --depth=1
44+
git checkout ${{ github.event.after }}
45+
git submodule update
46+
47+
- name: Get new App commit hash
48+
id: getNewAppHash
49+
run: echo "HASH=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
50+
51+
- name: Get new Mobile-Expensify commit hash
52+
if: ${{ matrix.is_hybrid == 'true' }}
53+
id: getNewMobileExpensifyHash
54+
run: echo "HASH=$(git rev-parse :Mobile-Expensify)" >> "$GITHUB_OUTPUT"
55+
56+
- name: Get new react-native version
57+
id: getNewVersion
58+
run: echo "VERSION=$(jq -r '.dependencies["react-native"]' package.json)" >> "$GITHUB_OUTPUT"
59+
60+
- name: Check if version changed
61+
id: didVersionChange
62+
run: |
63+
readonly DID_VERSION_CHANGE=${{ steps.getOldVersion.outputs.VERSION != steps.getNewVersion.outputs.VERSION && 'true' || 'false' }}
64+
echo "DID_VERSION_CHANGE=$DID_VERSION_CHANGE" >> "$GITHUB_OUTPUT"
65+
if [[ "$DID_VERSION_CHANGE" == 'true' ]]; then
66+
echo "::notice::Detected react-native version bump (${{ steps.getOldVersion.outputs.VERSION }} -> ${{ steps.getNewVersion.outputs.VERSION }})"
67+
fi
68+
69+
- name: Check if patches changed
70+
id: didPatchesChange
71+
run: |
72+
if git diff --exit-code --name-only ${{ steps.getOldAppHash.outputs.HASH }}..${{ steps.getNewAppHash.outputs.HASH }} -- patches/react-native+*.patch patches/@react-native+*.patch; then
73+
echo "::notice::Detected changes in patches"
74+
echo "DID_PATCHES_CHANGE=true" >> "$GITHUB_OUTPUT"
75+
exit 0
76+
fi
77+
78+
if [[ '${{ matrix.is_hybrid }}' == 'true' ]]; then
79+
if git -C Mobile-Expensify diff --exit-code --name-only ${{ steps.getOldMobileExpensifyHash.outputs.HASH }}..${{ steps.getNewMobileExpensifyHash.outputs.HASH }} -- patches/react-native+*.patch patches/@react-native+*.patch; then
80+
echo "::notice::Detected changes in patches"
81+
echo "DID_PATCHES_CHANGE=true" >> "$GITHUB_OUTPUT"
82+
exit 0
83+
fi
84+
fi
85+
86+
echo "DID_PATCHES_CHANGE=false" >> "$GITHUB_OUTPUT"
87+
88+
- name: Check if we should build and publish the package
89+
id: shouldPublish
90+
run: |
91+
if [[ '${{ steps.didVersionChange.outputs.DID_VERSION_CHANGE }}' == 'true' || '${{ steps.didPatchesChange.outputs.DID_PATCHES_CHANGE }}' == 'true' ]]; then
92+
echo "SHOULD_PUBLISH=true" >> "$GITHUB_OUTPUT"
93+
else
94+
echo "::notice::No relevant changes, skipping publishing a new React Native build"
95+
echo "SHOULD_PUBLISH=false" >> "$GITHUB_OUTPUT"
96+
fi
97+
98+
- name: Setup Node
99+
if: ${{ steps.shouldPublish.outputs.SHOULD_PUBLISH == 'true' }}
100+
uses: ./.github/actions/composite/setupNode
101+
with:
102+
IS_HYBRID_BUILD: ${{ matrix.is_hybrid }}
103+
104+
# v4
105+
- name: Setup Java
106+
if: ${{ steps.shouldPublish.outputs.SHOULD_PUBLISH == 'true' }}
107+
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12
108+
with:
109+
distribution: oracle
110+
java-version: 17
111+
112+
# v4
113+
- name: Setup Gradle
114+
if: ${{ steps.shouldPublish.outputs.SHOULD_PUBLISH == 'true' }}
115+
uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244
116+
117+
- name: Determine new patched RN version
118+
if: ${{ steps.shouldPublish.outputs.SHOULD_PUBLISH == 'true' }}
119+
id: getNewPatchedVersion
120+
run: echo "NEW_PATCHED_VERSION=$(./.github/scripts/getNewPatchedRNVersion.sh)" >> "$GITHUB_OUTPUT"
121+
env:
122+
GITHUB_TOKEN: ${{ github.token }}
123+
IS_HYBRID_BUILD: ${{ matrix.is_hybrid }}
124+
125+
- name: Build and publish RN artifacts
126+
if: ${{ steps.shouldPublish.outputs.SHOULD_PUBLISH == 'true' }}
127+
working-directory: ${{ matrix.is_hybrid == 'true' && 'Mobile-Expensify/Android' || 'android' }}
128+
run: |
129+
echo "Starting artifacts build for ${{ matrix.is_hybrid == 'true' && 'HybridApp' || 'NewDot Standalone' }}"
130+
echo "Version: ${{ env.PATCHED_VERSION }}"
131+
echo "Commit hash: ${{ env.COMMIT_HASH }}"
132+
export ORG_GRADLE_PROJECT_reactNativeArchitectures="armeabi-v7a,arm64-v8a,x86,x86_64"
133+
./gradlew buildReactNativeArtifacts -x lint -x test -x check
134+
./gradlew publishReactNativeArtifacts
135+
env:
136+
GH_PUBLISH_ACTOR: ${{ github.actor }}
137+
GH_PUBLISH_TOKEN: ${{ github.token }}
138+
IS_HYBRID_BUILD: ${{ matrix.is_hybrid }}
139+
PATCHED_VERSION: ${{ steps.getNewPatchedVersion.outputs.NEW_PATCHED_VERSION }}
140+
COMMIT_HASH: ${{ github.event.after }}
141+
142+
- name: Announce failed workflow in Slack
143+
if: ${{ failure() }}
144+
uses: ./.github/actions/composite/announceFailedWorkflowInSlack
145+
with:
146+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
147+
CHANNEL: '#expensify-open-source'

.github/workflows/testBuildHybrid.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ jobs:
125125
script: |
126126
if ('${{ github.event.inputs.HYBRIDAPP_PULL_REQUEST_NUMBER}}') return '${{ github.event.inputs.HYBRIDAPP_PULL_REQUEST_NUMBER}}';
127127
128-
if (!'${{ github.event.inputs.APP_PULL_REQUEST_NUMBER }}') return '';
128+
if (!'${{ github.event.inputs.APP_PULL_REQUEST_NUMBER }}' && !'${{ inputs.APP_PR_NUMBER }}') return '';
129129
130130
const pullRequest = await github.rest.pulls.get({
131131
owner: context.repo.owner,
132132
repo: context.repo.repo,
133-
pull_number: '${{ github.event.inputs.APP_PULL_REQUEST_NUMBER }}',
133+
pull_number: '${{ github.event.inputs.APP_PULL_REQUEST_NUMBER || inputs.APP_PR_NUMBER }}',
134134
});
135135
136136
const body = pullRequest.data.body;

Mobile-Expensify

0 commit comments

Comments
 (0)