Skip to content

Commit 223dcaf

Browse files
Apply standard Swift package configuration (#843)
* Apply standard Swift package configuration * Remove extraneous value from .gitignore * Remove SwiftLint disables * Disable strict concurrency in CI * Skip package plugin validation in workflows * Remove SWIFT_TREAT_WARNINGS_AS_ERRORS temporarily * Revert "Disable strict concurrency in CI" This reverts commit 961738e. * Remove -warnings-as-errors temporarily * Remove plugins from SwiftLint config
1 parent 2f4fb00 commit 223dcaf

40 files changed

+211
-578
lines changed

.github/workflows/artifactory.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
tags: ['[0-9]+.[0-9]+.[0-9]+']
66

77
env:
8-
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
8+
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
99

1010
jobs:
1111
artifactory:
@@ -18,15 +18,14 @@ jobs:
1818
- name: Install dependencies
1919
run: brew install jfrog-cli
2020
- name: Checkout source
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
2222
- name: Build documentation
2323
run: |
2424
make docs open="no" DERIVED_DATA_PATH="$(mktemp -d)"
2525
mkdir Documentation
2626
mv .build/documentation/archive/Nodes.doccarchive Documentation
2727
- name: Archive
28-
run: >
29-
tar -czf "Nodes-${GITHUB_REF_NAME}.tar.gz" Sources Documentation
28+
run: tar -czf "Nodes-${GITHUB_REF_NAME}.tar.gz" Sources Documentation
3029
- name: Upload
3130
run: >
3231
jf rt u

.github/workflows/docc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ on:
77
branches: [ main ]
88

99
env:
10-
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
10+
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
1111

1212
jobs:
1313
docc:
1414
name: DocC
1515
runs-on: macos-latest
1616
steps:
1717
- name: Checkout source
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1919
- name: Build
2020
run: make docs open="no" DERIVED_DATA_PATH="$(mktemp -d)"

.github/workflows/genesis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [ main ]
88

99
env:
10-
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
10+
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
1111

1212
jobs:
1313
genesis:
@@ -21,7 +21,7 @@ jobs:
2121
brew install mint xcodegen needle mockolo
2222
mint install yonaskolb/genesis
2323
- name: Checkout source
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2525
- name: Create temporary directory
2626
id: mktemp
2727
run: echo "directory=$(mktemp -d)" >> "$GITHUB_OUTPUT"
@@ -55,7 +55,7 @@ jobs:
5555
build-for-testing
5656
-scheme "Tinder"
5757
-destination "name=$SIMULATOR,OS=latest"
58-
SWIFT_TREAT_WARNINGS_AS_ERRORS=YES
58+
-skipPackagePluginValidation
5959
- name: Test
6060
working-directory: ${{ steps.mktemp.outputs.directory }}
6161
run: >

.github/workflows/lint.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@ on:
77
branches: [ main ]
88

99
env:
10-
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
10+
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
1111

1212
jobs:
1313
lint:
1414
name: Lint
1515
runs-on: macos-latest
1616
steps:
1717
- name: Checkout source
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1919
- name: Download swiftlint binary
2020
run: swift package resolve
2121
- name: Lint
22-
run: |
23-
DIRECTORY_NAME=$(echo "${PWD##*/}" | tr '[:upper:]' '[:lower:]')
24-
"$(find ".build/artifacts/${DIRECTORY_NAME}" -type f -name swiftlint -perm +111 -print -quit)" \
22+
run: >
23+
"$(find ".build/artifacts/swiftlint" -type f -name swiftlint -perm +111 -print -quit)"
2524
lint --strict --reporter github-actions-logging

.github/workflows/pages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
tags: ['[0-9]+.[0-9]+.[0-9]+']
66

77
env:
8-
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
8+
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
99

1010
jobs:
1111
pages:
@@ -23,7 +23,7 @@ jobs:
2323
url: ${{ steps.deployment.outputs.page_url }}
2424
steps:
2525
- name: Checkout source
26-
uses: actions/checkout@v3
26+
uses: actions/checkout@v4
2727
- name: Configure pages
2828
uses: actions/configure-pages@v2
2929
- name: Build documentation

.github/workflows/swift.yml

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,16 @@ on:
77
branches: [ main ]
88

99
env:
10-
DEVELOPER_DIR: /Applications/Xcode_15.2.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
1615
runs-on: macos-latest
1716
steps:
1817
- name: Checkout source
19-
uses: actions/checkout@v3
20-
- name: Validate excluded snapshots
21-
run: |
22-
SNAPSHOTS=$(find Tests -type d -name "__Snapshots__" | sort)
23-
EXCLUDED=$(swift package dump-package | jq -r '.targets[] | select(.type == "test") | "Tests/" + .name + "/" + .exclude[]' | sort)
24-
UNEXCLUDED=$(comm -23 <(echo "$SNAPSHOTS") <(echo "$EXCLUDED"))
25-
if test -n "$UNEXCLUDED"
26-
then
27-
echo "::error::Snapshot directories must be excluded from Swift package:" >&2
28-
echo "$UNEXCLUDED" >&2
29-
exit 1
30-
fi
18+
uses: actions/checkout@v4
3119
- name: Build
32-
run: swift build -v -Xswiftc -warnings-as-errors
20+
run: swift build -v
3321
- name: Test
3422
run: swift test -v
35-
- name: Delete snapshots
36-
run: make delete-snapshots
37-
- name: Record snapshots
38-
run: swift test -v
39-
continue-on-error: true
40-
- name: Validate recorded snapshots
41-
run: test -z "$(git status --porcelain)"
42-
- name: Validate executables
43-
run: |
44-
swift run -- nodes-code-gen --help
45-
swift run -- nodes-xcode-templates-gen --help

.github/workflows/xcode.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [ main ]
88

99
env:
10-
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
10+
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
1111

1212
jobs:
1313
xcode:
@@ -17,7 +17,7 @@ jobs:
1717
SIMULATOR: iPhone 14
1818
steps:
1919
- name: Checkout source
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2121
- name: Resolve package dependencies
2222
run: xcodebuild -resolvePackageDependencies
2323
- name: Build
@@ -26,7 +26,7 @@ jobs:
2626
build-for-testing
2727
-scheme "Nodes-Package"
2828
-destination "name=$SIMULATOR,OS=latest"
29-
SWIFT_TREAT_WARNINGS_AS_ERRORS=YES
29+
-skipPackagePluginValidation
3030
- name: Test
3131
run: >
3232
xcodebuild

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,3 @@
88
# Xcode
99
*.xcworkspace/
1010
*.xcodeproj/
11-
12-
# Codegen
13-
**/Generated/
14-
15-
# Bazel
16-
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

0 commit comments

Comments
 (0)