diff --git a/.drone.jsonnet b/.drone.jsonnet deleted file mode 100644 index 79e9bc8..0000000 --- a/.drone.jsonnet +++ /dev/null @@ -1,32 +0,0 @@ - -[ - // Unit tests (PRs only) - { - kind: 'pipeline', - type: 'docker', - name: 'Session Android Integration tests', - platform: { os: 'linux', arch: 'amd64' }, - steps: [ - { - name: 'appium android tests', - image: "registry.oxen.rocks/appium-34-pixel6", - environment: { - 'APK_URL': 'https://oxen.rocks/AL-Session/session-android/dev/session-android-20240402T225341Z-d3c863574-universal.tar.xz', - 'APK_TO_TEST_PATH':'/session.apk', - 'NODE_CONFIG_ENV': 'ci', - }, - commands: [ - 'cp -r docker/etc/* /etc', - '/usr/bin/supervisord -c /etc/supervisord_test.conf', - 'chmod +x ./docker/*.sh', - './docker/start_emulators.sh', - './docker/dl.sh', - 'yarn install --immutable && yarn tsc && yarn test-no-retry ""' - - ], - - }, - ], -}, -] - diff --git a/.github/workflows/android-regression.yml b/.github/workflows/android-regression.yml new file mode 100644 index 0000000..93188ba --- /dev/null +++ b/.github/workflows/android-regression.yml @@ -0,0 +1,122 @@ +name: Run android regression tests +on: + workflow_dispatch: + inputs: + APK_URL: + description: 'APK.tar.gz url to test' + required: true + type: string + BRANCH_TO_CHECKOUT: + description: 'bilb/session-appium branch to checkout' + required: true + type: string + + push: + branches: + - test-docker-container + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + +jobs: + android-regression: + runs-on: [self-hosted, linux, x64, qa-android] + env: + ANDROID_APP_PATH_PREFIX: "../extracted/session-android.apk" + APPIUM_ADB_FULL_PATH: "/opt/android/platform-tools/adb" + ANDROID_SDK_ROOT: "/opt/android" + PLAYWRIGHT_WORKERS_COUNT: 1 + IOS_APP_PATH_PREFIX: "just_not_empty" + IOS_FIRST_SIMULATOR: "just_not_empty" + IOS_SECOND_SIMULATOR: "just_not_empty" + IOS_THIRD_SIMULATOR: "just_not_empty" + IOS_FOURTH_SIMULATOR: "just_not_empty" + IOS_FIFTH_SIMULATOR: "just_not_empty" + IOS_SIXTH_SIMULATOR: "just_not_empty" + IOS_SEVENTH_SIMULATOR: "just_not_empty" + IOS_EIGHTH_SIMULATOR: "just_not_empty" + + + steps: + - uses: actions/checkout@v4 + - name: Runner Details + run: | + echo "BRANCH_TO_CHECKOUT ${{ github.event.inputs..BRANCH_TO_CHECKOUT }}" + echo "APK_URL ${{ github.event.inputs.APK_URL }}" + + - name: Download APK + run: | + wget -q -O plop.apk.tar.xz ${{ github.event.inputs.APK_URL }} + ls + pwd + + - name: Extract APK + run: | + tar xf plop.apk.tar.xz + ls + pwd + + - name: Rename extracted folder + run: | + mv session-android-*universal extracted + ls extracted + mv extracted/*.apk extracted/session-android.apk + ls extracted + pwd + + + - uses: actions/checkout@v4 + with: + repository: 'bilb/session-appium' + ref: ${{ inputs.BRANCH_TO_CHECKOUT }}​​ + path: 'forked-session-appium' + + - uses: actions/setup-node@v4 + with: + # node-version-file: 'forked-session-appium/.nvmrc' + node-version: 18.15.0 + + + - name: Install yarn + run: | + npm install -g yarn + corepack enable + yarn set version 4.1.1 + + - name: Install test dependencies + run: | + cd forked-session-appium + ls + git status + touch yarn.lock + yarn install --immutable + + - name: Build the Android tests + run: | + cd forked-session-appium + yarn tsc + + - name: Start 4 android emulators with snapshots + shell: bash + run: | + for i in {1..4} \ + do \ + emulator @emulator$i -no-window -no-snapshot-save -snapshot plop.snapshot -force-snapshot-load & \ + sleep 5 \ + done + + - name: Run the Android tests + run: | + cd forked-session-appium + pwd + yarn test-android-shard 1/1 + + - name: Killall running emulators + if: always() + run: killall qemu-system-x86_64-headless + + + + + diff --git a/plop.utils.sh b/plop.utils.sh new file mode 100644 index 0000000..5d59a57 --- /dev/null +++ b/plop.utils.sh @@ -0,0 +1,32 @@ +# alias copy_snapshot="export SNS1='/home/runner/.android/avd/emulator1.avd/snapshots/plop.snapshot' && cp $SNS1 /home/runner/.android/avd/emulator2.avd/snapshots/plop.snapshot && cp $SNS1 /home/runner/.android/avd/emulator2.avd/snapshots/plop.snapshot && cp $SNS1 /home/runner/.android/avd/emulator2.avd/snapshots/plop.snapshot && cp $SNS1 /home/runner/.android/avd/emulator2.avd/snapshots/plop.snapshot && cp $SNS1 /home/runner/.android/avd/emulator2.avd/snapshots/plop.snapshot && cp $SNS1 /home/runner/.android/avd/emulator2.avd/snapshots/plop.snapshot && cp $SNS1 /home/runner/.android/avd/emulator2.avd/snapshots/plop.snapshot" + +for i in {2..8}; do unlink /home/runner/.android/avd/emulator$i.avd/snapshots/plop.snapshot; ln -s /home/runner/.android/avd/emulator1.avd/snapshots/plop.snapshot/ /home/runner/.android/avd/emulator$i.avd/snapshots/; done + +# alias start_for_snapshot="emulator @emulator1 -no-window" +# alias save_snapshot="adb emu avd snapshot save plop.snapshot" +# alias copy_snapshot="export SNS1='~/.android/avd/emulator1.avd/snapshots/plop.snapshot' && cp $SNS1 ~/.android/avd/emulator2.avd/snapshots/plop.snapshot && cp $SNS1 ~/.android/avd/emulator2.avd/snapshots/plop.snapshot && cp $SNS1 ~/.android/avd/emulator2.avd/snapshots/plop.snapshot && cp $SNS1 ~/.android/avd/emulator2.avd/snapshots/plop.snapshot && cp $SNS1 ~/.android/avd/emulator2.avd/snapshots/plop.snapshot && cp $SNS1 ~/.android/avd/emulator2.avd/snapshots/plop.snapshot && cp $SNS1 ~/.android/avd/emulator2.avd/snapshots/plop.snapshot" +# alias start_with_snapshot="emulator @emulator1 -no-window -no-snapshot-save -snapshot plop.snapshot -force-snapshot-load" + +## start_for_snapshots +for i in {1..4} + do emulator @emulator$i -no-window & + sleep 20 +done + + +# force save snapshots +values=("5554" "5556" "5558" "5560" "5562" "5564" "5566" "5568") +for val in "${values[@]}" +do + adb -s emulator-$val emu avd snapshot save plop.snapshot +done + +alias killall_emulators="killall qemu-system-x86_64-headless;" + + +# start with snapshots +for i in {1..4} +do + emulator @emulator$i -no-window -no-snapshot-save -snapshot plop.snapshot -force-snapshot-load & + sleep 5 +done