prasule/.forgejo/workflows/sq_analyze.yml

76 lines
3.1 KiB
YAML
Raw Normal View History

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
2024-07-17 22:29:49 +02:00
with:
log-accepted-android-sdk-licenses: false
packages: "tools platform-tools emulator"
2024-07-17 22:01:58 +02:00
- name: Install Flutter
2024-07-17 20:11:44 +02:00
run: |
2024-07-17 22:11:27 +02:00
wget -nv https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${{ vars.FLUTTER_VERSION }}-stable.tar.xz -O flutter.tar.xz
2024-07-17 22:21:26 +02:00
tar -xf flutter.tar.xz -C $HOME
export PATH=$PATH:$HOME/flutter/bin
2024-07-17 22:01:58 +02:00
rm flutter.tar.xz
flutter doctor -v
2024-07-17 22:11:27 +02:00
flutter config --no-cli-animations
flutter config --disable-analytics
2024-07-18 00:18:01 +02:00
flutter channel beta
2024-07-17 21:36:49 +02:00
- name: Run tests
run: |
2024-07-18 00:10:07 +02:00
export PATH=$PATH:$HOME/flutter/bin:$ANDROID_HOME/emulator
2024-07-17 21:36:49 +02:00
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 23:59:46 +02:00
sleep 10
echo Done
2024-07-17 20:11:44 +02:00
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