Skip to content

Commit

Permalink
fix: trigger workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fanch committed Sep 30, 2024
1 parent 1eeb78e commit 021bf13
Show file tree
Hide file tree
Showing 6 changed files with 532 additions and 36 deletions.
111 changes: 111 additions & 0 deletions .github/run-maestro-28-wikipedia.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
name: Run Maestro with reactivecircus GHA

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true


jobs:
run-with-video-recording:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# - name: Cache Maestro
# id: maestro-cache
# uses: actions/cache@v4
# with:
# path: ~/.maestro/bin/maestro
# key: maestro-${{ runner.os }}-toto-${{ hashFiles('**/maestro') }}

- name: Install Maestro
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
- 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: Setup Android SDK
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: android-actions/setup-android@v3

- name: Gradle cache
uses: gradle/actions/setup-gradle@v3

- name: AVD cache
uses: actions/cache/restore@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-28-wiki-${{ runner.os }}

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
cores: 4
ram-size: 4096M
heap-size: 576
api-level: 28
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: |
adb install wikipedia.apk
echo "install done"
echo "Generated AVD snapshot for caching."
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
env:
MAESTRO_CLI_NO_ANALYTICS: 1
with:
api-level: 28
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
profile: pixel_6
disable-animations: true
script: |
maestro test samples/android-advanced-flow.yaml
# https://github.com/actions/upload-artifact/issues/333#issuecomment-1227464293
# The -j option in the zip command is used to junk (strip) the directory paths and store just
# the names of the files. This means that when you create a zip archive, the files will be
# stored in the root of the archive without any directory structure.
- name: Zip the test result folder
if: always()
run: |
zip -r testResult.zip -j ${HOME}/.maestro/tests/* emulator.log
- name: Upload test result
if: always()
uses: actions/upload-artifact@v3
with:
name: Test result
path: testResult.zip


- uses: actions/cache/save@v4
if: always()
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-28-${{ runner.os }}
121 changes: 121 additions & 0 deletions .github/run-maestro-35-wikipedia.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
name: Run Maestro with reactivecircus GHA

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true


jobs:
run-with-video-recording:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# - name: Cache Maestro
# id: maestro-cache
# uses: actions/cache@v4
# with:
# path: ~/.maestro/bin/maestro
# key: maestro-${{ runner.os }}-toto-${{ hashFiles('**/maestro') }}

- name: Install Maestro
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
- 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: Setup Android SDK
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: android-actions/setup-android@v3

- name: Gradle cache
uses: gradle/actions/setup-gradle@v3

- name: AVD cache
uses: actions/cache/restore@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-35-wiki-${{ runner.os }}

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
cores: 4
ram-size: 4096M
heap-size: 2000
api-level: 35
target: google_apis
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: |
adb install wikipedia.apk
echo "install done"
echo "Generated AVD snapshot for caching."
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
env:
MAESTRO_CLI_NO_ANALYTICS: 1
with:
cores: 4
ram-size: 4096M
heap-size: 2000
api-level: 35
target: google_apis
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
profile: pixel_6
disable-animations: true
script: |
adb logcat -c
adb logcat > adb_logs.txt &
maestro test samples/android-advanced-flow.yaml
# https://github.com/actions/upload-artifact/issues/333#issuecomment-1227464293
# The -j option in the zip command is used to junk (strip) the directory paths and store just
# the names of the files. This means that when you create a zip archive, the files will be
# stored in the root of the archive without any directory structure.
- name: Zip the test result folder
if: always()
run: |
zip -r testResult.zip -j ${HOME}/.maestro/tests/* emulator.log adb_logs.txt
- name: Upload test result
if: always()
uses: actions/upload-artifact@v3
with:
name: Test result
path: testResult.zip


- uses: actions/cache/save@v4
if: always()
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-35-wiki-${{ runner.os }}

Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,37 @@ concurrency:

jobs:
run-with-video-recording:
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4


- name: Install srcpy
if: steps.ffmpeg-cache.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y scrcpy
whereis scrcpy
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# - name: Cache Maestro
# id: maestro-cache
# uses: actions/cache@v4
# with:
# path: ~/.maestro/bin/maestro
# key: maestro-${{ runner.os }}-${{ hashFiles('**/maestro') }}
# restore-keys: |
# maestro-${{ runner.os }}-
#
# - name: Install Maestro
# if: steps.maestro-cache.outputs.cache-hit != 'true'
# run: |
# curl -Ls "https://get.maestro.mobile.dev" | bash
# echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
- name: Cache Maestro
id: maestro-cache
uses: actions/cache@v4
with:
path: ~/.maestro/bin/maestro
key: maestro-${{ runner.os }}-${{ hashFiles('**/maestro') }}
restore-keys: |
maestro-${{ runner.os }}-
- name: Enable KVM
- name: Install Maestro
if: steps.maestro-cache.outputs.cache-hit != 'true'
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
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
# - 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: Setup Android SDK
if: steps.avd-cache.outputs.cache-hit != 'true'
Expand All @@ -65,13 +57,18 @@ jobs:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-29-${{ runner.os }}
key: avd-30-tutu-${{ runner.os }}

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
cores: 4
ram-size: 8192M
heap-size: 8192
api-level: 30
target: google_apis
arch: x86
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
Expand All @@ -83,28 +80,46 @@ jobs:
cores: 8
ram-size: 9000M
heap-size: 8192
api-level: 29
api-level: 30
target: google_apis
arch: x86
force-avd-creation: false
emulator-options: -verbose -memory 16384 -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
profile: pixel_6
disable-animations: true
script: |
#!/bin/sh
set +e
# scrcpy --record output.mp4 &

export DISPLAY=:1
scrcpy --record output.mp4 &
adb shell "ls -ld /sdcard"

# Check if the file exists and remove it
adb shell 'if [ -f /storage/self/primary/screenrecord.mp4 ]; then rm -f /storage/self/primary/screenrecord.mp4; fi'

# Start screen recording
adb shell screenrecord /storage/self/primary/screenrecord.mp4 &


adb shell input keyevent 82 &

sleep 15 # Ajuste la durée de l'enregistrement
pkill scrcpy # Stopper scrcpy après l'enregistrement

# pkill scrcpy
adb shell pkill -l2 screenrecord
adb pull /storage/self/primary/screenrecord.mp4 .
adb shell rm /storage/self/primary/screenrecord.mp4

echo "ok"




- name: Upload Maestro artifacts (report/video)
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: maestro-report
path: |
Expand Down
Loading

0 comments on commit 021bf13

Please sign in to comment.