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
4 changes: 4 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# The repository's macOS 27 SDK runner is a custom runner label.
self-hosted-runner:
labels:
- xcode-27
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@ updates:
- "*"
commit-message:
prefix: ci
- package-ecosystem: cargo
directory: /Rust/QuotaBarCore
schedule:
interval: monthly
groups:
rust-dependencies:
patterns:
- "*"
commit-message:
prefix: build
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ jobs:
with:
persist-credentials: false

- name: Install pinned Rust toolchain
if: ${{ needs.changes.outputs.build == 'true' }}
run: bash Scripts/setup_rust_ci.sh

- name: Print tool versions
if: ${{ needs.changes.outputs.build == 'true' }}
run: |
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ jobs:
- language: javascript-typescript
os: ubuntu-24.04
build-mode: none
- language: python
os: ubuntu-24.04
build-mode: none
- language: rust
os: ubuntu-24.04
build-mode: none
- language: actions
os: ubuntu-24.04
build-mode: none
Expand All @@ -42,6 +48,10 @@ jobs:
with:
persist-credentials: false

- name: Install pinned Rust toolchain for Swift linking
if: ${{ matrix.language == 'swift' }}
run: bash Scripts/setup_rust_ci.sh

- name: Initialize CodeQL
uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ jobs:
with:
persist-credentials: false

- name: Install pinned Rust toolchain
run: bash Scripts/setup_rust_ci.sh

- name: Require the native menu bar SDK
run: |
set -euo pipefail
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.build/
.swiftpm/
Package.resolved
Rust/**/target/

# Build output
build/
Expand Down
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ CONFIG ?= debug
PROVIDER ?= codex
PREVIEW_STATE ?= loaded
SNAPSHOT_DIR ?= $(BUILD_DIR)/screenshots/card
TEST_RUNNER ?=
SWIFT := Scripts/swift.sh
BIN := $(BUILD_DIR)/$(CONFIG)/$(APP_NAME)
DEBUG_BIN := $(BUILD_DIR)/debug/$(APP_NAME)
LOG_SUBSYSTEM := com.quotabar.app

.PHONY: build run preview card-snapshot probe probe-cost benchmark-cost benchmark-startup logs kill test app readme-assets clean
.PHONY: build run preview card-snapshot probe probe-cost benchmark-cost benchmark-startup logs kill test rust-check app readme-assets clean

build:
$(SWIFT) build -c $(CONFIG) --product $(APP_NAME)
Expand Down Expand Up @@ -67,9 +68,14 @@ app:

## Core and app regressions use a plain executable of assertions. Always a debug build: the
## suite imports the app with @testable, which needs a module compiled for testing.
test:
test: rust-check
$(SWIFT) build -c debug --product $(APP_NAME)Tests
$(BUILD_DIR)/debug/$(APP_NAME)Tests
$(TEST_RUNNER) $(BUILD_DIR)/debug/$(APP_NAME)Tests

rust-check:
cargo fmt --manifest-path Rust/QuotaBarCore/Cargo.toml -- --check
CARGO_TARGET_DIR="$(CURDIR)/.build/rust" MACOSX_DEPLOYMENT_TARGET=14.0 cargo test --locked --manifest-path Rust/QuotaBarCore/Cargo.toml
CARGO_TARGET_DIR="$(CURDIR)/.build/rust" MACOSX_DEPLOYMENT_TARGET=14.0 cargo clippy --locked --manifest-path Rust/QuotaBarCore/Cargo.toml --all-targets -- -D warnings

clean:
$(SWIFT) package clean
Expand Down
2 changes: 2 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ let package = Package(
.library(name: "QuotaBarCore", targets: ["QuotaBarCore"]),
],
targets: [
.systemLibrary(name: "CQuotaBarRust"),
// Data layer: credentials, usage endpoints, snapshot models. No AppKit.
.target(
name: "QuotaBarCore",
dependencies: ["CQuotaBarRust"],
resources: [.copy("Resources/UsageReport"), .copy("Resources/Pricing")],
swiftSettings: [.swiftLanguageMode(.v5)]
),
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ Codex quota requests use the `chatgpt_base_url` in `$CODEX_HOME/config.toml`, if

Building requires full Xcode with a Swift 6 toolchain. The project uses Swift Package Manager. `Scripts/swift.sh` defaults to `/Applications/Xcode.app/Contents/Developer` without changing the global `xcode-select` setting.

Rust kernels also require `rustup` and the toolchain pinned in `rust-toolchain.toml`. Install rustup with `brew install rustup` and add its `bin` directory to PATH as Homebrew instructs. Use `make` or `Scripts/swift.sh` for builds: the wrapper builds the matching Cargo profile, links the static library, and invalidates SwiftPM's cache when Rust changes. Bare `swift build` and opening the package directly in Xcode do not run this integration. Prebuilt app users do not need Rust. See [Rust core boundaries and validation](docs/rust-migration.md).

The release workflow requires the macOS 27 SDK for native menu bar sessions on macOS 27. Local builds with older SDKs use the legacy menu bar handling. The minimum runtime remains macOS 14.

```bash
Expand Down
2 changes: 2 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ Codex 额度请求会使用 `$CODEX_HOME/config.toml` 中的 `chatgpt_base_url`

构建需要完整的 Xcode 及 Swift 6 工具链。项目使用 Swift Package Manager。`Scripts/swift.sh` 默认使用 `/Applications/Xcode.app/Contents/Developer`,不会修改全局 `xcode-select` 设置。

Rust kernels also require `rustup` and the toolchain pinned in `rust-toolchain.toml`. Install rustup with `brew install rustup` and add its `bin` directory to PATH as Homebrew instructs. Use `make` or `Scripts/swift.sh` for builds: the wrapper builds the matching Cargo profile, links the static library, and invalidates SwiftPM's cache when Rust changes. Bare `swift build` and opening the package directly in Xcode do not run this integration. Prebuilt app users do not need Rust. See [Rust core boundaries and validation](docs/rust-migration.md).

发布工作流要求 macOS 27 SDK,以支持 macOS 27 的原生菜单栏会话。使用较旧 SDK 的本地构建会采用旧版菜单栏处理方式。最低运行系统仍为 macOS 14。

```bash
Expand Down
107 changes: 107 additions & 0 deletions Rust/QuotaBarCore/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions Rust/QuotaBarCore/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "quotabar_core"
version = "0.1.0"
edition = "2024"
rust-version = "1.98"
publish = false
license = "AGPL-3.0-only"

[lib]
crate-type = ["staticlib", "rlib"]

[dependencies]
serde = { version = "=1.0.229", features = ["derive"] }
serde_json = "=1.0.154"

[profile.release]
panic = "unwind"
lto = "thin"
codegen-units = 1
overflow-checks = true
Loading
Loading