diff --git a/.gitea/workflows/apoloz-docker-build.yml b/.gitea/workflows/apoloz-docker-build.yml new file mode 100644 index 00000000..13b45ad0 --- /dev/null +++ b/.gitea/workflows/apoloz-docker-build.yml @@ -0,0 +1,67 @@ +name: Eatvio App Android Test on custom docker + +on: [ pull_request ] + +env: + flutter_version: "3.24.5" + java_version: "21.x" + flutter_channel: "stable" + my_local_cache_dir: "/opt/hostedtoolcache/" + ANDROID_SDK_ROOT: "/opt/hostedtoolcache/Android/Sdk" + +jobs: + build: + runs-on: [ dev-office-flutter ] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Android environment variables + id: "android-env-setup" + run: | + echo "ANDROID_SDK_ROOT=${{ env.my_local_cache_dir }}Android/Sdk" >> $GITHUB_ENV + echo "PATH=$PATH:${{ env.my_local_cache_dir }}Android/Sdk/cmdline-tools/latest/bin:${{ env.my_local_cache_dir }}Android/Sdk/platform-tools:${{ env.my_local_cache_dir }}Android/Sdk/build-tools/30.0.3:${{ env.my_local_cache_dir }}Android/Sdk/build-tools/34.0.0" >> $GITHUB_ENV + echo "ANDROID_HOME=${{ env.my_local_cache_dir }}Android/Sdk" >> $GITHUB_ENV + + - id: flutter-action + uses: actions/flutter-action@v2 + with: + 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: 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 + + - name: Get dependencies + run: flutter pub get + + - name: Native Analyze + run: flutter analyze + + - name: Test + run: flutter test + + - name: Build apk + run: flutter build apk + + - name: Rename and move apk + run: | + TIMESTAMP=$(TZ=Europe/Moscow date +'%Y-%m-%d-%H-%M') + 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 + + - name: Upload APK artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ env.APK_NAME }} + path: ${{ env.APK_NAME }}