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] Hybrid App adhoc builds follow ups #55061

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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

Julesssss marked this conversation as resolved.
Show resolved Hide resolved
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,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to use process.env here otherwise the env is not defined. Fixing it here #55577

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
Loading