diff --git a/.github/workflows/verifyHybridApp.yml b/.github/workflows/verifyHybridApp.yml new file mode 100644 index 000000000000..b3db2c37d4d7 --- /dev/null +++ b/.github/workflows/verifyHybridApp.yml @@ -0,0 +1,141 @@ +name: Verify HybridApp build + +on: + workflow_call: + pull_request: + types: [opened, synchronize] + branches-ignore: [staging, production] + paths: + - '**.kt' + - '**.java' + - '**.swift' + - '**.mm' + - '**.h' + - '**.cpp' + - 'package.json' + - 'patches/**' + - 'android/build.gradle' + - 'android/AndroidManifest.xml' + - 'ios/Podfile.lock' + - 'ios/project.pbxproj' + +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 + 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: 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/setup-ruby@v1.204.0 + 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') }} + + - 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 \ + -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