Skip to content

DIA-3802 git action tests pipeline #131

DIA-3802 git action tests pipeline

DIA-3802 git action tests pipeline #131

Workflow file for this run

name: UI tests
on: [pull_request]
jobs:
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 60
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
appium plugin install --source=npm appium-altunity-plugin
CurWorkDir=$(pwd)
pushd "$CurWorkDir"
mkdir logs
cd logs
echo "appium" > appiumLog.txt
popd
# :appium --use-plugins=altunity &>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
./actionsTestIOS.sh ${{ secrets.ALTTESTERLICENSEKEY }} ClickAcceptAllButtonTest
./actionsTestIOS.sh ${{ secrets.ALTTESTERLICENSEKEY }} ClickRejectAllButtonTest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=ClickAcceptAllButtonTest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=ClickRejectAllButtonTest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=OpenPmLayersTest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=SaveAndExitGDPRTest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=SaveAndExitCCPATest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=SaveAndExitUSNATTest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=ClearAllButtonTest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=AuthIdTest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=AcceptRejectAllUsnatInPMTest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=ProgramaticRejectAllGDPRTest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=ProgramaticRejectAllCCPATest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=ProgramaticRejectAllUSNATTest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=ProgramaticCustomConsentGDPRTest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/ios.runsettings --filter Name=MessageLanguageTest
- name: Archive logs
if: always()
uses: actions/upload-artifact@v4
with:
name: logs
path: logs/
compression-level: 0
AndroidUITests:
if: false
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
appium plugin install --source=npm appium-altunity-plugin
CurWorkDir=$(pwd)
pushd "$CurWorkDir"
mkdir logs
cd logs
echo "appium" > appiumLog.txt
popd
appium --use-plugins=altunity &>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
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=ClickRejectAllButtonTest
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=OpenPmLayersTest
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=SaveAndExitGDPRTest
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=SaveAndExitCCPATest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=SaveAndExitUSNATTest
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=ClearAllButtonTest
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=AuthIdTest
# :test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=AcceptRejectAllUsnatInPMTest
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=ProgramaticRejectAllGDPRTest
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=ProgramaticRejectAllCCPATest
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=ProgramaticRejectAllUSNATTest
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=ProgramaticCustomConsentGDPRTest
test-rerun ~/work/unity-sdk/unity-sdk/UI-TESTS -s ~/work/unity-sdk/unity-sdk/UI-TESTS/android.runsettings --filter Name=MessageLanguageTest
lsof -P | cat ~/work/unity-sdk/unity-sdk/logs/logcatPID.txt | xargs kill
- name: Archive logs
if: always()
uses: actions/upload-artifact@v4
with:
name: logs
path: logs/
compression-level: 0