flutter analyze 默认把 info 也当致命项,仓库里那条既有的
prefer_initializing_formals 让 checks 作业 exit 1,后面三个构建作业全被跳过。
两处处理:
1. 真把这条 lint 修掉——TitleApiService 改用私有初始化形参 {this._cookies},
Dart 对外仍暴露成 cookies: 具名参数,调用点无需改动。analyze 现在 0 issue。
2. CI 改用 flutter analyze --no-fatal-infos,与 README 写的「0 error/warning」
一致;否则依赖升级带进来的 deprecation 提示(之前 dart:html 那 5 条)
会毫无道理地打断整条流水线。
103 lines
2.7 KiB
YAML
103 lines
2.7 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
tags: ["v*"]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: build-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
checks:
|
|
name: Analyze & test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: subosito/flutter-action@v2
|
|
with:
|
|
channel: stable
|
|
cache: true
|
|
- run: flutter pub get
|
|
# info 级别不致命:仓库标准是 0 error/warning(见 README),
|
|
# 否则依赖升级带进来的 deprecation 提示就会打断整条流水线。
|
|
- run: flutter analyze --no-fatal-infos
|
|
- run: flutter test
|
|
|
|
android:
|
|
name: Android APK
|
|
needs: checks
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: "17"
|
|
- uses: subosito/flutter-action@v2
|
|
with:
|
|
channel: stable
|
|
cache: true
|
|
- run: flutter pub get
|
|
- run: flutter build apk --release
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ichino-android-apk
|
|
path: build/app/outputs/flutter-apk/app-release.apk
|
|
if-no-files-found: error
|
|
|
|
windows:
|
|
name: Windows exe
|
|
needs: checks
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: subosito/flutter-action@v2
|
|
with:
|
|
channel: stable
|
|
cache: true
|
|
- run: flutter pub get
|
|
- run: flutter build windows --release
|
|
- name: Package runner output
|
|
shell: pwsh
|
|
run: |
|
|
Compress-Archive -Path build\windows\x64\runner\Release\* `
|
|
-DestinationPath ichino-windows-x64.zip
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ichino-windows-exe
|
|
path: ichino-windows-x64.zip
|
|
if-no-files-found: error
|
|
|
|
ios:
|
|
name: iOS unsigned ipa
|
|
needs: checks
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: subosito/flutter-action@v2
|
|
with:
|
|
channel: stable
|
|
cache: true
|
|
- run: flutter pub get
|
|
# 无证书/描述文件,只能出未签名包:可验证能编译,不能直接装机。
|
|
- run: flutter build ios --release --no-codesign
|
|
- name: Package unsigned .ipa
|
|
run: |
|
|
set -euo pipefail
|
|
cd build/ios/iphoneos
|
|
mkdir -p Payload
|
|
cp -R Runner.app Payload/
|
|
zip -qry "$GITHUB_WORKSPACE/ichino-ios-unsigned.ipa" Payload
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ichino-ios-unsigned-ipa
|
|
path: ichino-ios-unsigned.ipa
|
|
if-no-files-found: error
|