Skip to content

Commit 87e7a03

Browse files
doublegateclaude
andcommitted
ci: fix release workflow build failures for musl, aarch64, and Windows targets
Resolve 3 platform build failures across the 6-target release matrix: - Add `vendored-openssl` feature chain (spectre-cli -> spectre-core -> prtip-scanner) enabling OpenSSL compilation from source via openssl-src crate for environments without system OpenSSL (musl static linking, aarch64 cross-compilation). Matrix entries for x86_64-unknown-linux-musl and aarch64-unknown-linux-gnu now pass `--features vendored-openssl` via conditional matrix expression. - Add `LIB` env var for Windows pointing to Npcap SDK `Lib\x64` directory so the MSVC linker can locate `Packet.lib` and `wpcap.lib` at build time. - Make LICENSE copy conditional in both Unix (`if [ -f LICENSE ]`) and Windows (`if (Test-Path LICENSE)`) packaging steps to prevent failures when the file path varies. Split Windows `Copy-Item` into separate calls for PowerShell compatibility. - Add `CARGO_HOME` env var set to `${{ github.workspace }}/.cargo` for consistent cargo behavior across CI runners. Also updates CHANGELOG.md, CLAUDE.md (musl build command), and .gitignore (.cargo/ directory from CARGO_HOME override). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 700b817 commit 87e7a03

7 files changed

Lines changed: 48 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
env:
1010
CARGO_TERM_COLOR: always
11+
CARGO_HOME: ${{ github.workspace }}/.cargo
1112

1213
permissions:
1314
contents: write
@@ -27,10 +28,12 @@ jobs:
2728
- target: x86_64-unknown-linux-musl
2829
os: ubuntu-latest
2930
artifact: spectre-linux-x86_64-musl
31+
features: vendored-openssl
3032
- target: aarch64-unknown-linux-gnu
3133
os: ubuntu-latest
3234
artifact: spectre-linux-aarch64
3335
cross: true
36+
features: vendored-openssl
3437
- target: x86_64-apple-darwin
3538
os: macos-latest
3639
artifact: spectre-macos-x86_64
@@ -70,21 +73,23 @@ jobs:
7073
run: |
7174
Invoke-WebRequest -Uri "https://npcap.com/dist/npcap-sdk-1.13.zip" -OutFile "npcap-sdk.zip"
7275
Expand-Archive -Path "npcap-sdk.zip" -DestinationPath "npcap-sdk"
76+
echo "LIB=${{ github.workspace }}\npcap-sdk\Lib\x64" >> $env:GITHUB_ENV
7377
7478
- name: Build (native)
7579
if: '!matrix.cross'
76-
run: cargo build --release --target ${{ matrix.target }}
80+
run: cargo build --release --target ${{ matrix.target }} ${{ matrix.features && format('--features {0}', matrix.features) || '' }}
7781

7882
- name: Build (cross)
7983
if: matrix.cross
80-
run: cross build --release --target ${{ matrix.target }}
84+
run: cross build --release --target ${{ matrix.target }} ${{ matrix.features && format('--features {0}', matrix.features) || '' }}
8185

