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

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/bazel.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/docc.yml

Lines changed: 20 additions & 0 deletions
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

Lines changed: 7 additions & 31 deletions
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

Lines changed: 0 additions & 3 deletions
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

Lines changed: 9 additions & 0 deletions
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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
included:
2-
- Plugins
32
- Sources
43
- Tests
54

BUILD.bazel

Lines changed: 0 additions & 16 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 19 additions & 4 deletions
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

Lines changed: 3 additions & 1 deletion
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 \

0 commit comments

Comments
 (0)