Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 59 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,54 @@ jobs:
run: |
xcodebuild -version

# 步骤 2.5:安装 create-dmg 以启用精美 DMG 打包布局
# 步骤 2.4:校验代码风格。swift-format 随 Xcode 提供,无需额外安装依赖。
# --strict 让任何风格告警都以非零退出码结束,把当前统一的排版固化为门禁。
- name: Lint Formatting
run: |
xcrun swift-format lint \
--configuration .swift-format \
--recursive \
--strict \
BetterMenu BetterMenuFinderSync BetterMenuTests

# 步骤 2.5:运行安全通信、路径处理与设置迁移单元测试
- name: Run Tests
run: |
TEST_DERIVED_DATA="$RUNNER_TEMP/BetterMenuTestsDerivedData"
echo "TEST_DERIVED_DATA=$TEST_DERIVED_DATA" >> "$GITHUB_ENV"
xcodebuild \
-project BetterMenu.xcodeproj \
-scheme BetterMenu \
-configuration Debug \
-destination 'platform=macOS' \
-derivedDataPath "$TEST_DERIVED_DATA" \
-resultBundlePath "$RUNNER_TEMP/BetterMenuTests.xcresult" \
test

UNEXPECTED_PRODUCTS="$(
find "$TEST_DERIVED_DATA/Build/Products" \
-type d \
\( -name 'BetterMenu.app' -o -name 'BetterMenuFinderSync.appex' \) \
-print
)"
if [[ -n "$UNEXPECTED_PRODUCTS" ]]; then
echo "单元测试不应构建或注册 BetterMenu App/Finder Sync 扩展:"
echo "$UNEXPECTED_PRODUCTS"
exit 1
fi

# 步骤 2.55:无论测试通过与否都上传 xcresult 包,失败时可直接下载查看具体失败用例,
# 不必再依赖日志尾部输出定位问题。
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v7
with:
name: BetterMenu-TestResults
path: ${{ runner.temp }}/BetterMenuTests.xcresult
if-no-files-found: warn
retention-days: 14

# 步骤 2.6:安装 create-dmg 以启用精美 DMG 打包布局
- name: Install create-dmg
run: |
brew install create-dmg
Expand All @@ -42,6 +89,17 @@ jobs:
chmod +x script/package.sh
./script/package.sh > build.log 2>&1 || { echo "=== BUILD FAILED ==="; tail -n 200 build.log; exit 1; }

# 步骤 3.5:上传完整打包日志。tail -n 200 只能看到尾部,
# 编译错误常出现在中段,因此把整份日志留作工件。
- name: Upload Build Log
if: always()
uses: actions/upload-artifact@v7
with:
name: BetterMenu-BuildLog
path: build.log
if-no-files-found: warn
retention-days: 14

# 步骤 4:当推送以 'v' 开头的 tag 时,下载 Sparkle 工具生成 appcast.xml 并对其签名
- name: Generate Sparkle Appcast
if: startsWith(github.ref, 'refs/tags/v')
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ dist/
# 本地设计源文件或临时素材,不影响应用构建。
docs/*
!docs/screenshots/
CLAUDE.md
62 changes: 62 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"version": 1,
"lineLength": 100,
"indentation": {
"spaces": 2
},
"tabWidth": 2,
"maximumBlankLines": 1,
"respectsExistingLineBreaks": true,
"lineBreakBeforeControlFlowKeywords": false,
"lineBreakBeforeEachArgument": false,
"lineBreakBeforeEachGenericRequirement": false,
"lineBreakBetweenDeclarationAttributes": false,
"prioritizeKeepingFunctionOutputTogether": false,
"indentConditionalCompilationBlocks": false,
"indentSwitchCaseLabels": false,
"spacesAroundRangeFormationOperators": false,
"multiElementCollectionTrailingCommas": true,
"rules": {
"AllPublicDeclarationsHaveDocumentation": false,
"AlwaysUseLiteralForEmptyCollectionInit": false,
"AlwaysUseLowerCamelCase": true,
"AmbiguousTrailingClosureOverload": true,
"BeginDocumentationCommentWithOneLineSummary": false,
"DoNotUseSemicolons": true,
"DontRepeatTypeInStaticProperties": true,
"FileScopedDeclarationPrivacy": true,
"FullyIndirectEnum": true,
"GroupNumericLiterals": true,
"IdentifiersMustBeASCII": true,
"NeverForceUnwrap": false,
"NeverUseForceTry": false,
"NeverUseImplicitlyUnwrappedOptionals": false,
"NoAccessLevelOnExtensionDeclaration": true,
"NoAssignmentInExpressions": true,
"NoBlockComments": false,
"NoCasesWithOnlyFallthrough": true,
"NoEmptyLinesOpeningClosingBraces": false,
"NoEmptyTrailingClosureParentheses": true,
"NoLabelsInCasePatterns": true,
"NoLeadingUnderscores": false,
"NoParensAroundConditions": true,
"NoPlaygroundLiterals": true,
"NoVoidReturnOnFunctionSignature": true,
"OmitExplicitReturns": false,
"OneCasePerLine": true,
"OneVariableDeclarationPerLine": true,
"OnlyOneTrailingClosureArgument": true,
"OrderedImports": true,
"ReplaceForEachWithForLoop": false,
"ReturnVoidInsteadOfEmptyTuple": true,
"TypeNamesShouldBeCapitalized": true,
"UseEarlyExits": false,
"UseLetInEveryBoundCaseVariable": false,
"UseShorthandTypeNames": true,
"UseSingleLinePropertyGetter": true,
"UseSynthesizedInitializer": false,
"UseTripleSlashForDocumentationComments": true,
"UseWhereClausesInForLoops": false,
"ValidateDocumentationComments": false
}
}
Loading
Loading