8286
- name: Package (Unix)
8387
if: runner.os != 'Windows'
8488
run: |
8589
mkdir -p dist
8690
cp target/${{ matrix.target }}/release/spectre dist/
87-
cp README.md LICENSE CHANGELOG.md dist/
91+
cp README.md CHANGELOG.md dist/
92+
if [ -f LICENSE ]; then cp LICENSE dist/; fi
8893
cd dist && tar -czvf ../${{ matrix.artifact }}.tar.gz *
8994
9095
- name: Package (Windows)
@@ -93,7 +98,9 @@ jobs:
9398
run: |
9499
New-Item -ItemType Directory -Force -Path dist
95100
Copy-Item "target/${{ matrix.target }}/release/spectre${{ matrix.ext }}" dist/
96-
Copy-Item README.md, LICENSE, CHANGELOG.md dist/
101+
Copy-Item README.md dist/
102+
Copy-Item CHANGELOG.md dist/
103+
if (Test-Path LICENSE) { Copy-Item LICENSE dist/ }
97104
Compress-Archive -Path dist/* -DestinationPath "${{ matrix.artifact }}.zip"
98105
99106
- name: Upload Release Asset

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ vgcore.*
283283
# GitHub Actions local testing
284284
.act/
285285

286+
# Cargo home override (used in CI release workflow via CARGO_HOME env var)
287+
.cargo/
288+
286289
# =============================================================================
287290
# Tauri (GUI)
288291
# =============================================================================

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
- **Unified asset upload step**: Single upload step per build job handles both `.tar.gz` (Unix) and `.zip` (Windows) with `fail_on_unmatched_files: false` so each platform only uploads its own format without failing on the other's missing archive
2020
- **Added `SPECTRE.sln` to `.gitignore`**: Visual Studio solution files (`.sln`, `.suo`, `.user`, etc.) now excluded from version control
2121

22+
#### Release Workflow Build Fixes (3 Platform Failures)
23+
24+
- **Added `vendored-openssl` feature chain** for musl and aarch64 cross-compilation targets:
25+
- `spectre-cli` feature `vendored-openssl` forwards to `spectre-core/vendored-openssl`
26+
- `spectre-core` feature `vendored-openssl` forwards to `prtip-scanner/vendored-openssl`
27+
- Enables `openssl-src` crate to compile OpenSSL from source when system OpenSSL is unavailable (musl, cross-compiled aarch64)
28+
- Matrix entries for `x86_64-unknown-linux-musl` and `aarch64-unknown-linux-gnu` now set `features: vendored-openssl`
29+
- Build commands conditionally pass `--features vendored-openssl` via matrix expression: `${{ matrix.features && format('--features {0}', matrix.features) || '' }}`
30+
- **Fixed Windows Npcap SDK linker failure**: Added `LIB` environment variable pointing to `npcap-sdk\Lib\x64` directory so the MSVC linker can find `Packet.lib` and `wpcap.lib`
31+
- **Conditional LICENSE packaging**: `cp LICENSE dist/` replaced with `if [ -f LICENSE ]; then cp LICENSE dist/; fi` (Unix) and `if (Test-Path LICENSE) { Copy-Item LICENSE dist/ }` (Windows) to avoid build failures when LICENSE file path varies
32+
- **Windows PowerShell packaging fix**: Split single `Copy-Item README.md, LICENSE, CHANGELOG.md dist/` into separate `Copy-Item` calls for PowerShell compatibility
33+
- **Added `CARGO_HOME` env var**: Set to `${{ github.workspace }}/.cargo` for consistent cargo behavior across CI runners
34+
2235
### Planned
2336
- GUI application with Tauri 2.0 — Phase 5
2437
- MCP server implementation — Phase 6

CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ cargo build --release --workspace
3434
# Build specific crate
3535
cargo build --release -p spectre-cli
3636

37+
# Build for musl or cross-compilation (vendors OpenSSL from source)
38+
cargo build --release --target x86_64-unknown-linux-musl --features vendored-openssl
39+
3740
# Pull CyberChef-MCP container
3841
docker pull doublegate/cyberchef-mcp:latest
3942

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/spectre-cli/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ categories = ["command-line-utilities"]
1515
name = "spectre"
1616
path = "src/main.rs"
1717

18+
[features]
19+
# Vendor OpenSSL for static linking (required for musl and cross-compilation builds)
20+
vendored-openssl = ["spectre-core/vendored-openssl"]
21+
1822
[dependencies]
1923
# Core library
2024
spectre-core = { path = "../spectre-core" }

crates/spectre-core/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ description = "SPECTRE core orchestration library"
1111
keywords = ["security", "scanning", "encryption", "orchestration"]
1212
categories = ["network-programming"]
1313

14+
[features]
15+
# Vendor OpenSSL for static linking (required for musl and cross-compilation builds)
16+
vendored-openssl = ["prtip-scanner/vendored-openssl"]
17+
1418
[dependencies]
1519
# Async runtime
1620
tokio = { workspace = true }

0 commit comments

Comments
 (0)