ci: 移除不再需要的Flutter安装脚本并修正CI文件格式

移除install_flutter.bat脚本,因为Flutter安装已不再需要
修正docker.yml文件中的换行符问题
This commit is contained in:
shanshanzhong 2025-11-08 10:05:31 -08:00
parent fafad1ff97
commit 88091e84c0
2 changed files with 1 additions and 166 deletions

View File

@ -190,8 +190,7 @@ jobs:
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Enable Windows desktop
run: flutter config --enable-windows-desktop
@ -219,126 +218,3 @@ jobs:
with:
name: windows-release-build
path: build/windows/runner/Release/
# 本地act验证作业只验证 Git PATH 与 checkout/submodules
build-act-windows:
name: ACT Windows Checkout Verification
if: ${{ env.ACT == 'true' }}
runs-on: windows-latest
steps:
- name: Add Git to PATH (Windows)
shell: powershell
run: |
$paths = @(
'C:\Program Files\Git\cmd',
'C:\Program Files\Git\bin',
'C:\Program Files (x86)\Git\cmd',
'C:\Program Files (x86)\Git\bin'
)
foreach ($p in $paths) {
if (Test-Path $p) {
Add-Content -Path $env:GITHUB_PATH -Value $p
$env:PATH = "$p;$env:PATH"
Write-Host ("Added to PATH: {0}" -f $p)
}
}
$candidates = @(
'C:\Program Files\Git\cmd\git.exe',
'C:\Program Files\Git\bin\git.exe',
'C:\Program Files (x86)\Git\cmd\git.exe',
'C:\Program Files (x86)\Git\bin\git.exe'
)
$found = $false
foreach ($g in $candidates) {
if (Test-Path $g) {
& $g --version
$found = $true
break
}
}
if (-not $found) {
Write-Host "Git executable not found in common locations; continuing."
}
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
persist-credentials: false
# 仅用于本地 act 验证:目录级稀疏检出,避免包含 Windows 非法文件
sparse-checkout: |
.github
lib
libcore
android
ios
windows
assets/core
assets/fonts
assets/translations
sparse-checkout-cone: true
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.35.5'
channel: 'stable'
- name: Enable Windows desktop
run: flutter config --enable-windows-desktop
- name: 🔍 Verify jq Installation (ACT)
shell: powershell
run: |
# Check if jq is available
$jqFound = $false
try {
$version = jq --version 2>&1
if ($version -match 'jq-[\d\.]+') {
Write-Host "jq is already installed: $version"
$jqFound = $true
}
} catch {
Write-Host "jq not installed or not in PATH"
}
if (-not $jqFound) {
Write-Host "Preparing to install jq..."
# Check if Chocolatey is available
$chocoFound = $false
try {
choco --version 2>&1 | Out-Null
$chocoFound = $true
} catch {}
if (-not $chocoFound) {
Write-Host "Installing Chocolatey..."
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
# Refresh PATH
$env:PATH = [System.Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' + [System.Environment]::GetEnvironmentVariable('PATH', 'User')
Write-Host "Chocolatey installed successfully"
}
Write-Host "Installing jq using Chocolatey..."
choco install jq -y
if ($LASTEXITCODE -eq 0) {
Write-Host "jq installed successfully"
# Verify again
$version = jq --version 2>&1
Write-Host "jq version: $version"
} else {
Write-Host "jq installation failed, exit code: $LASTEXITCODE"
exit 1
}
}
- name: Verify submodules
shell: powershell
continue-on-error: true
run: |
git --version
git submodule status
Write-Host "Submodules verified (status printed above)."
- name: Summary
shell: powershell
run: |
Write-Host "ACT Windows verification completed successfully."

View File

@ -1,41 +0,0 @@
@echo off
REM 安装 Flutter SDK on Windows
REM 设置安装目录
set FLUTTER_DIR=C:\flutter
REM 检查是否已安装 Flutter
where flutter >nul 2>nul
if %errorlevel% == 0 (
echo Flutter 已安装,正在检查版本...
flutter --version
goto :end
)
REM 如果未安装,下载 Flutter SDK
echo 下载 Flutter SDK...
powershell -Command "Invoke-WebRequest -Uri 'https://storage.googleapis.com/flutter_infra_release/releases/stable/windows/flutter_windows_3.35.5-stable.zip' -OutFile 'flutter.zip'"
REM 创建目录
if not exist "%FLUTTER_DIR%" mkdir "%FLUTTER_DIR%"
REM 解压
echo 解压 Flutter SDK 到 %FLUTTER_DIR%...
powershell -Command "Expand-Archive -Path 'flutter.zip' -DestinationPath '%FLUTTER_DIR%' -Force"
REM 添加到 PATH临时
set PATH=%FLUTTER_DIR%\flutter\bin;%PATH%
REM 永久添加 PATH需要管理员权限
echo 请手动将 %FLUTTER_DIR%\flutter\bin 添加到系统 PATH 环境变量。
echo 或者运行以下命令作为管理员:
echo setx /M PATH "%PATH%;%FLUTTER_DIR%\flutter\bin"
REM 运行 flutter doctor
flutter doctor
REM 清理
del flutter.zip
:end
pause