Skip to content

Commit d2b659b

Browse files
committed
all: port changes from swift-opus repo
1 parent 6dcdffb commit d2b659b

File tree

6 files changed

+99
-41
lines changed

6 files changed

+99
-41
lines changed

.github/workflows/swift.yaml

+7-28
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,30 @@ on:
55
branches:
66
- main
77
paths:
8-
- ".github/workflows/swift.yaml"
98
- "**.swift"
10-
- "**/Package.resolved"
9+
- "Package.resolved"
1110
pull_request:
1211
paths:
13-
- ".github/workflows/swift.yaml"
1412
- "**.swift"
15-
- "**/Package.resolved"
13+
- "Package.resolved"
1614

1715
jobs:
1816
format:
19-
name: Check SwiftFormat
17+
name: Format
2018
runs-on: ubuntu-latest
21-
timeout-minutes: 10
2219
steps:
2320
- name: Checkout repo
24-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
2522
with:
2623
submodules: recursive
2724

28-
- name: Install SwiftFormat
25+
- name: Install swift-format
2926
uses: Cyberbeni/install-swift-tool@v2
3027
with:
31-
url: https://github.com/nicklockwood/SwiftFormat
28+
url: https://github.com/apple/swift-format
3229

3330
- name: Format Swift code
34-
run: swiftformat --verbose .
31+
run: swift-format -r -i ./
3532

3633
- name: Verify formatted code is unchanged
3734
run: git diff --exit-code HEAD -w -G'(^[^# /])|(^#\w)|(^\s+[^#/])' # Ignore whitespace and comments
38-
39-
test:
40-
name: Test Swift packages
41-
runs-on: ${{ matrix.os }}
42-
timeout-minutes: 10
43-
strategy:
44-
matrix:
45-
os:
46-
- macos-latest
47-
- ubuntu-latest
48-
steps:
49-
- name: Checkout repo
50-
uses: actions/checkout@v3
51-
with:
52-
submodules: recursive
53-
54-
- name: Run tests
55-
run: swift test --enable-test-discovery

.github/workflows/test.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- ".github/workflows/test.yaml"
9+
- ".gitmodules"
10+
- "**.swift"
11+
- "Package.resolved"
12+
pull_request:
13+
paths:
14+
- ".github/workflows/test.yaml"
15+
- ".gitmodules"
16+
- "**.swift"
17+
- "Package.resolved"
18+
19+
jobs:
20+
test:
21+
name: Test
22+
runs-on: macos-latest
23+
timeout-minutes: 10
24+
steps:
25+
- name: Checkout repo
26+
uses: actions/checkout@v4
27+
with:
28+
submodules: recursive
29+
30+
- name: Test
31+
run: swift test
32+
33+
- name: Generate release build
34+
run: swift build -c release

.swift-format

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"lineLength": 2048,
4+
"indentation": {
5+
"tabs": 1
6+
},
7+
"tabWidth": 4,
8+
"maximumBlankLines": 1,
9+
"respectsExistingLineBreaks": true,
10+
"lineBreakBeforeControlFlowKeywords": true,
11+
"lineBreakBeforeEachArgument": false,
12+
"prioritizeKeepingFunctionOutputTogether": true
13+
}

.swiftformat

-6
This file was deleted.

.vscode/extensions.json

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
{
2+
// List of extensions which should be recommended for users of this workspace.
3+
// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
4+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
25
"recommendations": [
6+
"davidanson.vscode-markdownlint",
37
"eamodio.gitlens",
48
"eriklynd.json-tools",
59
"foxundermoon.shell-format",
10+
"redhat.vscode-yaml",
611
"stkb.rewrap",
7-
"vknabel.vscode-swiftformat",
12+
"vknabel.vscode-apple-swift-format",
813
"xaver.clang-format",
9-
]
14+
],
15+
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
16+
"unwantedRecommendations": []
1017
}

.vscode/settings.json

+36-5
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,52 @@
11
{
22
// Editor
33
"editor.codeActionsOnSave": {
4-
"source.fixAll.eslint": true
4+
"source.fixAll.eslint": "explicit"
55
},
66
"editor.detectIndentation": false,
77
"editor.formatOnSave": true,
88
"editor.insertSpaces": false,
9-
"editor.tabSize": 8,
9+
"editor.tabSize": 4,
1010
"files.eol": "\n",
1111
//
1212
// Files
1313
"files.exclude": {
1414
"**/.build": true,
1515
"**/.git": true,
16+
// "Sources/Copus": true,
1617
},
18+
"files.associations": {},
1719
"files.insertFinalNewline": true,
1820
"files.watcherExclude": {
1921
"**/.git/objects/**": true,
2022
"**/.git/subtree-cache/**": true,
2123
},
2224
"files.trimTrailingWhitespace": true,
2325
//
26+
// HTML
27+
"html.format.contentUnformatted": "pre,code,textarea,script",
28+
"html.format.unformatted": "pre,code,textarea,script,wbr",
29+
//
30+
// JSON
31+
"[json]": {
32+
"editor.defaultFormatter": "vscode.json-language-features",
33+
},
34+
"[jsonc]": {
35+
"editor.defaultFormatter": "vscode.json-language-features",
36+
},
37+
//
38+
// Make
39+
"[makefile]": {
40+
"editor.tabSize": 4
41+
},
42+
//
2443
// Markdown
2544
"[markdown]": {
2645
"editor.rulers": [
2746
80
2847
],
2948
"editor.codeActionsOnSave": {
30-
"source.fixAll.markdownlint": true
49+
"source.fixAll.markdownlint": "explicit"
3150
}
3251
},
3352
"markdown.preview.breaks": true,
@@ -41,7 +60,7 @@
4160
// Property Lists
4261
"[plist]": {
4362
"editor.formatOnSave": true,
44-
"editor.tabSize": 8,
63+
"editor.tabSize": 4,
4564
},
4665
//
4766
// Shell
@@ -51,8 +70,9 @@
5170
//
5271
// Swift
5372
"[swift]": {
73+
"editor.detectIndentation": true,
5474
"editor.insertSpaces": false,
55-
"editor.tabSize": 8,
75+
"editor.tabSize": 4,
5676
},
5777
//
5878
// YAML
@@ -67,4 +87,15 @@
6787
"strings": true
6888
}
6989
},
90+
"[github-actions-workflow]": {
91+
"editor.autoIndent": "keep",
92+
"editor.detectIndentation": true,
93+
"editor.insertSpaces": true,
94+
"editor.tabSize": 2,
95+
"editor.quickSuggestions": {
96+
"other": true,
97+
"comments": false,
98+
"strings": true
99+
}
100+
}
70101
}

0 commit comments

Comments
 (0)