Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update xcconfig tracking and provisioning #234

Merged
merged 7 commits into from
Oct 29, 2024
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
8 changes: 0 additions & 8 deletions Examples/WhisperAX/Debug.xcconfig

This file was deleted.

10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,11 @@ setup:

generate-whisperax-xcconfig:
@echo "Updating DEVELOPMENT_TEAM in Examples/WhisperAX/Debug.xcconfig..."
@TEAM_ID=$$(defaults read com.apple.dt.Xcode IDEProvisioningTeamManagerLastSelectedTeamID 2>/dev/null); \
@TEAM_ID=$$(defaults read com.apple.dt.Xcode IDEProvisioningTeams | plutil -convert json -r -o - -- - | jq -r 'to_entries[0].value | sort_by(.teamType == "Individual") | .[0].teamID' 2>/dev/null); \
if [ -z "$$TEAM_ID" ]; then \
echo "Error: No Development Team ID found. Please log into Xcode with your Apple ID and select a team."; \
else \
if grep -q '^DEVELOPMENT_TEAM' Examples/WhisperAX/Debug.xcconfig; then \
sed -i '' "s/^\(DEVELOPMENT_TEAM *= *\).*/\1$$TEAM_ID/" Examples/WhisperAX/Debug.xcconfig; \
else \
echo "DEVELOPMENT_TEAM=$$TEAM_ID" >> Examples/WhisperAX/Debug.xcconfig; \
fi; \
echo "DEVELOPMENT_TEAM=$$TEAM_ID" > Examples/WhisperAX/Debug.xcconfig; \
echo "DEVELOPMENT_TEAM has been updated in Examples/WhisperAX/Debug.xcconfig with your Development Team ID: $$TEAM_ID"; \
fi

Expand Down Expand Up @@ -121,7 +117,7 @@ list-devices:
# make benchmark-devices DEVICES="iPhone 15 Pro Max,My Mac" # Benchmark specific device names from `make list-devices`
DEVICES ?=
DEBUG ?= false
benchmark-devices:
benchmark-devices: generate-whisperax-xcconfig
@if [ -n "$(DEVICES)" ]; then \
echo "Benchmarking specific devices: $(DEVICES)"; \
fastlane benchmark devices:"$(DEVICES)" debug:$(DEBUG); \
Expand Down
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ Check out the demo app on [TestFlight](https://testflight.apple.com/join/LPVOyJZ
- [Installation](#installation)
- [Swift Package Manager](#swift-package-manager)
- [Prerequisites](#prerequisites)
- [Steps](#steps)
- [Xcode Steps](#xcode-steps)
- [Package.swift](#packageswift)
- [Homebrew](#homebrew)
- [Getting Started](#getting-started)
- [Quick Example](#quick-example)
Expand All @@ -52,14 +53,33 @@ WhisperKit can be integrated into your Swift project using the Swift Package Man
- macOS 14.0 or later.
- Xcode 15.0 or later.

### Steps
### Xcode Steps

1. Open your Swift project in Xcode.
2. Navigate to `File` > `Add Package Dependencies...`.
3. Enter the package repository URL: `https://github.com/argmaxinc/whisperkit`.
4. Choose the version range or specific version.
5. Click `Finish` to add WhisperKit to your project.

### Package.swift

If you're using WhisperKit as part of a swift package, you can include it in your Package.swift dependencies as follows:

```swift
dependencies: [
.package(url: "https://github.com/argmaxinc/WhisperKit.git", from: "0.9.0"),
],
```

Then add `WhisperKit` as a dependency for your target:

```swift
.target(
name: "YourApp",
dependencies: ["WhisperKit"]
),
```

### Homebrew

You can install `WhisperKit` command line app using [Homebrew](https://brew.sh) by running the following command:
Expand Down
14 changes: 2 additions & 12 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ require 'pathname'
COMMIT_HASH = `git rev-parse --short HEAD`.strip
COMMIT_TIMESTAMP = `git log -1 --format=%ct`.strip
COMMIT_TIMESTAMP = Time.at(COMMIT_TIMESTAMP.to_i).utc.strftime('%Y-%m-%dT%H%M%S')
XCODE_TEAM_ID = `defaults read com.apple.dt.Xcode IDEProvisioningTeamManagerLastSelectedTeamID`.strip
WORKING_DIR = Dir.pwd
BASE_BENCHMARK_PATH = "#{WORKING_DIR}/benchmark_data".freeze
BASE_UPLOAD_PATH = "#{WORKING_DIR}/upload_folder".freeze
Expand Down Expand Up @@ -196,13 +195,6 @@ def run_benchmarks(devices:, config:)
end
end

team_id = XCODE_TEAM_ID
if team_id.empty?
UI.user_error!('Development Team ID not found. Please log into Xcode with your Apple ID.')
else
UI.message("Using Development Team ID: #{team_id}")
end

run_benchmark(devices, config)
end

Expand Down Expand Up @@ -239,7 +231,7 @@ def run_benchmark(devices, config)
xcargs = [
"MODEL_NAME=#{model}",
'-allowProvisioningUpdates',
"DEVELOPMENT_TEAM=#{XCODE_TEAM_ID}"
'-allowProvisioningDeviceRegistration'
].join(' ')

scan_result = scan(
Expand All @@ -255,9 +247,7 @@ def run_benchmark(devices, config)
output_directory: XCRESULT_PATH,
suppress_xcode_output: false,
result_bundle: true,
# show_xcode_test_logs: true
buildlog_path: XCRESULT_PATH,
# include_simulator_logs: true,
output_style: 'raw',
fail_build: false
)
Expand Down Expand Up @@ -357,7 +347,7 @@ def merge_all_summaries(summaries, devices, _config)

unless result[:success]
merged_data[:modelsTested] << model
merged_data[:failureInfo][model] = result[:error] || 'Test failed'
merged_data[:failureInfo][model] = result[:error] || "Test failed without error message, full output: #{result}"
end
end

Expand Down