-
-
Notifications
You must be signed in to change notification settings - Fork 23
Ci/judge commits not pr title #535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f995773
cc2db41
8480cbf
29ba8b6
bece61d
29071c8
e82b0b7
1e1a071
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,32 +36,39 @@ jobs: | |
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Flutter | ||
| uses: subosito/flutter-action@v2 | ||
| with: | ||
| channel: "stable" | ||
| cache: true | ||
| # Flutter and Dart come from mise.toml, the same pin CI and every laptop | ||
| # use. Not subosito/flutter-action with `channel: stable`: that resolves | ||
| # to whatever stable is on the day, so this job could ship an artifact | ||
| # built against an SDK nobody chose, and nothing in the build log would | ||
| # say so. See AGENTS.md → Toolchain. | ||
| - name: Install toolchain (mise) | ||
| uses: jdx/mise-action@v4 | ||
|
Comment on lines
+44
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+44
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+44
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| # The iOS build uses Swift Package Manager, not CocoaPods (there is no | ||
| # Podfile). Cache SPM's clone/artifact store keyed on the resolved pins. | ||
| - name: Cache Swift Packages | ||
| uses: actions/cache@v4 | ||
| with: | ||
| # build/ios/SourcePackages, not DerivedData. Flutter always passes | ||
| # -clonedSourcePackagesDirPath pointing there (ios/xcodeproj.dart), so | ||
| # DerivedData is never consulted for packages and caching it stored | ||
| # nothing. Losing this directory is what makes a launch print fifteen | ||
| # "Fetching from … (cached)" lines and cost 19-32 s. | ||
| path: | | ||
| ~/Library/Caches/org.swift.swiftpm | ||
| ~/Library/Developer/Xcode/DerivedData/**/SourcePackages | ||
| build/ios/SourcePackages | ||
| key: ${{ runner.os }}-spm-${{ hashFiles('ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-spm- | ||
|
|
||
| - name: Install dependencies and run build_runner | ||
| run: | | ||
| flutter pub get | ||
| dart run build_runner build --delete-conflicting-outputs | ||
| bash tool/dev/deps.sh | ||
| bash tool/dev/codegen.sh | ||
|
|
||
| - name: Build iOS App and create IPA | ||
| run: | | ||
| flutter build ios --debug --no-codesign | ||
| bash tool/dev/build.sh ios --debug | ||
| mkdir -p Payload | ||
| cp -R build/ios/iphoneos/Runner.app Payload/Runner.app | ||
| zip -qr DPIP.ipa Payload | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| /// `tool/release/notes.sh` extracts changelog entries with a whole-line regex, | ||
| /// and commit.md's own example wraps an entry across two lines. Those two facts | ||
| /// disagreed, and the disagreement shipped: three English sentences in the | ||
| /// 26w34b notes end mid-clause — "…is shown at full extent on the monitor and | ||
| /// the" — because the indented remainder never matched anything. | ||
| /// | ||
| /// Nothing failed. The note built, the release published, and the only symptom | ||
| /// was a sentence that stops. | ||
| library; | ||
|
|
||
| import 'dart:io'; | ||
|
|
||
| import 'package:flutter_test/flutter_test.dart'; | ||
|
|
||
| /// Runs the fold the extractor applies to a commit body. | ||
| /// | ||
| /// Lifted from the script by reading it, so a change to the awk that stops | ||
| /// folding fails here rather than in a published release note. | ||
| String fold(String body) { | ||
| final script = File('${Directory.current.path}/tool/release/notes.sh') | ||
| .readAsStringSync(); | ||
| final start = script.indexOf("git log -1 --format=%b \"\$sha\" | awk '"); | ||
| expect(start, isNot(-1), reason: 'the fold is no longer where it was'); | ||
| final awk = script.substring( | ||
| script.indexOf("'", start) + 1, | ||
| script.indexOf("')", start), | ||
| ); | ||
|
Comment on lines
+22
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+22
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| final tmp = File( | ||
| '${Directory.systemTemp.createTempSync('fold').path}/body.txt', | ||
| )..writeAsStringSync(body); | ||
| return Process.runSync('bash', [ | ||
| '-c', | ||
| "awk ${_q(awk)} ${_q(tmp.path)}", | ||
| ]).stdout | ||
| as String; | ||
| } | ||
|
|
||
| String _q(String s) => "'${s.replaceAll("'", r"'\''")}'"; | ||
|
|
||
| /// The regex the script uses, verbatim. | ||
| bool isEntry(String line) => RegExp( | ||
| r'^(New|Optimization|Fix)\(([A-Za-z]{2,3}(-[A-Za-z0-9]+)*)\):\s*(.+)$', | ||
| ).hasMatch(line); | ||
|
Comment on lines
+42
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| void main() { | ||
| test('a wrapped entry survives whole', () { | ||
| const body = ''' | ||
| New(en-US): a large event is shown at full extent on the monitor and the | ||
| replay map | ||
| New(zh-Hant): 大事件在監視器與重播地圖上以完整範圍顯示 | ||
| '''; | ||
|
|
||
| final entries = fold(body).split('\n').where(isEntry).toList(); | ||
|
|
||
| expect(entries, hasLength(2)); | ||
| // The half that used to be dropped. | ||
| expect(entries.first, endsWith('and the replay map')); | ||
| }); | ||
|
|
||
| test('an unwrapped entry is untouched', () { | ||
| const body = 'Fix(en-US): stop the crash\nFix(zh-Hant): 修正閃退\n'; | ||
|
|
||
| expect(fold(body), body); | ||
| }); | ||
|
|
||
| test('prose after an entry does not get folded into it', () { | ||
| // The body's explanation is not part of the entry. A blank line ends it, | ||
| // which is what separates a continuation from the next paragraph. | ||
| const body = ''' | ||
| Fix(en-US): stop the crash | ||
|
|
||
| The crash came from a null channel. | ||
| '''; | ||
|
|
||
| final entries = fold(body).split('\n').where(isEntry).toList(); | ||
|
|
||
| expect(entries, hasLength(1)); | ||
| expect(entries.single, 'Fix(en-US): stop the crash'); | ||
| }); | ||
|
|
||
| test('the released commit that exposed this now reads whole', () { | ||
| // 41a3c1e8 shipped three truncated sentences. If the fold regresses, this | ||
| // is the commit that will say so. | ||
| final body = | ||
| Process.runSync('git', ['log', '-1', '--format=%b', '41a3c1e8']).stdout | ||
| as String; | ||
| if (body.trim().isEmpty) return; // shallow clone | ||
|
Comment on lines
+85
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| final entries = fold(body).split('\n').where(isEntry).toList(); | ||
|
|
||
| expect( | ||
| entries.where((e) => e.endsWith(' and the')), | ||
| isEmpty, | ||
| reason: 'an entry still ends mid-clause', | ||
| ); | ||
| }); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
秘密應透過
env:區塊傳遞給需要的步驟,而不是直接在run:中使用${{ secrets.X }}。這可以避免秘密意外洩露到日誌中,並符合安全最佳實踐。Suggestion: