From c2cc786c5fe85bc6f4d0cddc78658104e6b85352 Mon Sep 17 00:00:00 2001 From: Anatoliy Poloz Date: Tue, 27 Feb 2024 16:59:00 +0300 Subject: [PATCH 1/4] ci(build): adding cache --- .gitea/workflows/build.yml | 14 +++++++- .gitea/workflows/test.yml | 70 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/test.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 2219ffb5..9c77fd3d 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -20,7 +20,8 @@ jobs: java-version: "12.x" cache: "gradle" - - uses: actions/flutter-action@v2 + - id: flutter-action + uses: actions/flutter-action@v2 with: channel: "stable" flutter-version: "3.19.0" @@ -30,6 +31,17 @@ jobs: pub-cache-key: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache of dart pub get dependencies pub-cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path + - 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/stable-3.19.0-x64 diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 00000000..8ff664f3 --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,70 @@ +name: Eatvio App Test + +on: [pull_request] + +env: + flutter_version: "3.19.0" + java_version: "12.x" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install jq + run: | + apt update + apt-get install -y jq + + - uses: actions/setup-java@v3 + with: + distribution: "zulu" + java-version: ${{ env.java_version }} + cache: "gradle" + + - name: Cache Flutter dependencies + uses: actions/cache@v2 + with: + path: /opt/hostedtoolcache/flutter + key: ${{ runner.OS }}-flutter-install-cache-${{ env.flutter_version }} + + - id: flutter-action + uses: actions/flutter-action@v2 + with: + channel: "stable" + flutter-version: ${{ env.flutter_version }} + cache: true + cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache + cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path + pub-cache-key: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache of dart pub get dependencies + pub-cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path + + - 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/stable-3.19.0-x64 + flutter --version + + - name: Get dependencies + run: flutter pub get + + - name: Run Code Metrics + run: flutter pub run dart_code_metrics:metrics lib --disable-sunset-warning --fatal-warnings --fatal-performance +# - name: Build apk +# run: flutter build apk + +# Runs a set of commands using the runners shell +# - name: Start release build +# run: flutter build appbundle From 375f739fd3c9404ad9419960e9422e5a78ef5c22 Mon Sep 17 00:00:00 2001 From: apoloz Date: Tue, 27 Feb 2024 14:55:24 +0000 Subject: [PATCH 2/4] Update .gitea/workflows/build.yml --- .gitea/workflows/build.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 9c77fd3d..8a77f93a 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -2,12 +2,21 @@ name: Android Release on: [push, pull_request] +env: + flutter_version: "3.19.0" + java_version: "12.x" + flutter_channel: "stable" + jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions/cache@v2 + with: + path: ${{ runner.tool_cache }}/flutter + key: flutter-${{ env.flutter_version }}-${{ env.flutter_channel }} - name: Install jq run: | @@ -23,13 +32,9 @@ jobs: - id: flutter-action uses: actions/flutter-action@v2 with: - channel: "stable" - flutter-version: "3.19.0" + channel: ${{ env.flutter_version }} + flutter-version: ${{ env.flutter_channel }} cache: true - cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache - cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path - pub-cache-key: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache of dart pub get dependencies - pub-cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path - name: show cache keys run: | @@ -50,8 +55,17 @@ jobs: - name: Get dependencies run: flutter pub get + - 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: | + touch .env + flutter test --coverage + # - name: Build apk # run: flutter build apk From e655434ede5444cb8dc043587289ae5615b07a94 Mon Sep 17 00:00:00 2001 From: apoloz Date: Tue, 27 Feb 2024 14:56:41 +0000 Subject: [PATCH 3/4] Update .gitea/workflows/build.yml --- .gitea/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 8a77f93a..b2c91eb8 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -32,8 +32,8 @@ jobs: - id: flutter-action uses: actions/flutter-action@v2 with: - channel: ${{ env.flutter_version }} - flutter-version: ${{ env.flutter_channel }} + channel: ${{ env.flutter_channel }} + flutter-version: ${{ env.flutter_version }} cache: true - name: show cache keys From 9bbf65357e48ead59dec61afdf41c9c8ff3fd886 Mon Sep 17 00:00:00 2001 From: Anatoliy Poloz Date: Tue, 27 Feb 2024 18:07:03 +0300 Subject: [PATCH 4/4] ci(tests): tests added --- .gitea/workflows/build.yml | 8 ++++---- .gitea/workflows/test.yml | 35 ++++++++++++++++------------------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index b2c91eb8..e8f9d11f 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -33,7 +33,7 @@ jobs: uses: actions/flutter-action@v2 with: channel: ${{ env.flutter_channel }} - flutter-version: ${{ env.flutter_version }} + flutter-version: ${{ env.flutter_version }} cache: true - name: show cache keys @@ -49,7 +49,7 @@ jobs: - name: fix dir permissions run: | - git config --global --add safe.directory /opt/hostedtoolcache/flutter/stable-3.19.0-x64 + git config --global --add safe.directory /opt/hostedtoolcache/flutter/${{ env.flutter_channel }}-${{ env.flutter_version }}-${{ steps.flutter-action.outputs.ARCHITECTURE }} flutter --version - name: Get dependencies @@ -64,8 +64,8 @@ jobs: - name: Test run: | touch .env - flutter test --coverage - + flutter test + # - name: Build apk # run: flutter build apk diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 8ff664f3..b5f75243 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -1,10 +1,11 @@ -name: Eatvio App Test +name: Eatvio App Android Test on: [pull_request] env: flutter_version: "3.19.0" java_version: "12.x" + flutter_channel: "stable" jobs: build: @@ -12,6 +13,10 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: actions/cache@v2 + with: + path: ${{ runner.tool_cache }}/flutter + key: flutter-${{ env.flutter_version }}-${{ env.flutter_channel }} - name: Install jq run: | @@ -21,25 +26,15 @@ jobs: - uses: actions/setup-java@v3 with: distribution: "zulu" - java-version: ${{ env.java_version }} + java-version: "12.x" cache: "gradle" - - name: Cache Flutter dependencies - uses: actions/cache@v2 - with: - path: /opt/hostedtoolcache/flutter - key: ${{ runner.OS }}-flutter-install-cache-${{ env.flutter_version }} - - id: flutter-action uses: actions/flutter-action@v2 with: - channel: "stable" + channel: ${{ env.flutter_channel }} flutter-version: ${{ env.flutter_version }} cache: true - cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache - cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path - pub-cache-key: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache of dart pub get dependencies - pub-cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path - name: show cache keys run: | @@ -54,17 +49,19 @@ jobs: - name: fix dir permissions run: | - git config --global --add safe.directory /opt/hostedtoolcache/flutter/stable-3.19.0-x64 + git config --global --add safe.directory /opt/hostedtoolcache/flutter/${{ env.flutter_channel }}-${{ env.flutter_version }}-${{ steps.flutter-action.outputs.ARCHITECTURE }} flutter --version - name: Get dependencies run: flutter pub get + - 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: Build apk -# run: flutter build apk -# Runs a set of commands using the runners shell -# - name: Start release build -# run: flutter build appbundle + - name: Test + run: | + touch .env + flutter test