This commit is contained in:
parent
8e46b936a8
commit
e1d3a54ebf
8 changed files with 61 additions and 3 deletions
45
.forgejo/workflows/sq_analyze.yml
Normal file
45
.forgejo/workflows/sq_analyze.yml
Normal 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
|
|
@ -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(
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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
7
sonar-project.properties
Normal 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
|
3
test_driver/integration_test.dart
Normal file
3
test_driver/integration_test.dart
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import 'package:integration_test/integration_test_driver.dart';
|
||||||
|
|
||||||
|
Future<void> main() => integrationDriver();
|
Loading…
Reference in a new issue