From 62c8a52e2a802c87b5da77a11e474d71ed79d389 Mon Sep 17 00:00:00 2001 From: "Dr.Blank" <64108942+Dr-Blank@users.noreply.github.com> Date: Fri, 4 Apr 2025 21:46:51 +0530 Subject: [PATCH] Refactor CI workflow to separate setup, testing, and building steps; add Linux AppImage packaging support --- .github/workflows/flutter_test.yaml | 58 +++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/.github/workflows/flutter_test.yaml b/.github/workflows/flutter_test.yaml index 3be6733..21eb8c2 100644 --- a/.github/workflows/flutter_test.yaml +++ b/.github/workflows/flutter_test.yaml @@ -10,16 +10,28 @@ on: workflow_dispatch: jobs: - test: + setup: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: - # This ensures submodules are cloned submodules: recursive + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + flutter-version-file: pubspec.yaml + - name: Install dependencies + run: flutter pub get + + test: + needs: setup + runs-on: ubuntu-latest + + steps: # Debug: Echo current directory contents - name: List root directory contents run: | @@ -47,28 +59,44 @@ jobs: - name: Decode android/key.properties run: echo "${{ secrets.KEY_PROPERTIES }}" | base64 --decode > android/key.properties - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - channel: "stable" - - - name: Install dependencies - run: flutter pub get - - - name: Run tests + - name: Run flutter tests run: flutter test + build_android: + needs: test + runs-on: ubuntu-latest + steps: - name: Set Up Java uses: actions/setup-java@v3.12.0 with: distribution: "oracle" java-version: "17" - - name: Build APK + - name: Build Universal APK run: flutter build apk --release - - name: Upload APKs + - name: Rename Universal APK + run: mv build/app/outputs/flutter-apk/{app-release,app-universal-release}.apk + + build_linux: + needs: test + runs-on: ubuntu-latest + + steps: + - name: setup fastforge + run: | + dart pub global activate fastforge + - name: Build Linux AppImage + run: fastforge package --platform linux --targets deb + + upload_artifacts: + needs: [build_android, build_linux] + runs-on: ubuntu-latest + steps: + - name: Upload Artifacts uses: actions/upload-artifact@v4 with: - name: app-release - path: build/app/outputs/flutter-apk/*.apk + name: build-artifacts + path: | + build/app/outputs/flutter-apk/*.apk + dist/*/*.deb