Skip to content

Commit 78dfe0e

Browse files
committed
ci: add test, fmt, lint workflows
1 parent eb61235 commit 78dfe0e

25 files changed

+1733
-1627
lines changed

.github/workflows/ci.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: ci
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- "README.md"
7+
push:
8+
branches:
9+
- main
10+
paths-ignore:
11+
- "README.md"
12+
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
test:
19+
name: test
20+
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest'}}
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
with:
25+
fetch-depth: 1
26+
- name: Switch XCode Version
27+
uses: maxim-lobanov/setup-xcode@v1
28+
with:
29+
xcode-version: '16.0.0'
30+
- run: |
31+
make test
32+
working-directory: Coder Desktop
33+
format:
34+
name: format
35+
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest'}}
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39+
with:
40+
fetch-depth: 1
41+
- run: |
42+
make fmt
43+
working-directory: Coder Desktop
44+
lint:
45+
name: lint
46+
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest'}}
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
50+
with:
51+
fetch-depth: 1
52+
- name: Install Swiftlint
53+
run: |
54+
brew install swiftlint
55+
- run: |
56+
make lint
57+
working-directory: Coder Desktop

Coder Desktop/.swiftlint.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
disabled_rules:
22
- todo
33
- trailing_comma
4+
- blanket_disable_command # Used by Protobuf
5+
- opening_brace # Handled by SwiftFormat
46
type_name:
57
allowed_symbols: "_"
68
identifier_name:
79
allowed_symbols: "_"
10+
min_length: 1

Coder Desktop/Coder Desktop.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@
721721
CURRENT_PROJECT_VERSION = 1;
722722
DEVELOPMENT_TEAM = 4399GN35BJ;
723723
GENERATE_INFOPLIST_FILE = YES;
724+
MACOSX_DEPLOYMENT_TARGET = 14.6;
724725
MARKETING_VERSION = 1.0;
725726
PRODUCT_BUNDLE_IDENTIFIER = "com.coder.Coder-DesktopUITests";
726727
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -737,6 +738,7 @@
737738
CURRENT_PROJECT_VERSION = 1;
738739
DEVELOPMENT_TEAM = 4399GN35BJ;
739740
GENERATE_INFOPLIST_FILE = YES;
741+
MACOSX_DEPLOYMENT_TARGET = 14.6;
740742
MARKETING_VERSION = 1.0;
741743
PRODUCT_BUNDLE_IDENTIFIER = "com.coder.Coder-DesktopUITests";
742744
PRODUCT_NAME = "$(TARGET_NAME)";

Coder Desktop/Coder Desktop.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Coder Desktop/Coder Desktop.xctestplan

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
}
2626
},
2727
{
28+
"enabled" : false,
2829
"parallelizable" : true,
2930
"target" : {
3031
"containerPath" : "container:Coder Desktop.xcodeproj",

Coder Desktop/Coder Desktop/Theme.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ enum Theme {
88

99
static let rectCornerRadius: CGFloat = 4
1010
}
11+
1112
static let defaultVisibleAgents = 5
1213
}

Coder Desktop/Coder Desktop/Views/Agents.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ struct Agents<VPN: VPNService, S: Session>: View {
66
@State private var viewAll = false
77
private let defaultVisibleRows = 5
88

9-
internal let inspection = Inspection<Self>()
9+
let inspection = Inspection<Self>()
1010

1111
var body: some View {
1212
Group {

Coder Desktop/Coder Desktop/Views/LoginForm.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct LoginForm<C: Client, S: Session>: View {
1111
@State private var loading: Bool = false
1212
@FocusState private var focusedField: LoginField?
1313

14-
internal let inspection = Inspection<Self>()
14+
let inspection = Inspection<Self>()
1515

1616
var body: some View {
1717
VStack {
@@ -56,7 +56,7 @@ struct LoginForm<C: Client, S: Session>: View {
5656
.onReceive(inspection.notice) { self.inspection.visit(self, $0) } // ViewInspector
5757
}
5858

59-
internal func submit() async {
59+
func submit() async {
6060
loginError = nil
6161
guard sessionToken != "" else {
6262
loginError = .invalidToken
@@ -67,7 +67,7 @@ struct LoginForm<C: Client, S: Session>: View {
6767
return
6868
}
6969
loading = true
70-
defer { loading = false}
70+
defer { loading = false }
7171
let client = C(url: url, token: sessionToken)
7272
do {
7373
_ = try await client.user("me")
@@ -135,8 +135,8 @@ struct LoginForm<C: Client, S: Session>: View {
135135
Button("Sign In") {
136136
Task { await submit() }
137137
}
138-
.buttonStyle(.borderedProminent)
139-
.keyboardShortcut(.defaultAction)
138+
.buttonStyle(.borderedProminent)
139+
.keyboardShortcut(.defaultAction)
140140
}.padding(.top, 5)
141141
}
142142
}

Coder Desktop/Coder Desktop/Views/Util.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Combine
22

33
// This is required for inspecting stateful views
4-
internal final class Inspection<V> {
4+
final class Inspection<V> {
55
let notice = PassthroughSubject<UInt, Never>()
66
var callbacks = [UInt: (V) -> Void]()
77

Coder Desktop/Coder Desktop/Views/VPNMenu.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ struct VPNMenu<VPN: VPNService, S: Session>: View {
44
@EnvironmentObject var vpn: VPN
55
@EnvironmentObject var session: S
66

7-
internal let inspection = Inspection<Self>()
7+
let inspection = Inspection<Self>()
88

99
var body: some View {
1010
// Main stack

0 commit comments

Comments
 (0)