debug report #254
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Detox E2E Android Tests PR | |
on: | |
push: | |
branches: | |
- test_android_e2e | |
pull_request: | |
branches: | |
- main | |
- test_android_e2e | |
types: | |
- labeled | |
env: | |
AWS_REGION: "us-east-1" | |
ADMIN_EMAIL: ${{ secrets.MM_MOBILE_E2E_ADMIN_EMAIL }} | |
ADMIN_USERNAME: ${{ secrets.MM_MOBILE_E2E_ADMIN_USERNAME }} | |
ADMIN_PASSWORD: ${{ secrets.MM_MOBILE_E2E_ADMIN_PASSWORD }} | |
BRANCH: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }} | |
COMMIT_HASH: ${{ github.sha }} | |
DEVICE_NAME: ${{ inputs.ios_device_name }} | |
DEVICE_OS_VERSION: ${{ inputs.ios_device_os_name }} | |
DETOX_AWS_S3_BUCKET: "mattermost-detox-report" | |
HEADLESS: "false" | |
TYPE: ${{ inputs.run-type }} | |
PULL_REQUEST: "https://github.com/mattermost/mattermost-mobile/pull/${{ github.event.number }}" | |
SITE_1_URL: ${{ inputs.MM_TEST_SERVER_URL || 'https://mobile-e2e-site-1.test.mattermost.cloud' }} | |
SITE_2_URL: "https://mobile-e2e-site-2.test.mattermost.cloud" | |
SITE_3_URL: "https://mobile-e2e-site-3.test.mattermost.cloud" | |
ZEPHYR_ENABLE: ${{ inputs.record_tests_in_zephyr }} | |
JIRA_PROJECT_KEY: "MM" | |
ZEPHYR_API_KEY: ${{ secrets.MM_MOBILE_E2E_ZEPHYR_API_KEY }} | |
ZEPHYR_FOLDER_ID: "3233873" | |
TEST_CYCLE_LINK_PREFIX: ${{ secrets.MM_MOBILE_E2E_TEST_CYCLE_LINK_PREFIX }} | |
WEBHOOK_URL: ${{ secrets.MM_MOBILE_E2E_WEBHOOK_URL }} | |
FAILURE_MESSAGE: "Something has failed" | |
RUNNING_E2E: "true" | |
IOS: "false" | |
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: 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-files-${{ github.run_id }} | |
path: "android/app/build/**/*" | |
detox-android-e2e: | |
runs-on: ubuntu-latest-8-cores | |
# needs: build-android-apk | |
env: | |
ANDROID_HOME: /usr/local/lib/android/sdk | |
ANDROID_SDK_ROOT: /usr/local/lib/android/sdk | |
steps: | |
- name: ci/checkout-repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Install Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libpulse0 | |
sudo apt-get install -y scrot ffmpeg xvfb | |
- name: Enable KVM | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- 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: | | |
cd detox | |
npm install | |
- name: Create destination path | |
run: mkdir -p android/app/build | |
- name: Download artifact | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
curl -L -H "Authorization: token $GITHUB_TOKEN" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/mattermost/mattermost-mobile/actions/artifacts/2523423750/zip \ | |
--output android/app/build/artifact.zip | |
- name: Unzip artifact | |
run: | | |
unzip android/app/build/artifact.zip -d android/app/build | |
rm -rf android/app/build/artifact.zip | |
- name: Set up Android SDK | |
run: | | |
export ANDROID_HOME=/usr/local/lib/android/sdk | |
export PATH=$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/emulator:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$PATH | |
echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV | |
echo "PATH=$PATH" >> $GITHUB_ENV | |
- name: Start Xvfb | |
run: | | |
Xvfb :99 -screen 0 1920x1080x24 & | |
export DISPLAY=:99 | |
echo "DISPLAY=:99" >> $GITHUB_ENV | |
- name: Accept Android licenses | |
run: | | |
yes | sdkmanager --licenses || true | |
- name: Install Android system image | |
run: | | |
sdkmanager "system-images;android-33;default;x86_64" | |
sdkmanager "platform-tools" "emulator" | |
- name: Create and start Android emulator | |
run: | | |
cd detox | |
chmod +x ./create_android_emulator.sh | |
./create_android_emulator.sh | |
- name: Generate Report Path | |
id: s3 | |
run: | | |
path="${{ github.run_id }}/${{ github.sha }}" | |
echo "path=$(echo "${path}" | sed 's/\./-/g')" >> ${GITHUB_OUTPUT} | |
- name: Save report Detox Dependencies | |
id: report-link | |
run: | | |
cd detox | |
npm run e2e:save-report | |
env: | |
DETOX_AWS_ACCESS_KEY_ID: ${{ secrets.MM_MOBILE_DETOX_AWS_ACCESS_KEY_ID }} | |
DETOX_AWS_SECRET_ACCESS_KEY: ${{ secrets.MM_MOBILE_DETOX_AWS_SECRET_ACCESS_KEY }} | |
IOS: false | |
BUILD_ID: ${{ github.run_id }} | |
REPORT_PATH: ${{ steps.s3.outputs.path }} | |
## These are needed for the MM Webhook report | |
COMMIT_HASH: ${{ github.sha }} | |
BRANCH: ${{ github.ref }} | |
- name: Take Screenshot on Failure | |
if: failure() | |
run: scrot failure_screenshot.png | |
- name: Upload Screenshot on Failure | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: failure-screenshot | |
path: failure_screenshot.png | |
- name: Stop Android emulator | |
if: always() # Ensure the emulator is stopped even if the tests fail | |
run: | | |
adb emu kill | |
- name: Upload android Test Report | |
if: always() | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: android-results-${{ github.run_id }} | |
path: detox/artifacts/ |