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] Callable buildAndroid workflow #49434

Merged
merged 46 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8ef859c
Remove unused VERSION environment variables
roryabraham Sep 18, 2024
a449e56
Save draft state
roryabraham Sep 18, 2024
e2d2dfb
Create and use callable buildAndroid workflow
roryabraham Sep 19, 2024
281d558
Add quotes in case statement
roryabraham Sep 19, 2024
bb94f92
Simplify environment variable names
roryabraham Sep 19, 2024
b09fc11
Separate upload and submit step for Android deploys
roryabraham Sep 19, 2024
5aa4d48
Add continue-on-error for artifact upload steps
roryabraham Sep 20, 2024
a5a8a4b
Merge branch 'main' into Rory-CallableBuild
roryabraham Sep 20, 2024
c165fd4
Merge branch 'main' into Rory-CallableBuild
roryabraham Sep 25, 2024
019fcb2
Fix checkDeploymentSuccess job
roryabraham Sep 25, 2024
6235d41
Fix needs for other jobs
roryabraham Sep 25, 2024
00ffdda
Implement buildAndroid job in testBuild
roryabraham Sep 25, 2024
21e2ecb
Merge branch 'main' into Rory-CallableBuild
roryabraham Sep 26, 2024
e4c568e
Setup dotenv for e2e and e2eDelta builds
roryabraham Sep 26, 2024
87b7ca1
Add artifact-prefix input
roryabraham Sep 26, 2024
5146322
Refactor e2ePerformanceTests to use callable builds
roryabraham Sep 26, 2024
7e3c936
Delete now-unused buildAndroidE2EAPK composite action
roryabraham Sep 26, 2024
48336e3
Use correct variable when checking if all platforms were a success
roryabraham Sep 26, 2024
011e8d8
Add better comment for creating branch
roryabraham Sep 26, 2024
581c2c6
Fix actionslint
roryabraham Sep 26, 2024
01ed4b1
echo debug paths
roryabraham Sep 26, 2024
ed66629
Fix android e2eDelta lane name
roryabraham Sep 26, 2024
1ec6555
Fix typo
roryabraham Sep 26, 2024
25c54ac
Add back missing do
roryabraham Sep 26, 2024
9cb7974
Merge branch 'main' into Rory-CallableBuild
roryabraham Oct 1, 2024
45a589d
Source GITHUB_ENV before trying to access env vars set in fastlane in…
roryabraham Oct 1, 2024
3cae22f
fix artifact paths
roryabraham Oct 1, 2024
7b73ba5
Add missing setup-ruby step
roryabraham Oct 1, 2024
5a4a734
Add missing checkout
roryabraham Oct 1, 2024
bedb860
Add missing env var for upload prod
roryabraham Oct 2, 2024
ab797cd
Fix downloaded artifact paths
roryabraham Oct 2, 2024
eb969cc
Remove some redundant debug logs
roryabraham Oct 2, 2024
feced84
Remove unnecessary artifact download step
roryabraham Oct 2, 2024
50e1019
Improve grammar in step id name
roryabraham Oct 2, 2024
2d78d20
Always run tests in AWS
roryabraham Oct 2, 2024
ff0e6ba
Disable shellcheck warning on source
roryabraham Oct 2, 2024
9cd621a
Merge branch 'main' into Rory-CallableBuild
roryabraham Oct 2, 2024
c283f7c
Fix artifact name in e2e download-artifact
roryabraham Oct 2, 2024
4097a12
Invert skip condition for building the baseline artifact
roryabraham Oct 2, 2024
660020d
Remove unnecessary if statement
roryabraham Oct 2, 2024
342f861
Consolidate S3 paths
roryabraham Oct 2, 2024
f2c9d7f
exportS3Path singular
roryabraham Oct 3, 2024
9f6280a
Provide pull_request_number to AdHoc builds
roryabraham Oct 3, 2024
74420b6
Make it type: string to make lint happy
roryabraham Oct 3, 2024
5a4d56d
Don't access env where it's not available
roryabraham Oct 3, 2024
4e452c8
Improve comment
roryabraham Oct 3, 2024
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
102 changes: 0 additions & 102 deletions .github/actions/composite/buildAndroidE2EAPK/action.yml

This file was deleted.

188 changes: 188 additions & 0 deletions .github/workflows/buildAndroid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
name: Build Android app

on:
workflow_call:
inputs:
type:
description: 'What type of build to run. Must be one of ["release", "adhoc", "e2e", "e2eDelta"]'
type: string
required: true
ref:
description: Git ref to checkout and build
type: string
required: true
artifact-prefix:
description: 'The prefix for build artifact names. This is useful if you need to call multiple builds from the same workflow'
type: string
required: false
default: ''
pull_request_number:
description: The pull request number associated with this build, if relevant.
type: string
required: false
outputs:
AAB_FILE_NAME:
value: ${{ jobs.build.outputs.AAB_FILE_NAME }}
APK_FILE_NAME:
value: ${{ jobs.build.outputs.APK_FILE_NAME }}

workflow_dispatch:
inputs:
type:
description: What type of build do you want to run?
required: true
type: choice
options:
- release
- adhoc
- e2e
- e2eDelta
ref:
description: Git ref to checkout and build
required: true
type: string

