set shell := ["bash", "-eu", "-o", "pipefail", "-c"]

default:
  @just --list

ecp-lint:
  ./scripts/ecp-lint.sh

git-hosting:
  ./scripts/git-configure-hosting.sh

git-mirrors:
  ./scripts/git-push-mirrors.sh

deploy-ecp-forge:
  ./scripts/deploy-ecp-forge.sh

netboot-stage:
  ./scripts/netboot-stage.sh

netboot-build-ipxe:
  ./scripts/netboot-build-ipxe.sh

netboot-serve:
  ./scripts/netboot-serve.sh

test-core:
  cargo test -p ec-core -p ec-crypto -p ec-moq -p ec-iroh -p ec-linux-iptv

test-workspace:
  cargo test --workspace

cov-core:
  mkdir -p tmp/coverage
  cargo llvm-cov -p ec-core -p ec-crypto -p ec-moq -p ec-iroh -p ec-linux-iptv \
    --ignore-filename-regex 'third_party|target' \
    --lcov --output-path tmp/coverage/core.lcov

cov-core-html:
  mkdir -p tmp/coverage/html
  cargo llvm-cov -p ec-core -p ec-crypto -p ec-moq -p ec-iroh -p ec-linux-iptv \
    --ignore-filename-regex 'third_party|target' \
    --html --output-dir tmp/coverage/html

cov-workspace:
  mkdir -p tmp/coverage
  cargo llvm-cov --workspace \
    --ignore-filename-regex 'third_party|target|tmp' \
    --lcov --output-path tmp/coverage/workspace.lcov
  ./scripts/coverage-summary.sh tmp/coverage/workspace.lcov > tmp/coverage/workspace.summary.txt

cov-workspace-html:
  mkdir -p tmp/coverage/workspace-html
  cargo llvm-cov --workspace \
    --ignore-filename-regex 'third_party|target|tmp' \
    --html --output-dir tmp/coverage/workspace-html

cov-workspace-nix:
  mkdir -p tmp/coverage
  nix develop --accept-flake-config -c cargo llvm-cov --workspace \
    --ignore-filename-regex 'third_party|target|tmp' \
    --lcov --output-path tmp/coverage/workspace.lcov
  ./scripts/coverage-summary.sh tmp/coverage/workspace.lcov > tmp/coverage/workspace.summary.txt

cov-workspace-html-nix:
  mkdir -p tmp/coverage/workspace-html
  nix develop --accept-flake-config -c cargo llvm-cov --workspace \
    --ignore-filename-regex 'third_party|target|tmp' \
    --html --output-dir tmp/coverage/workspace-html
