Skip to content
Closed
49 changes: 26 additions & 23 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: Build and deploy apps for testing

on:
workflow_dispatch:
inputs:
PULL_REQUEST_NUMBER:
description: Pull Request number for correct placement of apps
required: true
pull_request_target:
types: [opened, synchronize, labeled]
branches: ['*ci-test/**']
Expand All @@ -30,12 +26,12 @@ jobs:
- id: hasReadyToBuildLabel
name: Set HAS_READY_TO_BUILD_LABEL flag
run: |
echo "HAS_READY_TO_BUILD_LABEL=$(gh pr view "${{ env.PULL_REQUEST_NUMBER }}" --repo Expensify/App --json labels --jq '.labels[].name' | grep -q 'Ready To Build' && echo 'true')" >> "$GITHUB_OUTPUT"
echo "HAS_READY_TO_BUILD_LABEL=$(gh pr view 45347 --repo Expensify/App --json labels --jq '.labels[].name' | grep -q 'Ready To Build' && echo 'true')" >> "$GITHUB_OUTPUT"
if [[ "$HAS_READY_TO_BUILD_LABEL" != 'true' ]]; then
echo "The 'Ready to Build' label is not attached to the PR #${{ env.PULL_REQUEST_NUMBER }}"
echo "The 'Ready to Build' label is not attached to the PR"
fi
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
PULL_REQUEST_NUMBER: 45347
GITHUB_TOKEN: ${{ github.token }}

getBranchRef:
Expand All @@ -54,7 +50,7 @@ jobs:
id: getHeadRef
run: |
set -e
gh pr checkout ${{ github.event.inputs.PULL_REQUEST_NUMBER }}
gh pr checkout 45347
echo "REF=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -65,7 +61,7 @@ jobs:
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
runs-on: ubuntu-latest-xl
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
PULL_REQUEST_NUMBER: 45347
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -76,7 +72,7 @@ jobs:
run: |
cp .env.staging .env.adhoc
sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
echo "PULL_REQUEST_NUMBER=45347" >> .env.adhoc

- name: Setup Node
uses: ./.github/actions/composite/setupNode
Expand All @@ -90,8 +86,15 @@ jobs:
- name: Setup Ruby
uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011
with:
ruby-version: '2.7'
bundler-cache: true
ruby-version: '3.3'
bundler-cache: false

- name: Setup fastlane
id: set_up_fastlane
run: |
gem install bundler -v 2.4.22
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3

- name: Decrypt keystore
run: cd android/app && gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output my-upload-key.keystore my-upload-key.keystore.gpg
Expand Down Expand Up @@ -135,7 +138,7 @@ jobs:
needs: [validateActor, getBranchRef]
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
PULL_REQUEST_NUMBER: 45347
DEVELOPER_DIR: /Applications/Xcode_15.0.1.app/Contents/Developer
runs-on: macos-13-xlarge
steps:
Expand All @@ -151,7 +154,7 @@ jobs:
run: |
cp .env.staging .env.adhoc
sed -i '' 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
echo "PULL_REQUEST_NUMBER=45347" >> .env.adhoc

- name: Setup Node
id: setup-node
Expand Down Expand Up @@ -227,7 +230,7 @@ jobs:
needs: [validateActor, getBranchRef]
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
PULL_REQUEST_NUMBER: 45347
runs-on: macos-14-large
steps:
- name: Checkout
Expand All @@ -239,7 +242,7 @@ jobs:
run: |
cp .env.staging .env.adhoc
sed -i '' 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
echo "PULL_REQUEST_NUMBER=45347" >> .env.adhoc

- name: Setup Node
uses: ./.github/actions/composite/setupNode
Expand Down Expand Up @@ -272,7 +275,7 @@ jobs:
needs: [validateActor, getBranchRef]
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
PULL_REQUEST_NUMBER: 45347
runs-on: ubuntu-latest-xl
steps:
- name: Checkout
Expand All @@ -284,7 +287,7 @@ jobs:
run: |
cp .env.staging .env.adhoc
sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
echo "PULL_REQUEST_NUMBER=45347" >> .env.adhoc

- name: Setup Node
uses: ./.github/actions/composite/setupNode
Expand All @@ -304,15 +307,15 @@ jobs:
continue-on-error: true

- 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"
run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://ad-hoc-expensify-cash/web/45347"

postGithubComment:
runs-on: ubuntu-latest
name: Post a GitHub comment with app download links for testing
needs: [validateActor, getBranchRef, android, iOS, desktop, web]
if: ${{ always() }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
PULL_REQUEST_NUMBER: 45347
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -350,13 +353,13 @@ jobs:
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
uses: ./.github/actions/javascript/postTestBuildComment
with:
PR_NUMBER: ${{ env.PULL_REQUEST_NUMBER }}
PR_NUMBER: 45347
GITHUB_TOKEN: ${{ github.token }}
ANDROID: ${{ needs.android.result }}
DESKTOP: ${{ needs.desktop.result }}
IOS: ${{ needs.iOS.result }}
WEB: ${{ needs.web.result }}
ANDROID_LINK: ${{steps.get_android_path.outputs.android_path}}
DESKTOP_LINK: https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/${{ env.PULL_REQUEST_NUMBER }}/NewExpensify.dmg
DESKTOP_LINK: https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/45347/NewExpensify.dmg
IOS_LINK: ${{steps.get_ios_path.outputs.ios_path}}
WEB_LINK: https://${{ env.PULL_REQUEST_NUMBER }}.pr-testing.expensify.com
WEB_LINK: https://45347.pr-testing.expensify.com