Skip to content

Commit

Permalink
Merge pull request #55061 from software-mansion-labs/jnowakow/adhoc-h…
Browse files Browse the repository at this point in the history
…ybrid-follow-ups

[No QA] Hybrid App adhoc builds follow ups

(cherry picked from commit 51efa26)

(CP triggered by Julesssss)
  • Loading branch information
Julesssss authored and OSBotify committed Jan 21, 2025
1 parent 9d9a60f commit e2ec981
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 21 deletions.
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ $
PROPOSAL:


<!---
If you want to trigger adhoc build of hybrid app from specific Mobile-Expensify PR please specify it like follows:
MOBILE-EXPENSIFY: PR number
--->

### Tests
<!---
Add a numbered list of manual tests you performed that validates your changes work on all platforms, and that there are no regressions present.
Expand Down
78 changes: 59 additions & 19 deletions .github/workflows/testBuildHybrid.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
name: Build and deploy hybird apps for testing
name: Build and deploy hybrid apps for testing

on:
workflow_dispatch:
inputs:
PULL_REQUEST_NUMBER:
description: Pull Request number for correct placement of apps
required: true
OLD_DOT_COMMIT:
description: The branch, tag or SHA to checkout on Old Dot side
required: false
pull_request_target:
types: [opened, synchronize, labeled]
branches: ['*ci-test/**']

env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
OLD_DOT_COMMIT: ${{ github.event.inputs.OLD_DOT_COMMIT }}

jobs:
validateActor:
Expand Down Expand Up @@ -63,6 +59,48 @@ jobs:
echo "REF=$(gh pr view ${{ github.event.inputs.PULL_REQUEST_NUMBER }} --json headRefOid --jq '.headRefOid')" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

getOldDotPR:
runs-on: ubuntu-latest
needs: validateActor
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
outputs:
OLD_DOT_PR: ${{ steps.old-dot-pr.outputs.result }}
steps:
- name: Check if author specifed Old Dot PR
id: old-dot-pr
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
result-encoding: string
script: |
const pullRequest = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: env.PULL_REQUEST_NUMBER,
});
const body = pullRequest.data.body;
const regex = /MOBILE-EXPENSIFY:(?<prNumber>.*)/;
const found = body.match(regex)?.groups?.prNumber || "";
return found.trim();
getOldDotBranchRef:
runs-on: ubuntu-latest
needs: getOldDotPR
if: ${{ needs.getOldDotPR.outputs.OLD_DOT_PR != '' }}
outputs:
OLD_DOT_REF: ${{ steps.getHeadRef.outputs.REF }}
steps:
- name: Check if pull request number is correct
id: getHeadRef
run: |
set -e
echo "REF=$(gh pr view ${{ needs.getOldDotPR.outputs.OLD_DOT_PR }} --json headRefOid --jq '.headRefOid')" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


postGitHubCommentBuildStarted:
runs-on: ubuntu-latest
Expand All @@ -84,7 +122,7 @@ jobs:
androidHybrid:
name: Build Android HybridApp
needs: [validateActor, getBranchRef]
needs: [validateActor, getBranchRef, getOldDotBranchRef]
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
runs-on: ubuntu-latest-xl
outputs:
Expand All @@ -100,15 +138,16 @@ jobs:
fetch-depth: 0

- name: Update submodule to match main
env:
OLD_DOT_COMMIT: ${{ env.OLD_DOT_COMMIT }}
run: |
git submodule update --init --remote
if [[ -z "$OLD_DOT_COMMIT" ]]; then
git fetch
git checkout ${{ env.OLD_DOT_COMMIT }}
fi
- name: Checkout Old Dot to author specified branch or commit
if: ${{ needs.getOldDotBranchRef.outputs.OLD_DOT_REF != '' }}
run: |
cd Mobile-Expensify
git fetch
git checkout ${{ needs.getOldDotBranchRef.outputs.OLD_DOT_REF }}
- name: Configure MapBox SDK
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}

Expand Down Expand Up @@ -194,7 +233,7 @@ jobs:
iosHybrid:
name: Build and deploy iOS for testing
needs: [validateActor, getBranchRef]
needs: [validateActor, getBranchRef, getOldDotBranchRef]
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
env:
DEVELOPER_DIR: /Applications/Xcode_16.2.0.app/Contents/Developer
Expand All @@ -210,14 +249,15 @@ jobs:
fetch-depth: 0

- name: Update submodule to match main
env:
OLD_DOT_COMMIT: ${{ env.OLD_DOT_COMMIT }}
run: |
git submodule update --init --remote
if [[ -z "$OLD_DOT_COMMIT" ]]; then
git fetch
git checkout ${{ env.OLD_DOT_COMMIT }}
fi
- name: Checkout Old Dot to author specified branch or commit
if: ${{ needs.getOldDotBranchRef.outputs.OLD_DOT_REF != '' }}
run: |
cd Mobile-Expensify
git fetch
git checkout ${{ needs.getOldDotBranchRef.outputs.OLD_DOT_REF }}
- name: Configure MapBox SDK
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions scripts/run-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ NEW_DOT_FLAG="${STANDALONE_NEW_DOT:-false}"
# Set HybridApp-specific arguments
IOS_MODE="Debug"
ANDROID_MODE="Debug"
SCHEME="Expensify"
APP_ID="org.me.mobiexpensifyg"
SCHEME="Expensify Dev"
APP_ID="org.me.mobiexpensifyg.dev"

echo -e "\n${GREEN}Starting a HybridApp build!${NC}"
PROJECT_ROOT_PATH="Mobile-Expensify/"
Expand Down

0 comments on commit e2ec981

Please sign in to comment.