pull_request_number:
description: The pull request number associated with this build, if relevant.
type: number
required: false

jobs:
build:
name: Build Android app
runs-on: ubuntu-latest-xl
env:
RUBYOPT: '-rostruct'
outputs:
AAB_FILE_NAME: ${{ steps.build.outputs.AAB_FILE_NAME }}
APK_FILE_NAME: ${{ steps.build.outputs.APK_FILE_NAME }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Configure MapBox SDK
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}

- name: Setup Node
uses: ./.github/actions/composite/setupNode

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: oracle
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Setup Ruby
uses: ruby/setup-ruby@v1.190.0
with:
bundler-cache: true

- name: Decrypt keystore and json key
run: |
cd android/app
gpg --batch --yes --decrypt --passphrase="${{ secrets.LARGE_SECRET_PASSPHRASE }}" --output my-upload-key.keystore my-upload-key.keystore.gpg
gpg --batch --yes --decrypt --passphrase="${{ secrets.LARGE_SECRET_PASSPHRASE }}" --output android-fastlane-json-key.json android-fastlane-json-key.json.gpg

- name: Get package version
id: getPackageVersion
run: echo "VERSION=$(jq -r .version < package.json)" >> "$GITHUB_OUTPUT"

- name: Get Android native version
id: getAndroidVersion
run: echo "VERSION_CODE=$(grep -o 'versionCode\s\+[0-9]\+' android/app/build.gradle | awk '{ print $2 }')" >> "$GITHUB_OUTPUT"

- name: Setup DotEnv
if: ${{ inputs.type != 'release' }}
run: |
if [ '${{ inputs.type }}' == 'adhoc' ]; then
cp .env.staging .env.adhoc
sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
echo "PULL_REQUEST_NUMBER=${{ inputs.pull_request_number }}" >> .env.adhoc
else
envFile=''
if [ '${{ inputs.type }}' == 'e2e' ]; then
envFile='tests/e2e/.env.e2e'
else
envFile=tests/e2e/.env.e2edelta
fi
{
echo "EXPENSIFY_PARTNER_NAME=${{ secrets.EXPENSIFY_PARTNER_NAME }}"
echo "EXPENSIFY_PARTNER_PASSWORD=${{ secrets.EXPENSIFY_PARTNER_PASSWORD }}"
echo "EXPENSIFY_PARTNER_USER_ID=${{ secrets.EXPENSIFY_PARTNER_USER_ID }}"
echo "EXPENSIFY_PARTNER_USER_SECRET=${{ secrets.EXPENSIFY_PARTNER_USER_SECRET }}"
echo "EXPENSIFY_PARTNER_PASSWORD_EMAIL=${{ secrets.EXPENSIFY_PARTNER_PASSWORD_EMAIL }}"
} >> "$envFile"
fi

- name: Build Android app
id: build
run: |
lane=''
case '${{ inputs.type }}' in
'release')
lane='build';;
'adhoc')
lane='build_adhoc';;
'e2e')
lane='build_e2e';;
'e2eDelta')
lane='build_e2eDelta';;
esac
bundle exec fastlane android "$lane"

# Refresh environment variables from GITHUB_ENV that are updated when running fastlane
# shellcheck disable=SC1090
source "$GITHUB_ENV"

SHOULD_UPLOAD_SOURCEMAPS='false'
if [ -f ./android/app/build/generated/sourcemaps/react/productionRelease/index.android.bundle.map ]; then
SHOULD_UPLOAD_SOURCEMAPS='true'
fi

{
# aabPath and apkPath are environment varibles set within the Fastfile
echo "AAB_PATH=$aabPath"
echo "AAB_FILE_NAME=$(basename "$aabPath")"
echo "APK_PATH=$apkPath"
echo "APK_FILE_NAME=$(basename "$apkPath")"
echo "SHOULD_UPLOAD_SOURCEMAPS=$SHOULD_UPLOAD_SOURCEMAPS"
} >> "$GITHUB_OUTPUT"
env:
MYAPP_UPLOAD_STORE_PASSWORD: ${{ secrets.MYAPP_UPLOAD_STORE_PASSWORD }}
MYAPP_UPLOAD_KEY_PASSWORD: ${{ secrets.MYAPP_UPLOAD_KEY_PASSWORD }}

- name: Upload Android AAB artifact
if: ${{ steps.build.outputs.AAB_PATH != '' }}
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-prefix }}android-artifact-aab
path: ${{ steps.build.outputs.AAB_PATH }}

- name: Upload Android APK artifact
if: ${{ steps.build.outputs.APK_PATH != '' }}
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-prefix }}android-artifact-apk
path: ${{ steps.build.outputs.APK_PATH }}

- name: Upload Android sourcemaps artifact
if: ${{ steps.build.outputs.SHOULD_UPLOAD_SOURCEMAPS == 'true' }}
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-prefix }}android-artifact-sourcemaps
path: ./android/app/build/generated/sourcemaps/react/productionRelease/index.android.bundle.map

- name: Announce failure in slack
if: failure()
uses: ./.github/actions/composite/announceFailedWorkflowInSlack
with:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
Loading
Loading