-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In the absence of guidance about which minimum Swift version to use, I decided to use the latest release at time of writing (5.10). We can revisit this later if need be. TODO what is this in Xcode? skipping cache due to an error: https://github.com/apple/swift-argument-parser: The repository could not be found. Make sure a valid repository exists at the specified location and try again. TODO is BuildTool getting built in both languages? I believe it is `swift package init --name AblyChat` add basic files Add ably-cocoa wip swiftlint opting for a command plugin instead of build tool plugin because there’s no need for this to run when users install our library i don't really yet understand what the scope of its action is when you run as a command plugin — does it only look at stuff in your target? wip swiftformat TODO make sure that this and linting will also apply to any example app that we create TODO what files does this include? no easy way to get a report afaik TODO it's complaining about not being able to write cache Note that .swift-version is required and that the swift-tools-version from Package.swift is not used; see [1]. [1] nicklockwood/SwiftFormat#1496 add Prettier for markdown and YAML create scripts for checking fix SwiftFormat caching add GitHub workflow add comment Treat warnings as errors further notes about versioning version turn on strict concurrency try running on platforms too try on different Xcode versions try with different swift versions TODO Done linting! Found 1 violation, 0 serious in 3 files. this is not causing the job to fail (line length) fix check that warnings-as-errors works fix swiftlint allowing warnings improve job name split out lint bring xcodebuild in line with spm Revert "check that warnings-as-errors works" This reverts commit e7ffc6b. include Package.swift in formatting else it seems to instead format the code for each target, which ignores this add SwiftLint rules from AAT @ b39e5187 who knows if these will turn out to be what we want, but it’ll do as a starting point invert SwiftLint’s default trailing comma rule for compability with SwiftFormat Upon realising this clash, I hoped we could get away with just using SwiftLint, which does have some style rules. But it doesn’t enforce some basic things like indentation. I hope that there aren’t further clashes between the two tools, but we won’t find out until we write more code. add a script for fetching destination ID wip build inside a Swift script instead TODO sort out linting, gitignore, etc TODO a bit problem of having moved this into a separate package is that I can’t now open the other package in Xcode… move out of separate package the issue here is that i couldn't access the files in script/ when there was a separate package there — main package didn't show them in xcode, and subpackage didn't open as anything useful add TODO add Xcode’s generated schemes scheme different now that xcode generated some stuff probably because we have multiple targets erm different xcode schemes i guess i definitely don't understand the schemes ok back to original name 🤷 fix lint fix fix mac debugging CaseIterable try this fix another way remove logging what happened no need for semaphroe oops what's going on is it something about the script? hmm what about simplified even simpler is it platforms? this? this? bisect packages bisect this? some combination? return remove the tools ah I think that the tvOS one is an actual error use Mint for formatting since it broke with SPM test mint cache don't need this now using mint fix tvOS? add an example project fix versions and platforms ignore stuff note turn on strict concurrency for example app add empty workspace add package to workspace oh, yet another Package.resolved — TODO have a lint step that compares them all add example app to workspace turn on private_swiftui_state further change names oops split build tool for example app format package let xcode 16 update its Package.resolved TODO fix-then-check? try generating matrices what about this? break it oops fix SPM treat warnings as errors in example app this is redundant because we already do it in the build script, but it's nice for local development print the key value hmm oops camel Revert "break it" This reverts commit c80c921.
- Loading branch information
0 parents
commit 389fa2c
Showing
39 changed files
with
1,672 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
name: Check | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
lint: | ||
runs-on: macos-latest | ||
|
||
# From actions/cache documentation linked to below | ||
env: | ||
MINT_PATH: .mint/lib | ||
MINT_LINK_PATH: .mint/bin | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# https://github.com/actions/cache/blob/40c3b67b2955d93d83b27ed164edd0756bc24049/examples.md#swift---mint | ||
- uses: actions/cache@v4 | ||
with: | ||
path: .mint | ||
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }} | ||
restore-keys: | | ||
${{ runner.os }}-mint- | ||
- run: npm ci | ||
- run: brew install mint | ||
- run: mint bootstrap | ||
|
||
- run: script/format/check | ||
- run: script/lint/check | ||
|
||
generate-matrices: | ||
runs-on: macos-latest | ||
outputs: | ||
matrix: ${{ steps.generation-step.outputs.matrix }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: generation-step | ||
run: swift run BuildTool generate-matrices >> $GITHUB_OUTPUT | ||
|
||
check-spm: | ||
name: SPM (Xcode ${{ matrix.tooling.xcodeVersion }}, Swift ${{ matrix.tooling.swiftVersion }}) | ||
runs-on: macos-latest | ||
needs: generate-matrices | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJson(needs.generate-matrices.outputs.matrix).withoutPlatform }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: ${{ matrix.tooling.xcodeVersion }} | ||
|
||
# https://forums.swift.org/t/warnings-as-errors-for-libraries-frameworks/58393/2 | ||
- run: swift build -Xswiftc -warnings-as-errors -Xswiftc -swift-version -Xswiftc ${{ matrix.tooling.swiftVersion }} | ||
- run: swift test -Xswiftc -warnings-as-errors -Xswiftc -swift-version -Xswiftc ${{ matrix.tooling.swiftVersion }} | ||
|
||
check-xcode: | ||
name: Xcode, ${{matrix.platform}} (Xcode ${{ matrix.tooling.xcodeVersion }}, Swift ${{ matrix.tooling.swiftVersion }}) | ||
runs-on: macos-latest | ||
needs: generate-matrices | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJson(needs.generate-matrices.outputs.matrix).withPlatform }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: ${{ matrix.tooling.xcodeVersion }} | ||
|
||
- name: Build and run tests | ||
run: swift run BuildTool build-and-test-library --platform ${{ matrix.platform }} --swift-version ${{ matrix.tooling.swiftVersion }} | ||
|
||
check-example-app: | ||
name: Example app, ${{matrix.platform}} (Xcode ${{ matrix.tooling.xcodeVersion }}, Swift ${{ matrix.tooling.swiftVersion }}) | ||
runs-on: macos-latest | ||
needs: generate-matrices | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJson(needs.generate-matrices.outputs.matrix).withPlatform }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: ${{ matrix.tooling.xcodeVersion }} | ||
|
||
- name: Build example app | ||
run: swift run BuildTool build-example-app --platform ${{ matrix.platform }} --swift-version ${{ matrix.tooling.swiftVersion }} | ||
|
||
# We use this job as a marker that all of the required checks have completed. | ||
# This allows us to configure a single required status check in our branch | ||
# protection rules instead of having to type loads of different check names | ||
# into the branch protection web UI (and keep this list up to date as we | ||
# change the matrices). | ||
all-checks-completed: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- lint | ||
- check-spm | ||
- check-xcode | ||
- check-example-app | ||
|
||
steps: | ||
- name: No-op | ||
run: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Start of .gitignore created by Swift Package Manager | ||
.DS_Store | ||
/.build | ||
/Packages | ||
xcuserdata/ | ||
DerivedData/ | ||
.swiftpm/configuration/registries.json | ||
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata | ||
.netrc | ||
# End of .gitignore created by Swift Package Manager | ||
|
||
/node_modules | ||
/.mint | ||
|
||
# Don’t try and format the asset catalogue JSON files which are managed by Xcode | ||
*.xcassets/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Don’t try and format the asset catalogue JSON files, which are managed by Xcode | ||
*.xcassets/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
excluded: | ||
- .build | ||
|
||
strict: true | ||
|
||
disabled_rules: | ||
# All of the default rules of type "metrics". We have no reason to believe that the arbitrary defaults picked by SwiftLint are helpful. | ||
- cyclomatic_complexity | ||
- file_length | ||
- function_body_length | ||
- function_parameter_count | ||
- large_tuple | ||
- line_length | ||
- nesting | ||
- type_body_length | ||
|
||
# Rules of type "lint" that we’ve decided we don’t want: | ||
- todo # We frequently use TODOs accompanied by a GitHub issue reference | ||
|
||
opt_in_rules: | ||
# All of the opt-in rules of type "performance": | ||
- contains_over_filter_count | ||
- contains_over_filter_is_empty | ||
- contains_over_first_not_nil | ||
- contains_over_range_nil_comparison | ||
- empty_collection_literal | ||
- empty_count | ||
- empty_string | ||
- first_where | ||
- flatmap_over_map_reduce | ||
- last_where | ||
- reduce_into | ||
- sorted_first_last | ||
|
||
# Opt-in rules of type "style" that we’ve decided we want: | ||
- attributes | ||
- closure_end_indentation | ||
- closure_spacing | ||
- collection_alignment | ||
- comma_inheritance | ||
- conditional_returns_on_newline | ||
- file_header | ||
- implicit_return | ||
- literal_expression_end_indentation | ||
- modifier_order | ||
- multiline_arguments | ||
- multiline_arguments_brackets | ||
- multiline_function_chains | ||
- multiline_literal_brackets | ||
- multiline_parameters | ||
- multiline_parameters_brackets | ||
- operator_usage_whitespace | ||
- prefer_self_type_over_type_of_self | ||
- self_binding | ||
- single_test_class | ||
- sorted_imports | ||
- switch_case_on_newline | ||
- trailing_closure | ||
- trailing_newline | ||
- unneeded_parentheses_in_closure_argument | ||
- vertical_parameter_alignment_on_call | ||
- vertical_whitespace_closing_braces | ||
- vertical_whitespace_opening_braces | ||
|
||
# Opt-in rules of type "idiomatic" that we’ve decided we want: | ||
- anonymous_argument_in_multiline_closure | ||
- convenience_type | ||
- fallthrough | ||
- fatal_error_message | ||
- pattern_matching_keywords | ||
- redundant_type_annotation | ||
- shorthand_optional_binding | ||
- static_operator | ||
- toggle_bool | ||
- xct_specific_matcher | ||
|
||
# Opt-in rules of type "lint" that we’ve decided we want: | ||
- array_init | ||
- empty_xctest_method | ||
- missing_docs | ||
- override_in_extension | ||
- yoda_condition | ||
- private_swiftui_state | ||
|
||
file_header: | ||
# Comments, except for the required and standard ones at the top of a Package.swift file | ||
forbidden_pattern: //(?! (swift-tools-version:|The swift-tools-version declares the minimum version of Swift required to build this package\.)) | ||
|
||
identifier_name: | ||
&no_length_checks # We disable the length checks, for the same reason we disable the rules of type "metrics". | ||
min_length: | ||
warning: 1 | ||
max_length: | ||
warning: 10000 | ||
|
||
type_name: *no_length_checks | ||
|
||
generic_type_name: *no_length_checks | ||
|
||
# For compatibility with SwiftFormat | ||
trailing_comma: | ||
mandatory_comma: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"originHash" : "9d852a8f936d58dcf5f543508d205baeff66d9e230197f5987ee4f89aa7b1bf1", | ||
"pins" : [ | ||
{ | ||
"identity" : "ably-cocoa", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/ably/ably-cocoa", | ||
"state" : { | ||
"revision" : "7f639c609e50053abd4590f34333f9472645558a", | ||
"version" : "1.2.33" | ||
} | ||
}, | ||
{ | ||
"identity" : "delta-codec-cocoa", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/ably/delta-codec-cocoa", | ||
"state" : { | ||
"revision" : "3ee62ea40a63996b55818d44b3f0e56d8753be88", | ||
"version" : "1.3.3" | ||
} | ||
}, | ||
{ | ||
"identity" : "msgpack-objective-c", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/rvi/msgpack-objective-C", | ||
"state" : { | ||
"revision" : "3e36b48e04ecd756cb927bd5f5b9bf6d45e475f9", | ||
"version" : "0.4.0" | ||
} | ||
}, | ||
{ | ||
"identity" : "swift-argument-parser", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/apple/swift-argument-parser", | ||
"state" : { | ||
"revision" : "41982a3656a71c768319979febd796c6fd111d5c", | ||
"version" : "1.5.0" | ||
} | ||
} | ||
], | ||
"version" : 3 | ||
} |
8 changes: 8 additions & 0 deletions
8
.swiftpm/xcode/package.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1540" | ||
version = "1.7"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES" | ||
buildArchitectures = "Automatic"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "AblyChat" | ||
BuildableName = "AblyChat" | ||
BlueprintName = "AblyChat" | ||
ReferencedContainer = "container:"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
shouldAutocreateTestPlan = "YES"> | ||
<Testables> | ||
<TestableReference | ||
skipped = "NO"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "AblyChatTests" | ||
BuildableName = "AblyChatTests" | ||
BlueprintName = "AblyChatTests" | ||
ReferencedContainer = "container:"> | ||
</BuildableReference> | ||
</TestableReference> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "AblyChat" | ||
BuildableName = "AblyChat" | ||
BlueprintName = "AblyChat" | ||
ReferencedContainer = "container:"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
Oops, something went wrong.