From 5b288b4780b3e135e6ee221734f18152d3438bc9 Mon Sep 17 00:00:00 2001 From: VincentKobz Date: Thu, 16 May 2024 10:37:17 +0200 Subject: [PATCH] fix: GitHub CI, uninstall package before running integration tests --- .github/workflows/test.yaml | 39 ++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b799aea5..568e274d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,6 +14,11 @@ jobs: 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 environment uses: actions/setup-java@v4 with: @@ -38,6 +43,31 @@ jobs: emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: false script: echo "Generated AVD snapshot for caching" + + + - name: Install required tools + run: sudo apt-get install -y wget tar unzip + + - name: Set up Android SDK + run: | + # Set environment variables + echo "ANDROID_HOME=$HOME/android-sdk" >> $GITHUB_ENV + echo "ANDROID_SDK_ROOT=$HOME/android-sdk" >> $GITHUB_ENV + echo "$HOME/android-sdk/platform-tools" >> $GITHUB_PATH + + # Download and install Android SDK command line tools + wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip -O commandlinetools.zip + mkdir -p $HOME/android-sdk/cmdline-tools + unzip -q commandlinetools.zip -d $HOME/android-sdk/cmdline-tools + mv $HOME/android-sdk/cmdline-tools/cmdline-tools $HOME/android-sdk/cmdline-tools/latest + + # Install platform tools (adb) + yes | $HOME/android-sdk/cmdline-tools/latest/bin/sdkmanager --sdk_root=$HOME/android-sdk "platform-tools" + + # Install system images and other tools for API 19 + yes | $HOME/android-sdk/cmdline-tools/latest/bin/sdkmanager --sdk_root=$HOME/android-sdk "system-images;android-${{ matrix.api-level }};default;x86" + yes | $HOME/android-sdk/cmdline-tools/latest/bin/sdkmanager --sdk_root=$HOME/android-sdk "emulator" + - name: Run unit tests run: ./gradlew check - name: Run integration tests @@ -47,4 +77,11 @@ jobs: force-avd-creation: false emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true - script: ./gradlew connectedCheck \ No newline at end of file + script: adb uninstall com.enioka.scanner.sdk.mock.test; adb uninstall com.enioka.scanner.service; abd uninstall com.enioka.scanner.service.ScannerServiceAndroidTest; ./gradlew connectedCheck --stacktrace + + - name: Upload stacktrace + if: always() + uses: actions/upload-artifact@v2 + with: + name: stacktrace + path: /home/runner/work/enioka_scan/enioka_scan/enioka_scan/build/reports/androidTests/connected/debug/ \ No newline at end of file