From 25bff4d598d72aabb0ffb6815fb638b88a77fae8 Mon Sep 17 00:00:00 2001 From: Miwa / Ensan Date: Sat, 3 May 2025 16:23:53 +0900 Subject: [PATCH 1/8] feat: add ci --- .github/workflows/swift.yml | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/swift.yml diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml new file mode 100644 index 00000000..d4451d51 --- /dev/null +++ b/.github/workflows/swift.yml @@ -0,0 +1,51 @@ +name: Swift Build and Test +on: + push: + pull_request: + +jobs: + macos-build: + name: Build and Test on macOS + runs-on: macos-latest + steps: + - uses: swift-actions/setup-swift@v2.3.0 + with: + swift-version: 6.1 + - uses: actions/checkout@v4 + with: + submodules: true + - name: Build + run: swift build --package-path Core + - name: Test + run: swift test --package-path Core + + xcodebuild-test: + name: Xcodebuild test on macOS + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Verify xcodebuild installation + run: xcodebuild -version + - name: List available schemes + run: xcodebuild -project azooKeyMac.xcodeproj -list + - name: Test building azooKeyMac (Release configuration) + run: xcodebuild -project azooKeyMac.xcodeproj -scheme azooKeyMac -configuration Release -quiet build + + swiftlint: + name: SwiftLint + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Install SwiftLint + run: | + brew update + brew install swiftlint + - name: Run SwiftLint + run: | + swiftlint --fix --format + swiftlint --quiet --strict + \ No newline at end of file From 90ae760bd3e783c39f8cc8c238a8351b13649425 Mon Sep 17 00:00:00 2001 From: Miwa / Ensan Date: Sat, 3 May 2025 16:29:34 +0900 Subject: [PATCH 2/8] =?UTF-8?q?fix:=20=E6=9C=80=E6=96=B0=E3=81=AESwiftLint?= =?UTF-8?q?=E3=81=A7=E6=A4=9C=E5=87=BA=E3=81=95=E3=82=8C=E3=82=8B=E5=95=8F?= =?UTF-8?q?=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- azooKeyMac/Extensions/KeychainHelper.swift | 2 +- azooKeyMac/InputController/OpenAIClient.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azooKeyMac/Extensions/KeychainHelper.swift b/azooKeyMac/Extensions/KeychainHelper.swift index 59a36896..dbac537b 100644 --- a/azooKeyMac/Extensions/KeychainHelper.swift +++ b/azooKeyMac/Extensions/KeychainHelper.swift @@ -33,7 +33,7 @@ enum KeychainHelper { let status = SecItemCopyMatching(query as CFDictionary, &dataTypeRef) if status == errSecSuccess, let data = dataTypeRef as? Data { - return String(decoding: data, as: UTF8.self) + return String(bytes: data, encoding: .utf8) } return nil diff --git a/azooKeyMac/InputController/OpenAIClient.swift b/azooKeyMac/InputController/OpenAIClient.swift index 0012f6df..4554de49 100644 --- a/azooKeyMac/InputController/OpenAIClient.swift +++ b/azooKeyMac/InputController/OpenAIClient.swift @@ -271,7 +271,7 @@ enum OpenAIClient { } guard httpResponse.statusCode == 200 else { - let responseBody = String(decoding: data, as: UTF8.self) + let responseBody = String(bytes: data, encoding: .utf8) ?? "Body is not encoded in UTF-8" throw OpenAIError.invalidResponseStatus(code: httpResponse.statusCode, body: responseBody) } From 86cb3a27f1e4f22fc101afab1f29e3f1a0aa66cf Mon Sep 17 00:00:00 2001 From: Miwa / Ensan Date: Sat, 3 May 2025 16:29:51 +0900 Subject: [PATCH 3/8] =?UTF-8?q?feat:=20SwiftLint=E3=81=AE=E3=83=90?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E8=A1=A8=E7=A4=BA=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/swift.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index d4451d51..7e95ebca 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -44,6 +44,8 @@ jobs: run: | brew update brew install swiftlint + - name: Check SwiftLint version + run: swiftlint version - name: Run SwiftLint run: | swiftlint --fix --format From 63283dc7d0669f57ec1ebc8ce87f590437b3b2a0 Mon Sep 17 00:00:00 2001 From: Miwa / Ensan Date: Sat, 3 May 2025 16:32:20 +0900 Subject: [PATCH 4/8] fix: update macOS version for updating Xcode version --- .github/workflows/swift.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 7e95ebca..71dcbc8e 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -6,7 +6,7 @@ on: jobs: macos-build: name: Build and Test on macOS - runs-on: macos-latest + runs-on: macos-15 steps: - uses: swift-actions/setup-swift@v2.3.0 with: @@ -21,7 +21,7 @@ jobs: xcodebuild-test: name: Xcodebuild test on macOS - runs-on: macos-latest + runs-on: macos-15 steps: - uses: actions/checkout@v4 with: @@ -35,7 +35,7 @@ jobs: swiftlint: name: SwiftLint - runs-on: macos-latest + runs-on: macos-15 steps: - uses: actions/checkout@v4 with: From 88907e60943c4aa6177ea6a2d10acd1f075eb234 Mon Sep 17 00:00:00 2001 From: Miwa / Ensan Date: Sat, 3 May 2025 16:46:00 +0900 Subject: [PATCH 5/8] fix: remove SYMROOT setting --- azooKeyMac.xcodeproj/project.pbxproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/azooKeyMac.xcodeproj/project.pbxproj b/azooKeyMac.xcodeproj/project.pbxproj index 53bbe3a1..a13c4692 100644 --- a/azooKeyMac.xcodeproj/project.pbxproj +++ b/azooKeyMac.xcodeproj/project.pbxproj @@ -420,7 +420,6 @@ SDKROOT = macosx; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SYMROOT = build; }; name = Debug; }; @@ -478,7 +477,6 @@ SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; - SYMROOT = build; }; name = Release; }; From 2dbfc06288a6d42316e7a75c579443adb8512a26 Mon Sep 17 00:00:00 2001 From: Miwa / Ensan Date: Sat, 3 May 2025 16:53:55 +0900 Subject: [PATCH 6/8] feat: use Xcode 16.3 --- .github/workflows/swift.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 71dcbc8e..2e182d29 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -8,9 +8,12 @@ jobs: name: Build and Test on macOS runs-on: macos-15 steps: - - uses: swift-actions/setup-swift@v2.3.0 - with: - swift-version: 6.1 + - name: Select Xcode 16.3 + run: | + XCODE_PATH=$(ls -d /Applications/Xcode_16.3*.app | head -n 1) + echo "Using Xcode at $XCODE_PATH" + sudo xcode-select -s "$XCODE_PATH/Contents/Developer" + xcodebuild -version - uses: actions/checkout@v4 with: submodules: true @@ -23,6 +26,12 @@ jobs: name: Xcodebuild test on macOS runs-on: macos-15 steps: + - name: Select Xcode 16.3 + run: | + XCODE_PATH=$(ls -d /Applications/Xcode_16.3*.app | head -n 1) + echo "Using Xcode at $XCODE_PATH" + sudo xcode-select -s "$XCODE_PATH/Contents/Developer" + xcodebuild -version - uses: actions/checkout@v4 with: submodules: true From 97b64250e9726697e6991a179815e3d3b114535b Mon Sep 17 00:00:00 2001 From: Miwa / Ensan Date: Sat, 3 May 2025 16:59:18 +0900 Subject: [PATCH 7/8] fix: avoid signing --- .github/workflows/swift.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 2e182d29..9c90f671 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -40,7 +40,14 @@ jobs: - name: List available schemes run: xcodebuild -project azooKeyMac.xcodeproj -list - name: Test building azooKeyMac (Release configuration) - run: xcodebuild -project azooKeyMac.xcodeproj -scheme azooKeyMac -configuration Release -quiet build + run: xcodebuild \ + -project azooKeyMac.xcodeproj \ + -scheme azooKeyMac \ + -configuration Release \ + -destination 'generic/platform=macOS' \ + CODE_SIGNING_ALLOWED=NO \ + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGN_IDENTITY="" swiftlint: name: SwiftLint From aa518f8b0954302c603463d3b4b8bcf6232ba641 Mon Sep 17 00:00:00 2001 From: Miwa / Ensan Date: Sat, 3 May 2025 17:03:13 +0900 Subject: [PATCH 8/8] fix yaml --- .github/workflows/swift.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 9c90f671..63fed2a8 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -40,7 +40,8 @@ jobs: - name: List available schemes run: xcodebuild -project azooKeyMac.xcodeproj -list - name: Test building azooKeyMac (Release configuration) - run: xcodebuild \ + run: | + xcodebuild \ -project azooKeyMac.xcodeproj \ -scheme azooKeyMac \ -configuration Release \