Skip to content

Commit 5cef50e

Browse files
Apply standard Swift package configuration (#379)
* Apply standard Swift package configuration * Re-record test snapshots
1 parent 3651882 commit 5cef50e

File tree

96 files changed

+172
-579
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+172
-579
lines changed

.bazelversion

-1
This file was deleted.

.github/workflows/bazel.yml

-20
This file was deleted.

.github/workflows/docc.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: DocC
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
11+
12+
jobs:
13+
docc:
14+
name: DocC
15+
runs-on: macos-latest
16+
steps:
17+
- name: Checkout source
18+
uses: actions/checkout@v4
19+
- name: Build
20+
run: make docs open="no" DERIVED_DATA_PATH="$(mktemp -d)"

.github/workflows/swift.yml

+7-31
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,22 @@ on:
77
branches: [ main ]
88

99
env:
10-
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer
11-
SWIFT_STRICT_CONCURRENCY: complete
10+
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
1211

1312
jobs:
1413
swift:
1514
name: Swift
16-
runs-on: macos-13
15+
runs-on: macos-latest
1716
env:
18-
SIMULATOR: iPhone 14
17+
SIMULATOR: iPhone 15
1918
steps:
2019
- name: Checkout source
21-
uses: actions/checkout@v3
22-
- name: Validate excluded snapshots
23-
run: |
24-
SNAPSHOTS=$(find Tests -type d -name "__Snapshots__" | sort)
25-
EXCLUDED=$(swift package dump-package | jq -r '.targets[] | select(.type == "test") | "Tests/" + .name + "/" + .exclude[]' | sort)
26-
UNEXCLUDED=$(comm -23 <(echo "$SNAPSHOTS") <(echo "$EXCLUDED"))
27-
if test -n "$UNEXCLUDED"
28-
then
29-
echo "::error::Snapshot directories must be excluded from Swift package:" >&2
30-
echo "$UNEXCLUDED" >&2
31-
exit 1
32-
fi
20+
uses: actions/checkout@v4
3321
- name: Download swiftlint binary
3422
run: swift package resolve
3523
- name: Lint
36-
run: |
37-
DIRECTORY_NAME=$(echo "${PWD##*/}" | tr '[:upper:]' '[:lower:]')
38-
"$(find ".build/artifacts/${DIRECTORY_NAME}" -type f -name swiftlint -perm +111 -print -quit)" \
24+
run: >
25+
"$(find ".build/artifacts/swiftlint" -type f -name swiftlint -perm +111 -print -quit)"
3926
lint --strict --reporter github-actions-logging
4027
- name: Resolve package dependencies
4128
run: xcodebuild -resolvePackageDependencies
@@ -45,21 +32,10 @@ jobs:
4532
build-for-testing
4633
-scheme "Layout-Package"
4734
-destination "name=$SIMULATOR,OS=latest"
48-
SWIFT_TREAT_WARNINGS_AS_ERRORS=YES
35+
-skipPackagePluginValidation
4936
- name: Test
5037
run: >
5138
xcodebuild
5239
test-without-building
5340
-scheme "Layout-Package"
5441
-destination "name=$SIMULATOR,OS=latest"
55-
- name: Delete snapshots
56-
run: make delete-snapshots
57-
- name: Record snapshots
58-
run: >
59-
xcodebuild
60-
test-without-building
61-
-scheme "Layout-Package"
62-
-destination "name=$SIMULATOR,OS=latest"
63-
continue-on-error: true
64-
- name: Validate recorded snapshots
65-
run: test -z "$(git status --porcelain)"

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,3 @@
88
# Xcode
99
*.xcworkspace/
1010
*.xcodeproj/
11-
12-
# Bazel
13-
bazel-*

.swiftlint-rules.yml

+9
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ only_rules:
3333
- contains_over_filter_is_empty
3434
- contains_over_first_not_nil
3535
- contains_over_range_nil_comparison
36+
# - contrasted_opening_brace
3637
- control_statement
3738
- convenience_type
3839
- custom_rules
@@ -73,6 +74,7 @@ only_rules:
7374
- file_name
7475
- file_name_no_space
7576
- file_types_order
77+
- final_test_case
7678
- first_where
7779
- flatmap_over_map_reduce
7880
- for_where
@@ -124,11 +126,13 @@ only_rules:
124126
- multiple_closures_with_trailing_closure
125127
- nesting
126128
- nimble_operator
129+
# - no_empty_block
127130
- no_extension_access_modifier
128131
- no_fallthrough_only
129132
- no_grouping_extension
130133
# - no_magic_numbers
131134
- no_space_in_method_call
135+
- non_optional_string_data_conversion
132136
- non_overridable_class_declaration
133137
- notification_center_detachment
134138
- ns_number_init_as_function_reference
@@ -137,6 +141,7 @@ only_rules:
137141
- nsobject_prefer_isequal
138142
- number_separator
139143
# - object_literal
144+
# - one_declaration_per_file
140145
- opening_brace
141146
- operator_usage_whitespace
142147
- operator_whitespace
@@ -146,6 +151,7 @@ only_rules:
146151
- override_in_extension
147152
- pattern_matching_keywords
148153
- period_spacing
154+
- prefer_key_path
149155
- prefer_nimble
150156
- prefer_self_in_static_references
151157
- prefer_self_type_over_type_of_self
@@ -181,6 +187,7 @@ only_rules:
181187
# - return_value_from_void_function
182188
- self_binding
183189
- self_in_property_initialization
190+
# - shorthand_argument
184191
- shorthand_operator
185192
- shorthand_optional_binding
186193
- single_test_class
@@ -189,6 +196,7 @@ only_rules:
189196
- sorted_imports
190197
- statement_position
191198
- static_operator
199+
- static_over_final_class
192200
- strict_fileprivate
193201
- strong_iboutlet
194202
- superfluous_disable_command
@@ -221,6 +229,7 @@ only_rules:
221229
- unused_control_flow_label
222230
- unused_enumerated
223231
- unused_optional_binding
232+
- unused_parameter
224233
- unused_setter_value
225234
- valid_ibinspectable
226235
- vertical_parameter_alignment

.swiftlint.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
included:
2-
- Plugins
32
- Sources
43
- Tests
54

BUILD.bazel

-16
This file was deleted.

CONTRIBUTING.md

+19-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
# Contributing to Layout
22

3-
- [Open Package in Xcode](#open-package-in-xcode)
4-
- [Static Analysis](#static-analysis)
3+
- [Open Package](#open-package)
4+
- [Lint Package](#lint-package)
55
- [Testing](#testing)
6+
- [Creating Releases](#creating-releases)
67

7-
## Open Package in Xcode
8+
## Open Package
89

910
> The file header comment template will also be installed.
1011
1112
```
1213
make open
1314
```
1415

15-
## Static Analysis
16+
## Lint Package
1617

1718
> SwiftLint violations are visible in Xcode as well.
1819
@@ -35,3 +36,17 @@ To re-record all existing snapshot references, delete all using the following co
3536
```
3637
make delete-snapshots
3738
```
39+
40+
## Creating Releases
41+
42+
Releases are made [on the GitHub website](https://github.com/Tinder/Layout/releases/new).
43+
44+
In all of the following steps, `X.X.X` is a placeholder to be substituted with the actual semantic version for the release.
45+
46+
- Enter a semantic version as the new tag (__WITHOUT__ `v` prefix)
47+
- Set the `main` branch as the target (it should be the default)
48+
- Enter the release title formatted as `Layout vX.X.X` (__WITH__ `v` prefix)
49+
- Click on `Generate release notes`
50+
- Leave `Set as a pre-release` unchecked
51+
- Leave `Set as the latest release` checked
52+
- Click `Publish release`

Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fix:
1010
@/usr/libexec/PlistBuddy -c \
1111
"Delete :FILEHEADER" \
1212
"$(XCSHAREDDATA)/IDETemplateMacros.plist" >/dev/null 2>&1 || true
13-
@header=$$'\n// All Contributions by Match Group\n//\n// Copyright © ___YEAR___ Tinder (Match Group, LLC)\n//\n// Licensed under the Match Group Modified 3-Clause BSD License.\n// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.\n//'; \
13+
@header=$$'\n// All Contributions by Match Group\n//\n// Copyright © ___YEAR___ Tinder \(Match Group, LLC\)\n//\n// Licensed under the Match Group Modified 3-Clause BSD License.\n// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.\n//'; \
1414
/usr/libexec/PlistBuddy -c \
1515
"Add :FILEHEADER string $$header" \
1616
"$(XCSHAREDDATA)/IDETemplateMacros.plist" >/dev/null 2>&1
@@ -33,6 +33,7 @@ analyze:
3333
-destination "$(destination)" \
3434
-derivedDataPath "$$DERIVED_DATA" \
3535
-configuration "Debug" \
36+
-skipPackagePluginValidation \
3637
CODE_SIGNING_ALLOWED="NO" \
3738
> "$$XCODEBUILD_LOG"; \
3839
swift package plugin \
@@ -75,6 +76,7 @@ docs:
7576
-scheme "$(target)" \
7677
-destination "$(destination)" \
7778
-derivedDataPath "$(DERIVED_DATA_PATH)" \
79+
-skipPackagePluginValidation \
7880
OTHER_DOCC_FLAGS="--warnings-as-errors"
7981
@find "$(DERIVED_DATA_PATH)" \
8082
-type d \

Package.resolved

+79-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
{
22
"pins" : [
3+
{
4+
"identity" : "collectionconcurrencykit",
5+
"kind" : "remoteSourceControl",
6+
"location" : "https://github.com/JohnSundell/CollectionConcurrencyKit.git",
7+
"state" : {
8+
"revision" : "b4f23e24b5a1bff301efc5e70871083ca029ff95",
9+
"version" : "0.2.0"
10+
}
11+
},
12+
{
13+
"identity" : "cryptoswift",
14+
"kind" : "remoteSourceControl",
15+
"location" : "https://github.com/krzyzanowskim/CryptoSwift.git",
16+
"state" : {
17+
"revision" : "729e01bc9b9dab466ac85f21fb9ee2bc1c61b258",
18+
"version" : "1.8.4"
19+
}
20+
},
321
{
422
"identity" : "cwlcatchexception",
523
"kind" : "remoteSourceControl",
@@ -23,26 +41,80 @@
2341
"kind" : "remoteSourceControl",
2442
"location" : "https://github.com/Quick/Nimble.git",
2543
"state" : {
26-
"revision" : "d616f15123bfb36db1b1075153f73cf40605b39d",
27-
"version" : "13.0.0"
44+
"revision" : "54b4e52183f16fe806014cbfd63718a84f8ba072",
45+
"version" : "13.4.0"
46+
}
47+
},
48+
{
49+
"identity" : "sourcekitten",
50+
"kind" : "remoteSourceControl",
51+
"location" : "https://github.com/jpsim/SourceKitten.git",
52+
"state" : {
53+
"revision" : "fd4df99170f5e9d7cf9aa8312aa8506e0e7a44e7",
54+
"version" : "0.35.0"
55+
}
56+
},
57+
{
58+
"identity" : "swift-argument-parser",
59+
"kind" : "remoteSourceControl",
60+
"location" : "https://github.com/apple/swift-argument-parser.git",
61+
"state" : {
62+
"revision" : "41982a3656a71c768319979febd796c6fd111d5c",
63+
"version" : "1.5.0"
2864
}
2965
},
3066
{
3167
"identity" : "swift-snapshot-testing",
3268
"kind" : "remoteSourceControl",
3369
"location" : "https://github.com/pointfreeco/swift-snapshot-testing.git",
3470
"state" : {
35-
"revision" : "59b663f68e69f27a87b45de48cb63264b8194605",
36-
"version" : "1.15.1"
71+
"revision" : "6d932a79e7173b275b96c600c86c603cf84f153c",
72+
"version" : "1.17.4"
3773
}
3874
},
3975
{
4076
"identity" : "swift-syntax",
4177
"kind" : "remoteSourceControl",
42-
"location" : "https://github.com/apple/swift-syntax.git",
78+
"location" : "https://github.com/swiftlang/swift-syntax",
79+
"state" : {
80+
"revision" : "515f79b522918f83483068d99c68daeb5116342d",
81+
"version" : "600.0.0-prerelease-2024-08-14"
82+
}
83+
},
84+
{
85+
"identity" : "swiftlint",
86+
"kind" : "remoteSourceControl",
87+
"location" : "https://github.com/realm/SwiftLint.git",
88+
"state" : {
89+
"revision" : "a24488f26e60247d8fff7bbb03d51910af3dc91c",
90+
"version" : "0.56.2"
91+
}
92+
},
93+
{
94+
"identity" : "swiftytexttable",
95+
"kind" : "remoteSourceControl",
96+
"location" : "https://github.com/scottrhoyt/SwiftyTextTable.git",
97+
"state" : {
98+
"revision" : "c6df6cf533d120716bff38f8ff9885e1ce2a4ac3",
99+
"version" : "0.9.0"
100+
}
101+
},
102+
{
103+
"identity" : "swxmlhash",
104+
"kind" : "remoteSourceControl",
105+
"location" : "https://github.com/drmohundro/SWXMLHash.git",
106+
"state" : {
107+
"revision" : "a853604c9e9a83ad9954c7e3d2a565273982471f",
108+
"version" : "7.0.2"
109+
}
110+
},
111+
{
112+
"identity" : "yams",
113+
"kind" : "remoteSourceControl",
114+
"location" : "https://github.com/jpsim/Yams.git",
43115
"state" : {
44-
"revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036",
45-
"version" : "509.0.2"
116+
"revision" : "3036ba9d69cf1fd04d433527bc339dc0dc75433d",
117+
"version" : "5.1.3"
46118
}
47119
}
48120
],

0 commit comments

Comments
 (0)