-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
904fbfd
commit 4d7dd14
Showing
3 changed files
with
81 additions
and
30 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,11 @@ inputs: | |
flavor: | ||
required: true | ||
description: the flavor we want to run - either debug or release | ||
working-directory: | ||
required: false | ||
default: "." | ||
description: The directory from which metro should be started | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
|
@@ -41,35 +46,62 @@ runs: | |
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: Build Codegen | ||
shell: bash | ||
if: ${{ inputs.flavor == 'debug' }} | ||
run: ./packages/react-native-codegen/scripts/oss/build.sh | ||
- name: Run e2e tests | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
api-level: 24 | ||
arch: x86 | ||
script: | | ||
if [[ "${{ inputs.flavor }}" == debug ]]; then | ||
echo "Running Metro in backgroud" | ||
yarn start & | ||
fi | ||
# Avoid exit from the job if one of the command returns an error. | ||
# Maestro can fail in case of flakyness, we have some retry logic. | ||
set +e | ||
echo "Install APK from ${{ inputs.app-path }}" | ||
adb install "${{ inputs.app-path }}" | ||
echo "Start recording to /sdcard/screen.mp4" | ||
adb shell screenrecord /sdcard/screen.mp4 | ||
echo "Build Codegen" | ||
echo "Start Metro in Background" | ||
cd ${{ inputs.working-directory }} | ||
pwd | ||
yarn start & | ||
# Add retries for flakyness | ||
MAX_ATTEMPTS=3 | ||
CURR_ATTEMPT=0 | ||
RESULT=1 | ||
while [[ $CURR_ATTEMPT -lt $MAX_ATTEMPTS ]] && [[ $RESULT -ne 0 ]]; do | ||
CURR_ATTEMPT=$((CURR_ATTEMPT+1)) | ||
echo "Attempt number $CURR_ATTEMPT" | ||
echo "Start recording to /sdcard/screen_$CURR_ATTEMPT.mp4" | ||
adb shell screenrecord /sdcard/screen_$CURR_ATTEMPT.mp4 | ||
echo "Start testing ${{ inputs.maestro-flow }}" | ||
export MAESTRO_DRIVER_STARTUP_TIMEOUT=60000 | ||
$HOME/.maestro/bin/maestro test ${{ inputs.maestro-flow }} --format junit -e APP_ID=${{ inputs.app-id }} --debug-output /tmp/MaestroLogs | ||
echo "Start testing ${{ inputs.maestro-flow }}" | ||
$HOME/.maestro/bin/maestro test ${{ inputs.maestro-flow }} --format junit -e APP_ID=${{ inputs.app-id }} --debug-output /tmp/MaestroLogs | ||
RESULT=$? | ||
# Stop video | ||
adb pull /sdcard/screen_$CURR_ATTEMPT.mp4 | ||
done | ||
echo "Stop recording. Saving to screen.mp4" | ||
adb pull /sdcard/screen.mp4 | ||
exit $RESULT | ||
- name: Store tests result | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: e2e_android_${{ inputs.app-id }}_report_${{ inputs.jsengine }}_${{ inputs.flavor }} | ||
path: | | ||
report.xml | ||
screen.mp4 | ||
screen_1.mp4 | ||
screen_2.mp4 | ||
screen_3.mp4 | ||
- name: Store Logs | ||
if: failure() && steps.run-tests.outcome == 'failure' | ||
uses: actions/[email protected] | ||
|
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
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