forked from eatvio/eatvio_app
Merge pull request 'Обновить .gitea/workflows/test.yml' (#160) from mso7nueh/eatvio_app:main into main
Reviewed-on: eatvio/eatvio_app#160
This commit is contained in:
@@ -3,13 +3,13 @@ name: Eatvio App Android Test
|
||||
on: [ pull_request ]
|
||||
|
||||
env:
|
||||
flutter_version: "3.24.4"
|
||||
flutter_version: "3.24.5"
|
||||
java_version: "21.x"
|
||||
flutter_channel: "stable"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: [ dev-office ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
with:
|
||||
distribution: "zulu"
|
||||
java-version: ${{ env.java_version }}
|
||||
cache: "gradle"
|
||||
id: setup-jdk
|
||||
|
||||
- name: Install Android SDK
|
||||
run: |
|
||||
@@ -31,28 +31,17 @@ jobs:
|
||||
mv cmdline-tools/* $HOME/Android/Sdk/cmdline-tools/latest/
|
||||
export ANDROID_SDK_ROOT=$HOME/Android/Sdk
|
||||
export PATH=$PATH:$HOME/Android/Sdk/cmdline-tools/latest/bin
|
||||
yes | sdkmanager --licenses 2>/dev/null || true
|
||||
yes | sdkmanager --licenses 2>/dev/null || true
|
||||
|
||||
- name: Set up Android environment variables
|
||||
run: |
|
||||
echo "ANDROID_SDK_ROOT=$HOME/Android/Sdk" >> $GITHUB_ENV
|
||||
echo "PATH=$PATH:$HOME/Android/Sdk/cmdline-tools/latest/bin:$HOME/Android/Sdk/platform-tools:$HOME/Android/Sdk/build-tools/30.0.3" >> $GITHUB_ENV
|
||||
echo "ANDROID_HOME=$HOME/Android/Sdk" >> $GITHUB_ENV
|
||||
|
||||
- name: Debug Environment Variables
|
||||
run: |
|
||||
echo "ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT"
|
||||
echo "ANDROID_HOME: $ANDROID_HOME"
|
||||
echo "PATH: $PATH"
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ runner.tool_cache }}/flutter
|
||||
key: flutter-${{ env.flutter_version }}-${{ env.flutter_channel }}
|
||||
echo "ANDROID_HOME=$HOME/Android/Sdk" >> $GITHUB_ENV
|
||||
|
||||
- name: Install jq
|
||||
run: |
|
||||
apt-get install -y jq
|
||||
apt-get install -y jq
|
||||
|
||||
- id: flutter-action
|
||||
uses: actions/flutter-action@v2
|
||||
@@ -61,22 +50,11 @@ jobs:
|
||||
flutter-version: ${{ env.flutter_version }}
|
||||
cache: true
|
||||
|
||||
- name: Show cache keys
|
||||
run: |
|
||||
echo CACHE-PATH=${{ steps.flutter-action.outputs.CACHE-PATH }}
|
||||
echo CACHE-KEY=${{ steps.flutter-action.outputs.CACHE-KEY }}
|
||||
echo CHANNEL=${{ steps.flutter-action.outputs.CHANNEL }}
|
||||
echo VERSION=${{ steps.flutter-action.outputs.VERSION }}
|
||||
echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
|
||||
echo PUB-CACHE-PATH=${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
|
||||
echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}
|
||||
shell: bash
|
||||
|
||||
- name: Fix dir permissions
|
||||
run: |
|
||||
git config --global --add safe.directory /opt/hostedtoolcache/flutter/${{ env.flutter_channel }}-${{ env.flutter_version }}-${{ steps.flutter-action.outputs.ARCHITECTURE }}
|
||||
flutter config --android-sdk="$ANDROID_HOME"
|
||||
flutter doctor -v
|
||||
flutter doctor -v
|
||||
|
||||
- name: Get dependencies
|
||||
run: flutter pub get
|
||||
@@ -84,16 +62,13 @@ jobs:
|
||||
- name: Native Analyze
|
||||
run: flutter analyze
|
||||
|
||||
#- name: Run Code Metrics
|
||||
# run: flutter pub run dart_code_metrics:metrics lib --disable-sunset-warning --fatal-warnings --fatal-performance
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
flutter test
|
||||
flutter test
|
||||
|
||||
- name: Build apk
|
||||
run: |
|
||||
flutter build apk
|
||||
flutter build apk
|
||||
|
||||
- name: Rename and move apk
|
||||
run: |
|
||||
@@ -101,7 +76,7 @@ jobs:
|
||||
APK_NAME="eatvio_app_${TIMESTAMP}.apk"
|
||||
mv build/app/outputs/flutter-apk/app-release.apk $APK_NAME
|
||||
echo "APK build finished $APK_NAME"
|
||||
echo "APK_NAME=$APK_NAME" >> $GITHUB_ENV
|
||||
echo "APK_NAME=$APK_NAME" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload APK artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
|
||||
@@ -25,7 +25,7 @@ class DiaryCubit extends Cubit<DiaryState> {
|
||||
emit(
|
||||
DiaryState.loaded(
|
||||
diary: await diaryRepository.getDiaryByDate(date),
|
||||
nutrition: await getNutrition(await diaryRepository.getDiaryIndexByDate(date)),
|
||||
nutrition: await getNutrition((await diaryRepository.getDiaryByDate(date)).id),
|
||||
currentSelectedSatietyRating: currentSelectedSatietyRating,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -11,14 +11,11 @@ class DiaryRepository {
|
||||
});
|
||||
|
||||
Future<DiaryDayModel> getDiaryByDate(String date) async {
|
||||
return (await diaryService.getDiaryDay(
|
||||
index: await getDiaryIndexByDate(date),
|
||||
))
|
||||
.diary;
|
||||
return (await getDiaryIndexByDate(date)).last;
|
||||
}
|
||||
|
||||
Future<int> getDiaryIndexByDate(String date) async {
|
||||
return (await diaryService.getDiaryIndexByDate(date: date)).id;
|
||||
Future<List<DiaryDayModel>> getDiaryIndexByDate(String date) async {
|
||||
return (await diaryService.getDiaryIndexByDate(date: date));
|
||||
}
|
||||
|
||||
Future<NutritionDataModel> getNutritionData(int index) async {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'dart:io';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:eatvio_app/features/diary/models/diary_day_model.dart';
|
||||
import 'package:eatvio_app/features/diary/models/diary_index_model.dart';
|
||||
import 'package:eatvio_app/features/diary/models/nutrition_model.dart';
|
||||
import 'package:retrofit/retrofit.dart';
|
||||
|
||||
@@ -12,7 +11,7 @@ abstract class DiaryService {
|
||||
factory DiaryService(Dio dio, {String baseUrl}) = _DiaryService;
|
||||
|
||||
@GET('/api/diary/index/{date}')
|
||||
Future<DiaryIndexModel> getDiaryIndexByDate({
|
||||
Future<List<DiaryDayModel>> getDiaryIndexByDate({
|
||||
@Path('date') required String date, // yyyy-mm-dd
|
||||
});
|
||||
|
||||
|
||||
@@ -22,12 +22,13 @@ class _DiaryService implements DiaryService {
|
||||
final ParseErrorLogger? errorLogger;
|
||||
|
||||
@override
|
||||
Future<DiaryIndexModel> getDiaryIndexByDate({required String date}) async {
|
||||
Future<List<DiaryDayModel>> getDiaryIndexByDate(
|
||||
{required String date}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<DiaryIndexModel>(Options(
|
||||
final _options = _setStreamType<List<DiaryDayModel>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
@@ -43,10 +44,12 @@ class _DiaryService implements DiaryService {
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late DiaryIndexModel _value;
|
||||
final _result = await _dio.fetch<List<dynamic>>(_options);
|
||||
late List<DiaryDayModel> _value;
|
||||
try {
|
||||
_value = DiaryIndexModel.fromJson(_result.data!);
|
||||
_value = _result.data!
|
||||
.map((dynamic i) => DiaryDayModel.fromJson(i as Map<String, dynamic>))
|
||||
.toList();
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
|
||||
@@ -124,7 +124,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
if (widget.author == null) const SizedBox(height: 16),
|
||||
_activePlans(state),
|
||||
if (widget.author == null) const SizedBox(height: 16),
|
||||
_newBlogPostButton(),
|
||||
if (widget.author == null) _newBlogPostButton(),
|
||||
_blogPosts(state),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: eatvio_app
|
||||
description: A new Flutter project.
|
||||
version: 0.0.0+1
|
||||
version: 1.0.2+17
|
||||
publish_to: "none"
|
||||
|
||||
environment:
|
||||
|
||||
Reference in New Issue
Block a user