From 41ade02acebab3faba242b46d65d4060dc0b7b6d Mon Sep 17 00:00:00 2001 From: rang <378694192@qq.com> Date: Sat, 25 Oct 2025 16:43:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=85=A8=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/flutter-ci.yaml | 317 +++++++++++++++--------------- 1 file changed, 158 insertions(+), 159 deletions(-) diff --git a/.github/workflows/flutter-ci.yaml b/.github/workflows/flutter-ci.yaml index 78c2dab..f2b06f6 100644 --- a/.github/workflows/flutter-ci.yaml +++ b/.github/workflows/flutter-ci.yaml @@ -9,192 +9,192 @@ on: workflow_dispatch: jobs: - # test: - # name: Test - # runs-on: ubuntu-latest - # steps: - # - name: Checkout repository - # uses: actions/checkout@v4 - # with: - # submodules: recursive + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive - # - name: Setup Flutter Environment - # uses: ./.github/actions/flutter-setup # Path to the composite action directory - # # Pass inputs if needed (optional, using defaults here) - # # with: - # # flutter-channel: 'stable' - # # java-version: '17' - # # Debug: Echo current directory contents - # - name: List root directory contents - # run: | - # pwd - # ls -la + - name: Setup Flutter Environment + uses: ./.github/actions/flutter-setup # Path to the composite action directory + # Pass inputs if needed (optional, using defaults here) + # with: + # flutter-channel: 'stable' + # java-version: '17' + # Debug: Echo current directory contents + - name: List root directory contents + run: | + pwd + ls -la - # # Debug: Recursive directory structure - # - name: Show full directory structure - # run: | - # echo "Full directory structure:" - # tree -L 3 + # Debug: Recursive directory structure + - name: Show full directory structure + run: | + echo "Full directory structure:" + tree -L 3 - # # Debug: Submodule status and details - # - name: Check submodule status - # run: | - # echo "Submodule status:" - # git submodule status + # Debug: Submodule status and details + - name: Check submodule status + run: | + echo "Submodule status:" + git submodule status - # echo "\nSubmodule details:" - # git submodule foreach 'echo $path: && pwd && ls -la' + echo "\nSubmodule details:" + git submodule foreach 'echo $path: && pwd && ls -la' - # # - name: Run static analysis - # # run: flutter analyze + # - name: Run static analysis + # run: flutter analyze - # - name: Check formatting - # run: | - # dart format -o none --set-exit-if-changed lib/ + - name: Check formatting + run: | + dart format -o none --set-exit-if-changed lib/ - # - name: Run tests - # run: flutter test + - name: Run tests + run: flutter test - # build_android: - # name: Build Android APKs - # needs: test - # runs-on: ubuntu-latest - # steps: - # - name: Checkout repository - # uses: actions/checkout@v4 - # with: - # submodules: recursive - # - name: Setup Flutter Environment - # uses: ./.github/actions/flutter-setup # Path to the composite action directory - # with: - # flutter-channel: stable - # java-version: 17 + build_android: + name: Build Android APKs + needs: test + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Setup Flutter Environment + uses: ./.github/actions/flutter-setup # Path to the composite action directory + with: + flutter-channel: stable + java-version: 17 - # - name: Accept Android SDK Licenses - # run: | - # yes | sudo $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses + - name: Accept Android SDK Licenses + run: | + yes | sudo $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses - # - name: Decode android/upload.jks - # run: echo "${{ secrets.UPLOAD_KEYSTORE_JKS }}" | base64 --decode > android/upload.jks + - name: Decode android/upload.jks + run: echo "${{ secrets.UPLOAD_KEYSTORE_JKS }}" | base64 --decode > android/upload.jks - # - name: Decode android/key.properties - # run: echo "${{ secrets.KEY_PROPERTIES }}" | base64 --decode > android/key.properties + - name: Decode android/key.properties + run: echo "${{ secrets.KEY_PROPERTIES }}" | base64 --decode > android/key.properties - # - name: Build APKs - # run: flutter build apk --release --split-per-abi + - name: Build APKs + run: flutter build apk --release --split-per-abi - # - name: Build Universal APK - # run: flutter build apk --release + - name: Build Universal APK + run: flutter build apk --release - # - name: Rename Universal APK - # run: mv build/app/outputs/flutter-apk/{app-release,app-universal-release}.apk + - name: Rename Universal APK + run: mv build/app/outputs/flutter-apk/{app-release,app-universal-release}.apk - # - name: Build App Bundle - # run: flutter build appbundle --release + - name: Build App Bundle + run: flutter build appbundle --release - # - name: Upload Android APK Artifact - # uses: actions/upload-artifact@v4 - # with: - # name: android-release-artifacts - # path: | - # build/app/outputs/flutter-apk/*-release*.apk - # build/app/outputs/bundle/release/*.aab + - name: Upload Android APK Artifact + uses: actions/upload-artifact@v4 + with: + name: android-release-artifacts + path: | + build/app/outputs/flutter-apk/*-release*.apk + build/app/outputs/bundle/release/*.aab - # build_linux: - # needs: test - # runs-on: ubuntu-latest + build_linux: + needs: test + runs-on: ubuntu-latest - # steps: - # - name: Checkout repository - # uses: actions/checkout@v4 - # with: - # submodules: recursive - # - name: Setup Flutter Environment - # uses: ./.github/actions/flutter-setup # Path to the composite action directory + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Setup Flutter Environment + uses: ./.github/actions/flutter-setup # Path to the composite action directory - # - name: Install Linux dependencies - # run: | - # sudo apt-get update -y - # sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev locate libfuse2 - # # Download and install appimagetool - # wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage - # chmod +x appimagetool-x86_64.AppImage - # sudo mv appimagetool-x86_64.AppImage /usr/local/bin/appimagetool - # shell: bash - # - name: setup fastforge - # run: | - # dart pub global activate fastforge - # - name: Build Linux AppImage and deb - # run: fastforge package --platform linux --targets deb,appimage + - name: Install Linux dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev locate libfuse2 + # Download and install appimagetool + wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage + chmod +x appimagetool-x86_64.AppImage + sudo mv appimagetool-x86_64.AppImage /usr/local/bin/appimagetool + shell: bash + - name: setup fastforge + run: | + dart pub global activate fastforge + - name: Build Linux AppImage and deb + run: fastforge package --platform linux --targets deb,appimage - # - name: Rename Linux Artifacts - # run: | - # # Find and rename .deb file - # DEB_FILE=$(find dist/ -name "*.deb" -type f) - # if [ -n "$DEB_FILE" ]; then - # mv "$DEB_FILE" dist/vaani-linux-amd64.deb - # echo "Renamed DEB: $DEB_FILE to dist/vaani-linux-amd64.deb" - # else - # echo "Error: .deb file not found in dist/" - # exit 1 - # fi + - name: Rename Linux Artifacts + run: | + # Find and rename .deb file + DEB_FILE=$(find dist/ -name "*.deb" -type f) + if [ -n "$DEB_FILE" ]; then + mv "$DEB_FILE" dist/vaani-linux-amd64.deb + echo "Renamed DEB: $DEB_FILE to dist/vaani-linux-amd64.deb" + else + echo "Error: .deb file not found in dist/" + exit 1 + fi - # # Find and rename .AppImage file - # APPIMAGE_FILE=$(find dist/ -name "*.AppImage" -type f) - # if [ -n "$APPIMAGE_FILE" ]; then - # mv "$APPIMAGE_FILE" dist/vaani-linux-amd64.AppImage - # echo "Renamed AppImage: $APPIMAGE_FILE to dist/vaani-linux-amd64.AppImage" - # else - # echo "Error: .AppImage file not found in dist/" - # exit 1 - # fi - # shell: bash + # Find and rename .AppImage file + APPIMAGE_FILE=$(find dist/ -name "*.AppImage" -type f) + if [ -n "$APPIMAGE_FILE" ]; then + mv "$APPIMAGE_FILE" dist/vaani-linux-amd64.AppImage + echo "Renamed AppImage: $APPIMAGE_FILE to dist/vaani-linux-amd64.AppImage" + else + echo "Error: .AppImage file not found in dist/" + exit 1 + fi + shell: bash - # - name: Upload Linux Artifacts - # uses: actions/upload-artifact@v4 - # with: - # name: linux-release-artifacts - # path: | - # dist/vaani-linux-amd64.deb - # dist/vaani-linux-amd64.AppImage + - name: Upload Linux Artifacts + uses: actions/upload-artifact@v4 + with: + name: linux-release-artifacts + path: | + dist/vaani-linux-amd64.deb + dist/vaani-linux-amd64.AppImage - # build_windows: - # needs: test - # runs-on: windows-latest - # permissions: - # contents: write - # steps: - # - name: Checkout repository - # uses: actions/checkout@v4 - # with: - # submodules: recursive + build_windows: + needs: test + runs-on: windows-latest + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive - # - name: Setup Flutter - # uses: subosito/flutter-action@v2 - # with: - # flutter-version: "3.32.0" - # cache: true + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: "3.32.0" + cache: true - # - name: Restore Packages - # run: | - # flutter pub get + - name: Restore Packages + run: | + flutter pub get - # - name: Install flutter_distributor - # run: dart pub global activate flutter_distributor + - name: Install flutter_distributor + run: dart pub global activate flutter_distributor - # - name: Build Windows - # run: | - # flutter_distributor package --platform windows --targets msix,zip --skip-clean + - name: Build Windows + run: | + flutter_distributor package --platform windows --targets msix,zip --skip-clean - # - name: Upload Windows Artifacts - # uses: actions/upload-artifact@v4 - # with: - # name: windows-release-artifacts - # path: | - # dist/*/*.msix - # dist/*/*.zip + - name: Upload Windows Artifacts + uses: actions/upload-artifact@v4 + with: + name: windows-release-artifacts + path: | + dist/*/*.msix + dist/*/*.zip - build_macos: + build_ios_macos: # needs: test runs-on: macos-latest permissions: @@ -256,8 +256,7 @@ jobs: # Job 4: Create GitHub Release (NEW - runs only on tag pushes) create_release: name: Create GitHub Release - # needs: [build_android, build_linux, build_windows, build_macos] # Depends on successful builds - needs: build_macos # Depends on successful builds + needs: [build_android, build_linux, build_windows, build_ios_macos] # Depends on successful builds runs-on: ubuntu-latest permissions: contents: write # Need write access to create release