lum_ccc_rust/Taskfile.yaml

260 lines
7.9 KiB
YAML
Executable File

# https://taskfile.dev
version: "3"
vars:
APPLE_TARGETS: "aarch64-apple-ios aarch64-apple-darwin x86_64-apple-darwin"
tasks:
# ── Setup ────────────────────────────────────────────────────────────────
setup:
desc: Initialise submodules and verify toolchain
cmds:
- git submodule update --init --recursive
- rustc --version
- cmd: cmake --version | head -1
platforms: [darwin, linux]
- cmd: cmake --version
platforms: [windows]
status:
- test -f vendors/wolfssl/CMakeLists.txt
# ── Build ────────────────────────────────────────────────────────────────
build:
desc: Build all crates (debug)
deps: [setup]
cmds:
- cargo build --workspace
release:
desc: Build all crates (release)
deps: [setup]
cmds:
- cargo build --workspace --release
build:ios:
desc: Cross-compile for iOS (aarch64-apple-ios, release)
deps: [setup]
cmds:
- cargo build-ios --release
build:macos-arm64:
desc: Cross-compile for macOS ARM64 (release)
deps: [setup]
cmds:
- cargo build-macos-arm64 --release
build:macos-x64:
desc: Cross-compile for macOS x86_64 (release)
deps: [setup]
cmds:
- cargo build-macos-x64 --release
build:apple:
desc: Cross-compile all Apple targets (iOS + macOS, release)
deps: [setup]
cmds:
- cargo build-ios --release
- cargo build-macos-arm64 --release
- cargo build-macos-x64 --release
build:android-arm64:
desc: Cross-compile for Android ARM64 (release)
deps: [setup]
preconditions:
- sh: command -v aarch64-linux-android21-clang
msg: "Android NDK not in PATH. Set ANDROID_NDK_HOME and add toolchain bin/ to PATH."
cmds:
- cargo build-android-arm64 --release
build:android-x64:
desc: Cross-compile for Android x86_64 (release)
deps: [setup]
preconditions:
- sh: command -v x86_64-linux-android21-clang
msg: "Android NDK not in PATH. Set ANDROID_NDK_HOME and add toolchain bin/ to PATH."
cmds:
- cargo build-android-x64 --release
build:android:
desc: Cross-compile all Android targets (release)
cmds:
- task: build:android-arm64
- task: build:android-x64
# ── Windows (run on Windows only) ─────────────────────────────────────
build:windows-x64:
desc: Build for Windows x86_64 (release, run on Windows)
platforms: [windows]
deps: [setup]
cmds:
- cargo build --workspace --release --target x86_64-pc-windows-msvc
ci:windows:
desc: Full CI pipeline for Windows
platforms: [windows]
cmds:
- task: lint
- task: test
- task: conformance
- task: build:windows-x64
# ── Linux ────────────────────────────────────────────────────────────────
build:linux-x64:
desc: Build for Linux x86_64 (release, run on Linux)
platforms: [linux]
deps: [setup]
cmds:
- cargo build --workspace --release --target x86_64-unknown-linux-gnu
ci:linux:
desc: Full CI pipeline for Linux (lint + test + conformance + build + Android)
platforms: [linux]
cmds:
- task: lint
- task: test
- task: conformance
- task: build:linux-x64
- task: build:android
# ── Aggregate ────────────────────────────────────────────────────────────
build:all:
desc: Build for all targets (native + Apple + Android)
cmds:
- task: release
- task: build:apple
- task: build:android
# ── Test ─────────────────────────────────────────────────────────────────
test:
desc: Run all unit tests
deps: [setup]
cmds:
- cargo test --workspace
conformance:
desc: Run NIST/RFC conformance test vectors
deps: [setup]
cmds:
- cargo run -p ccc-conformance-tests
test:all:
desc: Run unit tests + conformance tests
cmds:
- task: test
- task: conformance
# ── Lint ─────────────────────────────────────────────────────────────────
fmt:
desc: Format code with rustfmt
cmds:
- cargo fmt
fmt:check:
desc: Check formatting (no changes)
cmds:
- cargo fmt --check
clippy:
desc: Run clippy with strict warnings
deps: [setup]
cmds:
- cargo clippy --workspace -- -D warnings
lint:
desc: Full lint (fmt check + clippy)
cmds:
- task: fmt:check
- task: clippy
# ── CI Pipeline ─────────────────────────────────────────────────────────
ci:
desc: Full CI pipeline (lint → test → conformance → release build)
cmds:
- task: lint
- task: test
- task: conformance
- task: release
ci:full:
desc: Full CI + all cross-compile targets (platform-aware)
cmds:
- task: ci
- task: build:apple
- task: build:android
ci:macos:
desc: Full CI pipeline for macOS (lint + test + conformance + Apple targets)
platforms: [darwin]
cmds:
- task: lint
- task: test
- task: conformance
- task: release
- task: build:apple
# ── Utility ─────────────────────────────────────────────────────────────
clean:
desc: Remove all build artifacts
cmds:
- cargo clean
check:
desc: Type-check without building (fast)
deps: [setup]
cmds:
- cargo check --workspace
check:stub:
desc: Type-check wolfSSL crate with stub_ffi (no C build)
cmds:
- cargo check -p ccc-crypto-wolfssl --features stub_ffi
artifacts:
desc: Show artifact locations for all built targets
platforms: [darwin, linux]
cmds:
- |
echo "=== Build artifacts ==="
for dir in target/debug target/release target/aarch64-apple-ios/release target/aarch64-apple-darwin/release target/x86_64-apple-darwin/release target/aarch64-linux-android/release target/x86_64-linux-android/release target/x86_64-unknown-linux-gnu/release; do
if [ -d "$dir" ]; then
echo ""
echo "── $dir ──"
find "$dir" -maxdepth 1 \( -name "*.rlib" -o -name "*.a" -o -name "*.dylib" -o -name "*.so" -o -name "conformance" \) 2>/dev/null | sort
find "$dir/build" -name "libwolfssl.a" 2>/dev/null | head -1
fi
done
artifacts:windows:
desc: Show artifact locations (Windows)
platforms: [windows]
cmds:
- cmd: |
echo === Build artifacts ===
for %%d in (target\debug target\release target\x86_64-pc-windows-msvc\release) do (
if exist "%%d" (
echo.
echo -- %%d --
dir /b "%%d\*.rlib" "%%d\*.lib" "%%d\*.dll" "%%d\*.exe" 2>nul
)
)
##### ##### ##### ##### ##### ##### ##### ##### ##### #####
# Default
#
# if we are executed with option of "--taskfile", and no task, so this default...that is why we pass it along
# --taskfile {{.TASKFILE}}
# we spent several hours fixing that out, because of PEBKAC
default:
cmds:
- task --list --taskfile {{.TASKFILE}}