Skip to content

DIA-3802 git action tests pipeline #148

DIA-3802 git action tests pipeline

DIA-3802 git action tests pipeline #148

Workflow file for this run

name: UI tests
on: [pull_request]
jobs:
AndroidUITests:
needs: IOSUITests
if: always()
runs-on: ubuntu-latest
name: AndroidUITests
steps:
- name: Checkout
uses: actions/checkout@v4
- 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: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
- name: Gradle cache
uses: gradle/actions/setup-gradle@v3
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-34
- 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: 34
target: google_apis
force-avd-creation: true
disk-size: 6000M
heap-size: 3048M
ram-size: 3048M
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
arch: x86_64
script: echo "Generated AVD snapshot for caching."
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0'
- name: Setup dotnet-test-rerun
run: |
dotnet tool install --global dotnet-test-rerun
- name: Install and run Appium Server
run: |
npm i --location=global appium
appium driver install uiautomator2
CurWorkDir=$(pwd)
pushd "$CurWorkDir"
mkdir logs
cd logs
echo "appium" > appiumLog.txt
popd
appium &>logs/appiumLog.txt &
- name: Create log files for logcat
run: |
cd logs
echo "logcat" > logcat.txt
echo "logcat" > logcatPID.txt
- name: Install and run AltTester Server
run: |
CurWorkDir=$(pwd)
pushd "$CurWorkDir"
cd logs
echo "alttester" > altTesterLog.txt
echo "alttester" > runAltTesterLog.txt
popd
wget https://alttester.com/app/uploads/AltTester/desktop/AltTesterDesktopLinuxBatchmode.zip
unzip AltTesterDesktopLinuxBatchmode.zip
cd AltTesterDesktopLinux
chmod +x AltTesterDesktop.x86_64
./AltTesterDesktop.x86_64 -batchmode -nographics -port 13000 -license ${{ secrets.ALTTESTERLICENSEKEY }} -termsAndConditionsAccepted -logfile ~/work/unity-sdk/unity-sdk/logs/altTesterLog.txt &>~/work/unity-sdk/unity-sdk/logs/runAltTesterLog.txt &
- name: Start emulator and run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
target: google_apis
force-avd-creation: false
disk-size: 6000M
heap-size: 3048M
ram-size: 3048M
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
arch: x86_64
script: |
adb logcat > ~/work/unity-sdk/unity-sdk/logs/logcat.txt & echo $! > ~/work/unity-sdk/unity-sdk/logs/logcatPID.txt
cd ~/work/unity-sdk/unity-sdk && chmod -R 777 UI-TESTS
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=ClickAcceptAllButtonTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=ClickRejectAllButtonTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=OpenPmLayersTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=SaveAndExitGDPRTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=SaveAndExitCCPATest --rerunMaxAttempts 5
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=SaveAndExitUSNATTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=ClearAllButtonTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=AuthIdTest --rerunMaxAttempts 5
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=AcceptRejectAllUsnatInPMTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=ProgramaticRejectAllGDPRTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=ProgramaticRejectAllCCPATest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=ProgramaticRejectAllUSNATTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=ProgramaticCustomConsentGDPRTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=MessageLanguageTest --rerunMaxAttempts 5
lsof -P | cat ~/work/unity-sdk/unity-sdk/logs/logcatPID.txt | xargs kill
- name: Move dotnet logs
if: always()
run: |
cd ~/work/unity-sdk/unity-sdk/UI-TESTS
find . -name '*.trx' -exec mv {} ~/work/unity-sdk/unity-sdk/logs \;
- name: Archive logs
if: always()
uses: actions/upload-artifact@v4
with:
name: androidLogs
path: logs/
compression-level: 0
IOSUITests:
runs-on: macos-13
name: IOSUITests
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: 'true'
- name: Checkout LFS objects
run: git lfs pull
- name: Setup XCode
run: sudo xcode-select -s '/Applications/Xcode_14.1.app/Contents/Developer'
- name: Boot simulator
run: |
xcrun simctl boot $(xcrun simctl list devices | grep -m 1 'iPhone 14' |grep -E -o -i '([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})')
sleep 30
open -a simulator
sleep 60
xcrun simctl list devices
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0'
- name: Setup dotnet-test-rerun
run: |
dotnet tool install --global dotnet-test-rerun
- name: Install and run Appium Server
run: |
npm i --location=global appium
appium driver install xcuitest
CurWorkDir=$(pwd)
pushd "$CurWorkDir"
mkdir logs
cd logs
echo "appium" > appiumLog.txt
popd
appium &>logs/appiumLog.txt &
- name: Install and run AltTester Server
run: |
CurWorkDir=$(pwd)
pushd "$CurWorkDir"
cd logs
echo "alttester" > altTesterLog.txt
echo "alttester" > runAltTesterLog.txt
popd
wget https://alttester.com/app/uploads/AltTester/desktop/AltTesterDesktopPackageMac__v2.1.2.zip
unzip AltTesterDesktopPackageMac__v2.1.2.zip
cd AltTesterDesktopPackageMac__v2.1.2
hdiutil attach AltTesterDesktop__v2.1.2.dmg
cp -R /Volumes/AltTesterDesktop/AltTesterDesktop.app ~
cd ~ && AltTesterDesktop.app/Contents/MacOS/AltTesterDesktop -batchmode -nographics -port 13000 -license ${{ secrets.ALTTESTERLICENSEKEY }} -termsAndConditionsAccepted -logfile ~/work/unity-sdk/unity-sdk/logs/altTesterLog.txt &>~/work/unity-sdk/unity-sdk/logs/runAltTesterLog.txt &
- name: Run tests
run: |
cd ~/work/unity-sdk/unity-sdk && chmod -R 777 UI-TESTS
cd UI-TESTS
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=ClickAcceptAllButtonTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=ClickRejectAllButtonTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=OpenPmLayersTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=SaveAndExitGDPRTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=SaveAndExitCCPATest --rerunMaxAttempts 5
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=SaveAndExitUSNATTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=ClearAllButtonTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=AuthIdTest --rerunMaxAttempts 5
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=AcceptRejectAllUsnatInPMTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=ProgramaticRejectAllGDPRTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=ProgramaticRejectAllCCPATest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=ProgramaticRejectAllUSNATTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=ProgramaticCustomConsentGDPRTest --rerunMaxAttempts 5
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=MessageLanguageTest --rerunMaxAttempts 5
- name: Move dotnet logs
if: always()
run: |
cd ~/work/unity-sdk/unity-sdk/UI-TESTS
find . -name '*.trx' -exec mv {} ~/work/unity-sdk/unity-sdk/logs \;
- name: Archive logs
if: always()
uses: actions/upload-artifact@v4
with:
name: iosLogs
path: logs/
compression-level: 0