2024-07-17 20:11:44 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'dev'
|
|
|
|
env:
|
|
|
|
SONAR_TOKEN: ${{ secrets.SQ_KEY }}
|
|
|
|
jobs:
|
|
|
|
build:
|
2024-07-17 22:01:58 +02:00
|
|
|
runs-on: bookworm
|
2024-07-17 20:11:44 +02:00
|
|
|
steps:
|
2024-07-17 22:01:58 +02:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
apt-get update && apt-get upgrade -y
|
|
|
|
apt-get install -y git curl wget
|
|
|
|
curl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
|
|
|
|
bash nodesource_setup.sh
|
2024-07-17 22:06:18 +02:00
|
|
|
apt-get install -y nodejs
|
2024-07-17 22:01:58 +02:00
|
|
|
|
2024-07-17 20:11:44 +02:00
|
|
|
- name: Initialize scanner
|
|
|
|
run: |
|
|
|
|
export SONAR_SCANNER_VERSION=6.0.0.4432
|
|
|
|
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
|
|
|
|
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
|
|
|
|
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
|
|
|
|
export PATH=$SONAR_SCANNER_HOME/bin:$PATH
|
|
|
|
export SONAR_SCANNER_OPTS="-server"
|
2024-07-17 22:01:58 +02:00
|
|
|
|
2024-07-17 21:36:49 +02:00
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
2024-07-17 22:01:58 +02:00
|
|
|
- name: Set up JDK 17
|
|
|
|
uses: https://github.com/actions/setup-java@v3
|
|
|
|
with:
|
|
|
|
java-version: '17'
|
|
|
|
distribution: 'temurin'
|
|
|
|
|
|
|
|
- name: Setup Android SDK
|
|
|
|
uses: https://github.com/android-actions/setup-android@v3
|
|
|
|
|
|
|
|
- name: Install Flutter
|
2024-07-17 20:11:44 +02:00
|
|
|
run: |
|
2024-07-17 22:01:58 +02:00
|
|
|
wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${{ vars.FLUTTER_VERSION }}-stable.tar.xz -O flutter.tar.xz
|
|
|
|
tar -xzf flutter.tar.xz -C $HOME/.flutter
|
|
|
|
export PATH=$PATH:$HOME/.flutter
|
|
|
|
rm flutter.tar.xz
|
|
|
|
flutter doctor -v
|
2024-07-17 21:36:49 +02:00
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
run: |
|
|
|
|
echo "Downloading tools"
|
2024-07-17 20:11:44 +02:00
|
|
|
sdkmanager "platform-tools" "platforms;android-${{ vars.ANDROID_API }}"
|
2024-07-17 20:20:25 +02:00
|
|
|
sdkmanager --install "system-images;android-${{ vars.ANDROID_API }};${{ vars.ANDROID_TARGET }};${{ vars.ANDROID_ARCH }}"
|
2024-07-17 20:11:44 +02:00
|
|
|
sdkmanager --update
|
|
|
|
echo "y" | sdkmanager --licenses
|
|
|
|
sdkmanager --list
|
2024-07-17 21:36:49 +02:00
|
|
|
echo "Creating AVD"
|
2024-07-17 20:20:25 +02:00
|
|
|
echo "no" | avdmanager -v create avd --force --name "android_emulator" --package "system-images;android-${{ vars.ANDROID_API }};${{vars.ANDROID_TARGET}};${{ vars.ANDROID_ARCH }}" --tag "${{vars.ANRDOID_TARGET}}" --sdcard 128M --device "${{ vars.ANDROID_DEVICE }}"
|
2024-07-17 21:36:49 +02:00
|
|
|
echo "Starting AVD"
|
2024-07-17 20:11:44 +02:00
|
|
|
emulator -avd "android_emulator" -no-audio -no-window -no-snapstorage -no-snapshot -gpu swiftshader_indirect -no-boot-anim -no-accel -wipe-data -skip-adb-auth &
|
2024-07-17 21:36:49 +02:00
|
|
|
echo "Wait-for AVD"
|
2024-07-17 20:11:44 +02:00
|
|
|
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82'
|
|
|
|
flutter doctor -v
|
2024-07-17 21:36:49 +02:00
|
|
|
echo "Running test"
|
2024-07-17 22:01:58 +02:00
|
|
|
flutter pub get
|
2024-07-17 20:11:44 +02:00
|
|
|
flutter test integration_test/app_test.dart --coverage --reporter json > tests.output
|
|
|
|
|
|
|
|
- name: Run scanner
|
|
|
|
run: |
|
|
|
|
sonar-scanner
|