Skip to content

Commit 75dc37f

Browse files
alphaqiuclaude
andcommitted
fix: resolve all CI/CD workflow failures
CRITICAL fixes: - build.yml: Add mkdir -p before lipo to create output directory - clipboard_test.rs: Add #[cfg(target_os)] guards to platform-specific imports/tests - security.yml: Fix binary name (keyring-cli -> ok) IMPORTANT fixes: - commands/mod.rs: Add #[allow(unused_imports)] to pub use statements MINOR improvements: - security.yml, coverage.yml: Standardize to dtolnay/rust-toolchain@stable - coverage.yml: Combine HTML+JSON in single tarpaulin run, read from file Fixes issues from code review: - macOS universal build: lipo failed due to missing directory - Test compilation: Platform-specific imports caused errors on Linux/Windows - Security verification: Wrong binary name meant checks weren't running Co-Authored-By: Claude (glm-4.7) <noreply@anthropic.com>
1 parent 91cb1fa commit 75dc37f

5 files changed

Lines changed: 25 additions & 13 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
5656
- name: Create universal binary
5757
run: |
58+
mkdir -p target/universal-apple-darwin-release
5859
lipo -create \
5960
target/x86_64-apple-darwin/release/ok \
6061
target/aarch64-apple-darwin/release/ok \

.github/workflows/coverage.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ jobs:
1414
uses: actions/checkout@v4
1515

1616
- name: Install Rust toolchain
17-
uses: actions-rust-lang/setup-rust-toolchain@v1
18-
with:
19-
toolchain: stable
17+
uses: dtolnay/rust-toolchain@stable
2018

2119
- name: Cache dependencies
2220
uses: actions/cache@v4
@@ -30,7 +28,7 @@ jobs:
3028
- name: Run tests with coverage
3129
run: |
3230
cargo install cargo-tarpaulin
33-
cargo tarpaulin --out Html --output-dir coverage --timeout 300 --verbose
31+
cargo tarpaulin --out Html --out Json --output-dir coverage --timeout 300 --verbose
3432
3533
- name: Upload coverage report
3634
uses: actions/upload-artifact@v4
@@ -40,7 +38,7 @@ jobs:
4038

4139
- name: Check coverage threshold
4240
run: |
43-
COVERAGE=$(cargo tarpaulin --out Json 2>/dev/null | jq '.coverage // 0' || echo "0")
41+
COVERAGE=$(jq '.coverage // 0' coverage/tarpaulin.json 2>/dev/null || echo "0")
4442
echo "Coverage: $COVERAGE%"
4543
if (( $(echo "$COVERAGE < 80" | bc -l) )); then
4644
echo "❌ Coverage below 80% (current: $COVERAGE%)"
@@ -51,7 +49,7 @@ jobs:
5149
5250
- name: Add coverage summary
5351
run: |
54-
COVERAGE=$(cargo tarpaulin --out Json 2>/dev/null | jq '.coverage // 0' || echo "0")
52+
COVERAGE=$(jq '.coverage // 0' coverage/tarpaulin.json 2>/dev/null || echo "0")
5553
echo "## Test Coverage" >> $GITHUB_STEP_SUMMARY
5654
echo "Current coverage: **$COVERAGE%**" >> $GITHUB_STEP_SUMMARY
5755
echo "" >> $GITHUB_STEP_SUMMARY

.github/workflows/security.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ jobs:
2626
uses: actions/checkout@v4
2727

2828
- name: Install Rust toolchain
29-
uses: actions-rust-lang/setup-rust-toolchain@v1
29+
uses: dtolnay/rust-toolchain@stable
3030
with:
3131
toolchain: stable
32-
target: ${{ matrix.target }}
32+
targets: ${{ matrix.target }}
3333

3434
- name: Cache dependencies
3535
uses: actions/cache@v4
@@ -48,7 +48,7 @@ jobs:
4848
if: runner.os != 'Windows'
4949
run: |
5050
echo "Checking for test environment variables in release binary..."
51-
if grep -r "OK_MASTER_PASSWORD\|OK_CONFIG_DIR\|OK_DATA_DIR" target/release/keyring-cli 2>/dev/null; then
51+
if grep -r "OK_MASTER_PASSWORD\|OK_CONFIG_DIR\|OK_DATA_DIR" target/release/ok 2>/dev/null; then
5252
echo "❌ ERROR: Test environment variables leaked to release!"
5353
exit 1
5454
fi
@@ -59,7 +59,7 @@ jobs:
5959
shell: pwsh
6060
run: |
6161
Write-Host "Checking for test environment variables in release binary..."
62-
$binaryPath = "target\release\keyring-cli.exe"
62+
$binaryPath = "target\release\ok.exe"
6363
if (Test-Path $binaryPath) {
6464
$content = Get-Content $binaryPath -Raw -Encoding ASCII
6565
if ($content -match "OK_MASTER_PASSWORD|OK_CONFIG_DIR|OK_DATA_DIR") {

src/tui/commands/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ mod update;
99
mod delete;
1010
mod search;
1111

12+
// Re-export command handlers for external use
13+
#[allow(unused_imports)]
1214
pub use list::handle_list;
15+
#[allow(unused_imports)]
1316
pub use show::handle_show;
17+
#[allow(unused_imports)]
1418
pub use new::handle_new;
19+
#[allow(unused_imports)]
1520
pub use update::handle_update;
21+
#[allow(unused_imports)]
1622
pub use delete::handle_delete;
1723
pub use search::handle_search;
1824

tests/clipboard_test.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
#[cfg(target_os = "linux")]
22
use keyring_cli::clipboard::linux::LinuxClipboard;
3+
4+
#[cfg(target_os = "macos")]
35
use keyring_cli::clipboard::macos::MacOSClipboard;
4-
use keyring_cli::clipboard::manager::{ClipboardConfig, ClipboardManager};
6+
57
#[cfg(target_os = "windows")]
68
use keyring_cli::clipboard::windows::WindowsClipboard;
9+
10+
use keyring_cli::clipboard::manager::{ClipboardConfig, ClipboardManager};
711
use keyring_cli::clipboard::ClipboardService;
812
use std::time::Duration;
913

14+
#[cfg(target_os = "macos")]
1015
#[test]
1116
fn test_macos_clipboard() {
1217
let mut clipboard = MacOSClipboard;
@@ -49,9 +54,10 @@ fn test_linux_clipboard() {
4954
assert_eq!(clipboard.timeout(), Duration::from_secs(45));
5055
}
5156

57+
#[cfg(target_os = "macos")]
5258
#[test]
5359
fn test_clipboard_service() {
54-
let mut macos_clipboard = MacOSClipboard;
60+
let macos_clipboard = MacOSClipboard;
5561
let config = ClipboardConfig {
5662
timeout_seconds: 60,
5763
clear_after_copy: true,
@@ -70,9 +76,10 @@ fn test_clipboard_service() {
7076
assert!(service.clear_clipboard().is_ok());
7177
}
7278

79+
#[cfg(target_os = "macos")]
7380
#[test]
7481
fn test_content_length_limit() {
75-
let mut macos_clipboard = MacOSClipboard;
82+
let macos_clipboard = MacOSClipboard;
7683
let config = ClipboardConfig {
7784
timeout_seconds: 30,
7885
clear_after_copy: true,

0 commit comments

Comments
 (0)