Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Swift Build and Test
on:
push:
pull_request:

jobs:
macos-build:
name: Build and 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
- 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-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
- 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 \
-destination 'generic/platform=macOS' \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGN_IDENTITY=""

swiftlint:
name: SwiftLint
runs-on: macos-15
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install SwiftLint
run: |
brew update
brew install swiftlint
- name: Check SwiftLint version
run: swiftlint version
- name: Run SwiftLint
run: |
swiftlint --fix --format
swiftlint --quiet --strict

2 changes: 0 additions & 2 deletions azooKeyMac.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SYMROOT = build;
};
name = Debug;
};
Expand Down Expand Up @@ -478,7 +477,6 @@
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SYMROOT = build;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion azooKeyMac/Extensions/KeychainHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Comment thread
ensan-hcl marked this conversation as resolved.
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion azooKeyMac/InputController/OpenAIClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Comment thread
ensan-hcl marked this conversation as resolved.
throw OpenAIError.invalidResponseStatus(code: httpResponse.statusCode, body: responseBody)
}

Expand Down