测试全平台自动构建

This commit is contained in:
rang 2025-10-25 16:43:34 +08:00
parent 750b2ba987
commit 41ade02ace

View file

@ -9,192 +9,192 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
# test: test:
# name: Test name: Test
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# steps: steps:
# - name: Checkout repository - name: Checkout repository
# uses: actions/checkout@v4 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: # with:
# submodules: recursive # flutter-channel: 'stable'
# java-version: '17'
# Debug: Echo current directory contents
- name: List root directory contents
run: |
pwd
ls -la
# - name: Setup Flutter Environment # Debug: Recursive directory structure
# uses: ./.github/actions/flutter-setup # Path to the composite action directory - name: Show full directory structure
# # Pass inputs if needed (optional, using defaults here) run: |
# # with: echo "Full directory structure:"
# # flutter-channel: 'stable' tree -L 3
# # java-version: '17'
# # Debug: Echo current directory contents
# - name: List root directory contents
# run: |
# pwd
# ls -la
# # Debug: Recursive directory structure # Debug: Submodule status and details
# - name: Show full directory structure - name: Check submodule status
# run: | run: |
# echo "Full directory structure:" echo "Submodule status:"
# tree -L 3 git submodule status
# # Debug: Submodule status and details echo "\nSubmodule details:"
# - name: Check submodule status git submodule foreach 'echo $path: && pwd && ls -la'
# run: |
# echo "Submodule status:"
# git submodule status
# echo "\nSubmodule details:" # - name: Run static analysis
# git submodule foreach 'echo $path: && pwd && ls -la' # run: flutter analyze
# # - name: Run static analysis - name: Check formatting
# # run: flutter analyze run: |
dart format -o none --set-exit-if-changed lib/
# - name: Check formatting - name: Run tests
# run: | run: flutter test
# dart format -o none --set-exit-if-changed lib/
# - name: Run tests build_android:
# run: flutter test 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: Accept Android SDK Licenses
# name: Build Android APKs run: |
# needs: test yes | sudo $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses
# 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 - name: Decode android/upload.jks
# run: | run: echo "${{ secrets.UPLOAD_KEYSTORE_JKS }}" | base64 --decode > android/upload.jks
# yes | sudo $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses
# - name: Decode android/upload.jks - name: Decode android/key.properties
# run: echo "${{ secrets.UPLOAD_KEYSTORE_JKS }}" | base64 --decode > android/upload.jks run: echo "${{ secrets.KEY_PROPERTIES }}" | base64 --decode > android/key.properties
# - name: Decode android/key.properties - name: Build APKs
# run: echo "${{ secrets.KEY_PROPERTIES }}" | base64 --decode > android/key.properties run: flutter build apk --release --split-per-abi
# - name: Build APKs - name: Build Universal APK
# run: flutter build apk --release --split-per-abi run: flutter build apk --release
# - name: Build Universal APK - name: Rename Universal APK
# run: flutter build apk --release run: mv build/app/outputs/flutter-apk/{app-release,app-universal-release}.apk
# - name: Rename Universal APK - name: Build App Bundle
# run: mv build/app/outputs/flutter-apk/{app-release,app-universal-release}.apk run: flutter build appbundle --release
# - name: Build App Bundle - name: Upload Android APK Artifact
# run: flutter build appbundle --release 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 build_linux:
# uses: actions/upload-artifact@v4 needs: test
# with: runs-on: ubuntu-latest
# name: android-release-artifacts
# path: |
# build/app/outputs/flutter-apk/*-release*.apk
# build/app/outputs/bundle/release/*.aab
# build_linux: steps:
# needs: test - name: Checkout repository
# runs-on: ubuntu-latest uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Flutter Environment
uses: ./.github/actions/flutter-setup # Path to the composite action directory
# steps: - name: Install Linux dependencies
# - name: Checkout repository run: |
# uses: actions/checkout@v4 sudo apt-get update -y
# with: sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev locate libfuse2
# submodules: recursive # Download and install appimagetool
# - name: Setup Flutter Environment wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
# uses: ./.github/actions/flutter-setup # Path to the composite action directory 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 - name: Rename Linux Artifacts
# run: | run: |
# sudo apt-get update -y # Find and rename .deb file
# sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev locate libfuse2 DEB_FILE=$(find dist/ -name "*.deb" -type f)
# # Download and install appimagetool if [ -n "$DEB_FILE" ]; then
# wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage mv "$DEB_FILE" dist/vaani-linux-amd64.deb
# chmod +x appimagetool-x86_64.AppImage echo "Renamed DEB: $DEB_FILE to dist/vaani-linux-amd64.deb"
# sudo mv appimagetool-x86_64.AppImage /usr/local/bin/appimagetool else
# shell: bash echo "Error: .deb file not found in dist/"
# - name: setup fastforge exit 1
# run: | fi
# dart pub global activate fastforge
# - name: Build Linux AppImage and deb
# run: fastforge package --platform linux --targets deb,appimage
# - name: Rename Linux Artifacts # Find and rename .AppImage file
# run: | APPIMAGE_FILE=$(find dist/ -name "*.AppImage" -type f)
# # Find and rename .deb file if [ -n "$APPIMAGE_FILE" ]; then
# DEB_FILE=$(find dist/ -name "*.deb" -type f) mv "$APPIMAGE_FILE" dist/vaani-linux-amd64.AppImage
# if [ -n "$DEB_FILE" ]; then echo "Renamed AppImage: $APPIMAGE_FILE to dist/vaani-linux-amd64.AppImage"
# mv "$DEB_FILE" dist/vaani-linux-amd64.deb else
# echo "Renamed DEB: $DEB_FILE to dist/vaani-linux-amd64.deb" echo "Error: .AppImage file not found in dist/"
# else exit 1
# echo "Error: .deb file not found in dist/" fi
# exit 1 shell: bash
# fi
# # Find and rename .AppImage file - name: Upload Linux Artifacts
# APPIMAGE_FILE=$(find dist/ -name "*.AppImage" -type f) uses: actions/upload-artifact@v4
# if [ -n "$APPIMAGE_FILE" ]; then with:
# mv "$APPIMAGE_FILE" dist/vaani-linux-amd64.AppImage name: linux-release-artifacts
# echo "Renamed AppImage: $APPIMAGE_FILE to dist/vaani-linux-amd64.AppImage" path: |
# else dist/vaani-linux-amd64.deb
# echo "Error: .AppImage file not found in dist/" dist/vaani-linux-amd64.AppImage
# exit 1
# fi
# shell: bash
# - name: Upload Linux Artifacts build_windows:
# uses: actions/upload-artifact@v4 needs: test
# with: runs-on: windows-latest
# name: linux-release-artifacts permissions:
# path: | contents: write
# dist/vaani-linux-amd64.deb steps:
# dist/vaani-linux-amd64.AppImage - name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
# build_windows: - name: Setup Flutter
# needs: test uses: subosito/flutter-action@v2
# runs-on: windows-latest with:
# permissions: flutter-version: "3.32.0"
# contents: write cache: true
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# submodules: recursive
# - name: Setup Flutter - name: Restore Packages
# uses: subosito/flutter-action@v2 run: |
# with: flutter pub get
# flutter-version: "3.32.0"
# cache: true
# - name: Restore Packages - name: Install flutter_distributor
# run: | run: dart pub global activate flutter_distributor
# flutter pub get
# - name: Install flutter_distributor - name: Build Windows
# run: dart pub global activate flutter_distributor run: |
flutter_distributor package --platform windows --targets msix,zip --skip-clean
# - name: Build Windows - name: Upload Windows Artifacts
# run: | uses: actions/upload-artifact@v4
# flutter_distributor package --platform windows --targets msix,zip --skip-clean with:
name: windows-release-artifacts
path: |
dist/*/*.msix
dist/*/*.zip
# - name: Upload Windows Artifacts build_ios_macos:
# uses: actions/upload-artifact@v4
# with:
# name: windows-release-artifacts
# path: |
# dist/*/*.msix
# dist/*/*.zip
build_macos:
# needs: test # needs: test
runs-on: macos-latest runs-on: macos-latest
permissions: permissions:
@ -256,8 +256,7 @@ jobs:
# Job 4: Create GitHub Release (NEW - runs only on tag pushes) # Job 4: Create GitHub Release (NEW - runs only on tag pushes)
create_release: create_release:
name: Create GitHub Release name: Create GitHub Release
# needs: [build_android, build_linux, build_windows, build_macos] # Depends on successful builds needs: [build_android, build_linux, build_windows, build_ios_macos] # Depends on successful builds
needs: build_macos # Depends on successful builds
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write # Need write access to create release contents: write # Need write access to create release