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 new workflow to validate that HybridApp builds on every commit #55328

Merged
merged 27 commits into from
Jan 27, 2025
Merged
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d3bd9f5
Add new workflow to validate that HybridApp builds on every commit
AndrewGable Jan 15, 2025
45b6c98
Add flags
AndrewGable Jan 16, 2025
8a5620e
Merge branch 'main' into andrew-verify-hybrid
AndrewGable Jan 22, 2025
b7ad7f0
Use fastlane
AndrewGable Jan 22, 2025
5a5acf5
Install ruby on Android runner
AndrewGable Jan 22, 2025
7f2f3ab
Switch task
AndrewGable Jan 22, 2025
3622a01
Use debug scheme
AndrewGable Jan 22, 2025
8c5b4ad
Use configuration instead of scheme for iOS
AndrewGable Jan 22, 2025
05e4a29
Use xcodebuild and gradle manually
AndrewGable Jan 22, 2025
9fc9001
Tweak commands
AndrewGable Jan 22, 2025
621b112
Add RCT_NO_LAUNCH_PACKAGER
AndrewGable Jan 22, 2025
84fbe76
Try setting differently
AndrewGable Jan 22, 2025
63b5dd0
Merge branch 'main' into andrew-verify-hybrid
AndrewGable Jan 22, 2025
51e1482
Update submodule
AndrewGable Jan 23, 2025
1822133
Checkout commit manually
AndrewGable Jan 23, 2025
7ff0979
Use main
AndrewGable Jan 23, 2025
c64c1f5
Install shared js
AndrewGable Jan 23, 2025
c126731
Build ios code
AndrewGable Jan 23, 2025
b636925
Merge branch 'main' into andrew-verify-hybrid
AndrewGable Jan 23, 2025
dcff2a2
Remove bad iOS build code
AndrewGable Jan 23, 2025
ed20005
Fix shell lint
AndrewGable Jan 23, 2025
90e4525
Fix Android shell check lint issues
AndrewGable Jan 23, 2025
a30b7ed
Add paths for HybridApp build to limit number of builds
AndrewGable Jan 24, 2025
bb58023
Merge branch 'main' into andrew-verify-hybrid
AndrewGable Jan 24, 2025
a0b05da
Revert unused changes
AndrewGable Jan 24, 2025
17427b3
Clean up code
AndrewGable Jan 24, 2025
0319348
Update paths
AndrewGable Jan 24, 2025
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
138 changes: 138 additions & 0 deletions .github/workflows/verifyHybridApp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: Verify HybridApp build

on:
workflow_call:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to include workflow_dispatch trigger? workflow_call is for reusable, callable workflows. But we don't have any such usage of this new workflow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove 👍

pull_request:
types: [opened, synchronize]
branches-ignore: [staging, production]
paths:
- '**.kt'
- '**.java'
- '**.swift'
- '**.mm'
- '**.h'
- '**.cpp'
- 'AndroidManifest.xml'
- 'project.pbxproj'
- 'package.json'
AndrewGable marked this conversation as resolved.
Show resolved Hide resolved

concurrency:
group: ${{ github.ref == 'refs/heads/main' && format('{0}-{1}', github.ref, github.sha) || github.ref }}-verify-main
cancel-in-progress: true

jobs:
verify_android:
name: Verify Android HybridApp builds on main
runs-on: ubuntu-latest-xl
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ secrets.OS_BOTIFY_TOKEN }}
# fetch-depth: 0 is required in order to fetch the correct submodule branch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very slow, and most likely not necessary (though a manual git fetch may be necessary in a later step). To start, what happens if we just remove this?

Also, is "the correct submodule branch" just main in Mobile-Expensify?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, is "the correct submodule branch" just main in Mobile-Expensify?

It's a specific Mobile-Expensify commit that is locked to the latest commit as/when each App deploy is done.

Copy link
Contributor

@roryabraham roryabraham Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that the case currently, or will it only be the case once #55403 is completed? Also, where do we store the current commit in Mobile-Expensify which E/App staging and production should point to?

