Compare commits

...

2 commits

Author SHA1 Message Date
Matyáš Caras
e95fb87c6a
Added translation using Weblate (Slovak) 2024-07-17 20:12:00 +02:00
e1d3a54ebf
ci: basic sonarqube action
Some checks failed
/ build (push) Failing after 3m7s
2024-07-17 20:11:44 +02:00
9 changed files with 62 additions and 3 deletions

View file

@ -0,0 +1,45 @@
on:
push:
branches:
- 'dev'
env:
SONAR_TOKEN: ${{ secrets.SQ_KEY }}
jobs:
build:
runs-on: flutter-beta
steps:
- 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"
- name: Initialize AVD
run: |
sdkmanager "platform-tools" "platforms;android-${{ vars.ANDROID_API }}"
sdkmanager --install "system-images;android-${apiLevel};${{ vars.ANDROID_TARGET }}${{ vars.ANDROID_ARCH }}"
sdkmanager --update
echo "y" | sdkmanager --licenses
sdkmanager --list
echo "no" | avdmanager -v create avd --force --name "android_emulator" --package "system-images;android-${apiLevel};${target};${arch}" --tag "${target}" --sdcard 128M --device "${{ vars.ANDROID_DEVICE }}"
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 &
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82'
flutter doctor -v
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
flutter pub get
- name: Run tests
run: |
flutter test integration_test/app_test.dart --coverage --reporter json > tests.output
- name: Run scanner
run: |
sonar-scanner

View file

@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart'; import 'package:integration_test/integration_test.dart';
import 'package:logger/logger.dart'; import 'package:logger/logger.dart';
import 'package:path_provider/path_provider.dart';
import 'package:prasule/api/category.dart'; import 'package:prasule/api/category.dart';
import 'package:prasule/api/entry_data.dart'; import 'package:prasule/api/entry_data.dart';
import 'package:prasule/api/wallet.dart'; import 'package:prasule/api/wallet.dart';
@ -18,7 +19,10 @@ import 'package:prasule/pw/platformfield.dart';
void main() { void main() {
final logger = Logger(); final logger = Logger();
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); IntegrationTestWidgetsFlutterBinding.ensureInitialized();
setUp(() async {
WalletManager.walletPath =
"${(await getApplicationDocumentsDirectory()).path}/wallets";
});
group("Test classes and API", () { group("Test classes and API", () {
test("Test wallet operations", () async { test("Test wallet operations", () async {
expect( expect(

View file

@ -33,7 +33,6 @@ class WalletManager {
for (final w in path for (final w in path
.listSync() .listSync()
.whereType<File>() .whereType<File>()
.where((e) => e.path.endsWith(".json"))
.map((e) => e.path.split("/").last) .map((e) => e.path.split("/").last)
.toList()) { .toList()) {
try { try {

1
lib/l10n/app_sk.arb Normal file
View file

@ -0,0 +1 @@
{}

View file

@ -23,7 +23,7 @@ class _InitializationScreenState extends State<InitializationScreen> {
void initState() { void initState() {
super.initState(); super.initState();
getApplicationDocumentsDirectory().then((v) { getApplicationDocumentsDirectory().then((v) {
WalletManager.walletPath = v.path; WalletManager.walletPath = "${v.path}/wallets";
if (!mounted) return; if (!mounted) return;
final wallets = WalletManager.listWallets(); final wallets = WalletManager.listWallets();
if (wallets.isEmpty && mounted) { if (wallets.isEmpty && mounted) {

7
sonar-project.properties Normal file
View file

@ -0,0 +1,7 @@
sonar.projectKey=prasule
sonar.sources=lib,pubspec.yaml
sonar.tests=test
sonar.dart.analyzer.mode=MANUAL
sonar.dart.analyzer.report.path=
sonar.dart.analyzer.options.override=true
sonar.host.url=https://sq.mnau.xyz

View file

@ -0,0 +1,3 @@
import 'package:integration_test/integration_test_driver.dart';
Future<void> main() => integrationDriver();