Add android detox apk build workflow (#8405)
This commit is contained in:
parent
6ffc24a1fd
commit
0ad2679595
2 changed files with 75 additions and 1 deletions
73
.github/workflows/e2e-android-detox.yml
vendored
Normal file
73
.github/workflows/e2e-android-detox.yml
vendored
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
name: Detox E2E Android Tests PR
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
types:
|
||||
- labeled
|
||||
|
||||
concurrency:
|
||||
group: "${{ github.workflow }}-${{ github.event.pull_request.number }}-${{ github.event.label.name }}"
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-android-apk:
|
||||
if: github.event.label.name == 'E2E Android tests for PR'
|
||||
runs-on: ubuntu-latest-8-cores
|
||||
env:
|
||||
ORG_GRADLE_PROJECT_jvmargs: -Xmx8g
|
||||
steps:
|
||||
- name: Prune Docker to free up space
|
||||
run: docker system prune -af
|
||||
|
||||
- name: Remove npm Temporary Files
|
||||
run: |
|
||||
rm -rf ~/.npm/_cacache
|
||||
|
||||
- name: ci/checkout-repo
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: ci/prepare-android-build
|
||||
uses: ./.github/actions/prepare-android-build
|
||||
env:
|
||||
STORE_FILE: "${{ secrets.MM_MOBILE_STORE_FILE }}"
|
||||
STORE_ALIAS: "${{ secrets.MM_MOBILE_STORE_ALIAS }}"
|
||||
STORE_PASSWORD: "${{ secrets.MM_MOBILE_STORE_PASSWORD }}"
|
||||
MATTERMOST_BUILD_GH_TOKEN: "${{ secrets.MATTERMOST_BUILD_GH_TOKEN }}"
|
||||
|
||||
- name: Install Dependencies
|
||||
run: sudo apt-get clean && sudo apt-get update && sudo apt-get install -y default-jdk
|
||||
|
||||
- name: Cache Gradle dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.gradle/caches/modules-2/
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
restore-keys: ${{ runner.os }}-gradle-
|
||||
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/actions/wrapper-validation@v3
|
||||
|
||||
- name: Inject Detox settings
|
||||
run: cd detox && npm run e2e:android-inject-settings
|
||||
|
||||
- name: Update minSdkVersion for react-native-image-picker
|
||||
run: |
|
||||
sed -i 's/minSdkVersion 21/minSdkVersion 23/' ./node_modules/react-native-image-picker/android/build.gradle
|
||||
cat ./node_modules/react-native-image-picker/android/build.gradle | grep minSdkVersion
|
||||
|
||||
- name: Detox build
|
||||
run: |
|
||||
cd detox
|
||||
npm install
|
||||
npm install -g detox-cli
|
||||
npm run e2e:android-build
|
||||
|
||||
- name: ci/upload-android-pr-build
|
||||
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
|
||||
with:
|
||||
name: android-build-apk-${{ github.run_id }}
|
||||
path: "android/app/build/outputs/apk/**/app-*.apk"
|
||||
|
|
@ -20,7 +20,8 @@ npm run inject-detox-settings
|
|||
|
||||
### Update `minSdkVersion` for `react-native-image-picker`
|
||||
|
||||
On macOS machines, update the `minSdkVersion` of `react-native-image-picker` to 23 by running the following command from the root directory:
|
||||
On macOS machines, update the `minSdkVersion` of `react-native-image-picker` to 23 by running the following command from the root directory.
|
||||
This is required for Detox to build the test apk targeting android API 31 or higher.
|
||||
|
||||
```sh
|
||||
sed -i '' 's/minSdkVersion 21/minSdkVersion 23/' ./node_modules/react-native-image-picker/android/build.gradle
|
||||
|
|
|
|||
Loading…
Reference in a new issue