My understanding is that currently all staging and production E/App builds use Mobile-Expensify main, but that there's consensus that this is a problem we need to fix. Am I mistaken?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that currently all staging and production E/App builds use Mobile-Expensify main, but that there's consensus that this is a problem we need to fix. Am I mistaken?

Yeah, on each App staging build we bump the submodule to the latest commit (see every other commit here).

The problem is that this leads to Mobile-Expensify changes that can break an App release candidate late in a checklist that can break the build without us realising. To solve that we plan to lock the Mobile-Expensify commit for the full checklist -- but we'll give ourselves the option to override this if we need to.

fetch-depth: 0

- name: Update submodule to match main
run: |
git submodule update --init --remote
git fetch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also yucky. I feel like what we want is more like this:

git submodule update --init --remote --depth 1

git checkout main
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, you're checking out the main branch of E/App, right? Is that what we want?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't think so.

@AndrewGable I think you forgot to do cd Mobile-Expensify first.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will include in follow up


- name: Configure MapBox SDK
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}

- name: Setup Node
id: setup-node
uses: ./.github/actions/composite/setupNode
with:
IS_HYBRID_BUILD: 'true'

- name: Build Android Debug
working-directory: Mobile-Expensify/Android
run: |
if ! ./gradlew assembleDebug
then
echo "❌ Android HybridApp failed to build: Please reach out to Contributor+ and/or Expensify engineers for help in #expensify-open-source to resolve."
exit 1
fi

verify_ios:
name: Verify iOS HybridApp builds on main
runs-on: macos-15-xlarge
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ secrets.OS_BOTIFY_TOKEN }}
# fetch-depth: 0 is required in order to fetch the correct submodule branch
fetch-depth: 0

- name: Update submodule to match main
run: |
git submodule update --init --remote
git fetch
git checkout main

- name: Configure MapBox SDK
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}

- name: Setup Node
id: setup-node
uses: ./.github/actions/composite/setupNode
with:
IS_HYBRID_BUILD: 'true'

- name: Setup Ruby
uses: ruby/[email protected]
with:
bundler-cache: true

- name: Install New Expensify Gems
run: bundle install

- name: Cache Pod dependencies
uses: actions/cache@v4
id: pods-cache
with:
path: Mobile-Expensify/iOS/Pods
key: ${{ runner.os }}-pods-cache-${{ hashFiles('Mobile-Expensify/iOS/Podfile.lock', 'firebase.json') }}
AndrewGable marked this conversation as resolved.
Show resolved Hide resolved

- name: Compare Podfile.lock and Manifest.lock
id: compare-podfile-and-manifest
run: echo "IS_PODFILE_SAME_AS_MANIFEST=${{ hashFiles('Mobile-Expensify/iOS/Podfile.lock') == hashFiles('Mobile-Expensify/iOS/Manifest.lock') }}" >> "$GITHUB_OUTPUT"

- name: Install cocoapods
uses: nick-fields/retry@3f757583fb1b1f940bc8ef4bf4734c8dc02a5847
if: steps.pods-cache.outputs.cache-hit != 'true' || steps.compare-podfile-and-manifest.outputs.IS_PODFILE_SAME_AS_MANIFEST != 'true' || steps.setup-node.outputs.cache-hit != 'true'
with:
timeout_minutes: 10
max_attempts: 5
command: npm run pod-install

- name: Build iOS HybridApp
run: |
# Let us know if the builds fails
set -o pipefail

# Do not start metro
export RCT_NO_LAUNCH_PACKAGER=1

# Build iOS using xcodebuild
if ! xcodebuild \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NABish but maybe create a Fastlane lane for this build command?

-workspace Mobile-Expensify/iOS/Expensify.xcworkspace \
-scheme Expensify \
-configuration Debug \
-sdk iphonesimulator \
-arch x86_64 \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO \
build | xcpretty
then
echo "❌ iOS HybridApp failed to build: Please reach out to Contributor+ and/or Expensify engineers for help in #expensify-open-source to resolve."
exit 1
fi
Loading