Skip to content
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
12 changes: 12 additions & 0 deletions .github/actions/javascript/postTestBuildComment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,36 @@ inputs:
ANDROID:
description: "Android job result ('success', 'failure', 'cancelled', or 'skipped')"
required: false
ANDROID_HYBRID:
description: "Android Hybrid job result ('success', 'failure', 'cancelled', or 'skipped')"
required: false
DESKTOP:
description: "Desktop job result ('success', 'failure', 'cancelled', or 'skipped')"
required: false
IOS:
description: "iOS job result ('success', 'failure', 'cancelled', or 'skipped')"
required: false
IOS_Hybrid:
description: "iOS Hybrid job result ('success', 'failure', 'cancelled', or 'skipped')"
required: false
WEB:
description: "Web job result ('success', 'failure', 'cancelled', or 'skipped')"
required: false
ANDROID_LINK:
description: "Link for the Android build"
required: false
ANDROID_HYBRID_LINK:
description: "Link for the Android Hybrid build"
required: false
DESKTOP_LINK:
description: "Link for the desktop build"
required: false
IOS_LINK:
description: "Link for the iOS build"
required: false
IOS_HYBRID_LINK:
description: "Link for the iOS Hybrid build"
required: false
WEB_LINK:
description: "Link for the web build"
required: false
Expand Down
13 changes: 9 additions & 4 deletions .github/actions/javascript/postTestBuildComment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11502,12 +11502,14 @@ const github_1 = __nccwpck_require__(5438);
const CONST_1 = __importDefault(__nccwpck_require__(9873));
const GithubUtils_1 = __importDefault(__nccwpck_require__(9296));
function getTestBuildMessage() {
const inputs = ['ANDROID', 'DESKTOP', 'IOS', 'WEB'];
const inputs = ['ANDROID', 'ANDROID_HYBRID', 'DESKTOP', 'IOS', 'IOS_HYBRID', 'WEB'];
const names = {
[inputs[0]]: 'Android',
[inputs[1]]: 'Desktop',
[inputs[2]]: 'iOS',
[inputs[3]]: 'Web',
[inputs[1]]: 'Android Hybrid',
[inputs[2]]: 'Desktop',
[inputs[3]]: 'iOS',
[inputs[4]]: 'iOS Hybrid',
[inputs[5]]: 'Web',
};
const result = inputs.reduce((acc, platform) => {
const input = core.getInput(platform, { required: false });
Expand All @@ -11531,6 +11533,9 @@ function getTestBuildMessage() {
| ------------- | ------------- |
| ${result.ANDROID.link} | ${result.IOS.link} |
| ${result.ANDROID.qrCode} | ${result.IOS.qrCode} |
| Android Hybrid :robot::arrows_counterclockwise: | iOS Hybrid :apple::arrows_counterclockwise: |
| ${result.ANDROID_HYBRID.link} | ${result.IOS_HYBRID.link} |
| ${result.ANDROID_HYBRID.qrCode} | ${result.IOS_HYBRID.qrCode} |
| Desktop :computer: | Web :spider_web: |
| ${result.DESKTOP.link} | ${result.WEB.link} |
| ${result.DESKTOP.qrCode} | ${result.WEB.qrCode} |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import CONST from '@github/libs/CONST';
import GithubUtils from '@github/libs/GithubUtils';

function getTestBuildMessage(): string {
const inputs = ['ANDROID', 'DESKTOP', 'IOS', 'WEB'] as const;
const inputs = ['ANDROID', 'ANDROID_HYBRID', 'DESKTOP', 'IOS', 'IOS_HYBRID', 'WEB'] as const;
const names = {
[inputs[0]]: 'Android',
[inputs[1]]: 'Desktop',
[inputs[2]]: 'iOS',
[inputs[3]]: 'Web',
[inputs[1]]: 'Android Hybrid',
[inputs[2]]: 'Desktop',
[inputs[3]]: 'iOS',
[inputs[4]]: 'iOS Hybrid',
[inputs[5]]: 'Web',
};

const result = inputs.reduce((acc, platform) => {
Expand Down Expand Up @@ -40,6 +42,9 @@ function getTestBuildMessage(): string {
| ------------- | ------------- |
| ${result.ANDROID.link} | ${result.IOS.link} |
| ${result.ANDROID.qrCode} | ${result.IOS.qrCode} |
| Android Hybrid :robot::arrows_counterclockwise: | iOS Hybrid :apple::arrows_counterclockwise: |
| ${result.ANDROID_HYBRID.link} | ${result.IOS_HYBRID.link} |
| ${result.ANDROID_HYBRID.qrCode} | ${result.IOS_HYBRID.qrCode} |
| Desktop :computer: | Web :spider_web: |
| ${result.DESKTOP.link} | ${result.WEB.link} |
| ${result.DESKTOP.qrCode} | ${result.WEB.qrCode} |
Expand Down
79 changes: 51 additions & 28 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,42 @@ on:
PULL_REQUEST_NUMBER:
description: Pull Request number for correct placement of apps
required: true
pull_request_target:
types: [opened, synchronize, labeled]
branches: ['*ci-test/**']
WEB:
description: Should build web app?
type: boolean
default: true
DESKTOP:
description: Should build desktop app?
type: boolean
default: true
IOS:
description: Should build iOS app?
type: boolean
default: true
IOS_HYBRID:
description: Should build iOS hybrid app?
type: boolean
default: true
ANDROID:
description: Should build android app?
type: boolean
default: true
ANDROID_HYBRID:
description: Should build android hybrid app?
type: boolean
default: true
Comment on lines +9 to +32

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Those checks allows to select platforms for which app should be build. Not always all platforms are needed so this will help to reduce workflow execution time and cost


env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
# This variable is needed for fastlane to construct correct path
PULL_REQUEST_NUMBER: ${{ github.event.inputs.PULL_REQUEST_NUMBER }}

jobs:
prep:
runs-on: ubuntu-latest
outputs:
REF: ${{ github.event.pull_request.head.sha || steps.getHeadRef.outputs.REF }}
READY_TO_BUILD: ${{ steps.readyToBuild.outputs.READY_TO_BUILD }}
REF: ${{ steps.getHeadRef.outputs.REF }}
steps:
- name: Checkout
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/checkout@v4

- name: Validate that user is an Expensify employee
Expand All @@ -30,21 +50,6 @@ jobs:
REQUIRE_APP_DEPLOYER: false
OS_BOTIFY_TOKEN: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }}

- name: Check if PR has Ready to Build label
id: readyToBuild
run: |
LABELS=$(gh pr view "${{ env.PULL_REQUEST_NUMBER }}" --repo Expensify/App --json labels --jq '.labels[].name')
if echo "$LABELS" | grep -q 'Ready To Build'; then
echo "::notice::✅ PR ${{ env.PULL_REQUEST_NUMBER }} has 'Ready to Build' label"
echo "READY_TO_BUILD=true" >> "$GITHUB_OUTPUT"
else
echo "::error::❌ PR ${{ env.PULL_REQUEST_NUMBER }} does not have 'Ready to Build' label"
echo "READY_TO_BUILD=false" >> "$GITHUB_OUTPUT"
exit 1
fi
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Check if pull request number is correct
if: ${{ github.event_name == 'workflow_dispatch' }}
id: getHeadRef
Expand Down Expand Up @@ -73,13 +78,14 @@ jobs:

buildAndroid:
name: Build Android app for testing
if: ${{ inputs.ANDROID }}
uses: ./.github/workflows/buildAndroid.yml
needs: [prep]
secrets: inherit
with:
type: adhoc
ref: ${{ needs.prep.outputs.REF }}
pull_request_number: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
pull_request_number: ${{ github.event.inputs.PULL_REQUEST_NUMBER }}

uploadAndroid:
name: Upload Android app to S3
Expand Down Expand Up @@ -127,6 +133,7 @@ jobs:

iOS:
name: Build and deploy iOS for testing
if: ${{ inputs.IOS }}
needs: [prep]
env:
DEVELOPER_DIR: /Applications/Xcode_16.2.0.app/Contents/Developer
Expand Down Expand Up @@ -215,6 +222,7 @@ jobs:

desktop:
name: Build and deploy Desktop for testing
if: ${{ inputs.DESKTOP }}
needs: [prep]
runs-on: macos-14-large
steps:
Expand Down Expand Up @@ -265,6 +273,7 @@ jobs:

web:
name: Build and deploy Web
if: ${{ inputs.WEB }}
needs: [prep]
runs-on: ubuntu-latest-xl
steps:
Expand Down Expand Up @@ -295,11 +304,21 @@ jobs:
- name: Deploy to S3 for internal testing
run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://ad-hoc-expensify-cash/web/"$PULL_REQUEST_NUMBER"

buildHybridApps:
name: Build hybrid adhoc apps
uses: ./.github/workflows/testBuildHybrid.yml
needs: [prep]
secrets: inherit
with:
APP_REF: ${{ needs.prep.outputs.REF }}
IOS_HYBRID: ${{ inputs.IOS_HYBRID }}
ANDROID_HYBRID: ${{ inputs.ANDROID_HYBRID }}

postGithubComment:
runs-on: ubuntu-latest
if: always()
name: Post a GitHub comment with app download links for testing
needs: [prep, uploadAndroid, iOS, desktop, web]
if: ${{ always() && needs.prep.outputs.READY_TO_BUILD == 'true' }}
needs: [prep, uploadAndroid, iOS, desktop, web, buildHybridApps]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -323,13 +342,17 @@ jobs:
- name: Publish links to apps for download
uses: ./.github/actions/javascript/postTestBuildComment
with:
PR_NUMBER: ${{ env.PULL_REQUEST_NUMBER }}
PR_NUMBER: ${{ github.event.inputs.PULL_REQUEST_NUMBER }}
GITHUB_TOKEN: ${{ github.token }}
ANDROID: ${{ needs.uploadAndroid.result }}
ANDROID_HYBRID: ${{ needs.buildHybridApps.result }}
DESKTOP: ${{ needs.desktop.result }}
IOS: ${{ needs.iOS.result }}
IOS_HYBRID: ${{ needs.buildHybridApps.result }}
WEB: ${{ needs.web.result }}
ANDROID_LINK: ${{ needs.uploadAndroid.outputs.S3_APK_PATH }}
DESKTOP_LINK: https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/${{ env.PULL_REQUEST_NUMBER }}/NewExpensify.dmg
ANDROID_HYBRID_LINK: ${{ needs.buildHybridApps.outputs.ANDROID_LINK }}
DESKTOP_LINK: https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/${{ github.event.inputs.PULL_REQUEST_NUMBER }}/NewExpensify.dmg
IOS_LINK: ${{ steps.get_ios_path.outputs.ios_path }}
WEB_LINK: https://${{ env.PULL_REQUEST_NUMBER }}.pr-testing.expensify.com
IOS_HYBRID_LINK: ${{ needs.buildHybridApps.outputs.IOS_LINK }}
WEB_LINK: https://${{ github.event.inputs.PULL_REQUEST_NUMBER }}.pr-testing.expensify.com
66 changes: 45 additions & 21 deletions .github/workflows/testBuildHybrid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ on:
description: Pull Request number from Mobile-Expensify repo for correct placement of OD app. It will take precedence over MOBILE-EXPENSIFY from App's PR description if both specified. If nothing is specified defaults to Mobile-Expensify's main
required: false
default: ''
workflow_call:
inputs:
APP_REF:
description: Git ref to checkout in App
type: string
required: true
IOS_HYBRID:
description: Should build iOS app?
type: boolean
default: true
ANDROID_HYBRID:
description: Should build Android app?
type: boolean
default: true

outputs:
ANDROID_LINK:
value: ${{ jobs.androidHybrid.outputs.S3_APK_PATH }}
IOS_LINK:
value: ${{ jobs.iosHybrid.outputs.IOS_PATH }}


env:
# This variable is needed for fastlane to construct correct path
Expand All @@ -24,12 +45,14 @@ jobs:
uses: actions/checkout@v4

- name: Validate that user is an Expensify employee
if: github.event_name == 'workflow_dispatch'
uses: ./.github/actions/composite/validateActor
with:
REQUIRE_APP_DEPLOYER: false
OS_BOTIFY_TOKEN: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }}

- name: Validate input
if: github.event_name == 'workflow_dispatch'
run: |
if [[ -z "${{ github.event.inputs.APP_PULL_REQUEST_NUMBER }}" && -z "${{ github.event.inputs.HYBRIDAPP_PULL_REQUEST_NUMBER }}" ]]; then
echo "Invalid input. You have to pass at least one PR number"
Expand All @@ -49,6 +72,12 @@ jobs:
id: getHeadRef
run: |
set -e

if [[ "${{ github.event_name }}" == "workflow_call " ]]; then
echo "REF=${{ inputs.APP_REF }}" >> "$GITHUB_OUTPUT"
exit 0
fi

if [[ -z "${{ github.event.inputs.APP_PULL_REQUEST_NUMBER }}" ]]; then
echo "REF=" >> "$GITHUB_OUTPUT"
else
Expand Down Expand Up @@ -143,6 +172,7 @@ jobs:

androidHybrid:
name: Build Android HybridApp
if: ${{ github.event_name == 'workflow_dispatch' || inputs.ANDROID_HYBRID }}
needs: [getNewDotRef, getOldDotPR, getOldDotRef]
runs-on: ubuntu-latest-xl
outputs:
Expand Down Expand Up @@ -258,10 +288,13 @@ jobs:

iosHybrid:
name: Build and deploy iOS for testing
if: ${{ github.event_name == 'workflow_dispatch' || inputs.IOS_HYBRID }}
needs: [getNewDotRef, getOldDotPR, getOldDotRef]
env:
DEVELOPER_DIR: /Applications/Xcode_16.2.0.app/Contents/Developer
runs-on: macos-15-xlarge
outputs:
IOS_PATH: ${{ steps.export-ios-path.outputs.IOS_PATH }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -359,36 +392,27 @@ jobs:
S3_BUCKET: ad-hoc-expensify-cash
S3_REGION: us-east-1

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ios
path: ./ios_paths.json
- name: Export iOS path
id: export-ios-path
run: |
content_ios="$(cat ./ios_paths.json)"
content_ios="${content_ios//'%'/'%25'}"
content_ios="${content_ios//$'\n'/'%0A'}"
content_ios="${content_ios//$'\r'/'%0D'}"
ios_path=$(echo "$content_ios" | jq -r '.html_path')
echo "IOS_PATH=$ios_path" >> "$GITHUB_OUTPUT"

postGithubComment:
runs-on: ubuntu-latest
name: Post a GitHub comment with app download links for testing
if: github.event_name == 'workflow_dispatch'
needs: [getNewDotRef, getOldDotPR, androidHybrid, iosHybrid]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.getNewDotRef.outputs.REF }}

- name: Download Artifact
uses: actions/download-artifact@v4

- name: Read JSONs with iOS paths
id: get_ios_path
if: ${{ needs.iosHybrid.result == 'success' }}
run: |
content_ios="$(cat ./ios/ios_paths.json)"
content_ios="${content_ios//'%'/'%25'}"
content_ios="${content_ios//$'\n'/'%0A'}"
content_ios="${content_ios//$'\r'/'%0D'}"
ios_path=$(echo "$content_ios" | jq -r '.html_path')
echo "ios_path=$ios_path" >> "$GITHUB_OUTPUT"

- name: Publish links to apps for download on NewDot PR
if: github.event.inputs.APP_PULL_REQUEST_NUMBER != ''
uses: ./.github/actions/javascript/postTestBuildComment
Expand All @@ -399,7 +423,7 @@ jobs:
ANDROID: ${{ needs.androidHybrid.result }}
IOS: ${{ needs.iosHybrid.result }}
ANDROID_LINK: ${{ needs.androidHybrid.outputs.S3_APK_PATH }}
IOS_LINK: ${{ steps.get_ios_path.outputs.ios_path }}
IOS_LINK: ${{ needs.iosHybrid.outputs.IOS_PATH }}

- name: Publish links to apps for download on OldDot PR
if: needs.getOldDotPR.outputs.OLD_DOT_PR != ''
Expand All @@ -411,4 +435,4 @@ jobs:
ANDROID: ${{ needs.androidHybrid.result }}
IOS: ${{ needs.iosHybrid.result }}
ANDROID_LINK: ${{ needs.androidHybrid.outputs.S3_APK_PATH }}
IOS_LINK: ${{ steps.get_ios_path.outputs.ios_path }}
IOS_LINK: ${{ needs.iosHybrid.outputs.IOS_PATH }}
Loading