Skip to content

Latest commit

 

History

History
251 lines (171 loc) · 4.43 KB

File metadata and controls

251 lines (171 loc) · 4.43 KB

Marmite Development Tasks

This file contains development tasks for the Marmite static site generator.

build

Build the release binary

cargo build --release

embed

Rebuild after changing embedded assets (toolbar, templates, shortcodes)

touch src/embedded.rs && cargo build

serve

Build and serve the example site while watching for changes on the example dir

rm -rf ./example/site && cargo run --quiet -- example --serve --watch --force -vvvv

serve_site

Build and serve the marmite.blog site locally including the CI customizations

.github/prepare_site.sh
python .github/contributors.py marmitesite/content/pages/contributors.md
cargo run --quiet -- marmitesite --serve --watch --force -vvvv

serve_theme

Build and serve with theme_template

rm -rf marmitesite
cp -R example marmitesite
rm -rf marmitesite/content/_hero.md
cargo run --quiet -- marmitesite --serve --watch --force -vvvv --theme theme_template

check

Check code formatting and run clippy

set -e
cargo fmt -- --check
cargo clippy -- -D warnings

pedantic

Check code formatting and run clippy with pedantic warnings

set -e
cargo fmt -- --check
cargo clippy -- -W clippy::pedantic -D warnings

fmt

Format the code

cargo fmt

fix

Fix clippy warnings

cargo clippy --fix

pedantic_fix

Fix clippy warnings with pedantic settings

cargo clippy --fix -- -W clippy::pedantic

test

Run all tests (unit and integration)

cargo test

test_unit

Run unit tests only

cargo test --bin marmite

test_integration

Run integration tests only

cargo test --test '*'

watch

Watch for changes on the whole source code and rebuild the example site without serving it.

cargo watch -c -q -x "run example --force -vvvv"

bumpversion (tag)

Bump version in Cargo.toml

#!/usr/bin/env bash
cargo set-version --version || cargo install cargo-edit@0.13.0
cargo set-version --package marmite --locked "$tag"
cargo generate-lockfile
mask fmt
git add ./Cargo.toml ./Cargo.lock
git commit -m "chore: bump version to $tag"

pushtag (tag)

Push a new tag to the repository

#!/usr/bin/env bash
git push
git tag -a "$tag" -m "chore: push $tag"
git push --tags

publish (tag)

Publish a new version (bumpversion + pushtag)

mask bumpversion "$tag"
mask pushtag "$tag"

retag (tag)

Amend changes and retag and push tags again

git push origin :refs/tags/$tag
git commit --amend --no-edit --allow-empty
git tag -f $tag
git push --force-with-lease
git push origin $tag

coverage

Calculate code coverage and generate cobertura.xml

cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --out xml

coverage_llvm

Calculate coverage using llvm

cargo llvm-cov clean --workspace # remove artifacts that may affect the coverage results
cargo llvm-cov --no-report
rm -rf /tmp/test_blog
rm -rf /tmp/test_site
cargo llvm-cov --no-report run -- example /tmp/test_site
cargo llvm-cov --no-report run -- /tmp/test_blog --init-site
cargo llvm-cov --no-report run -- /tmp/test_blog --start-theme fluffy
cargo llvm-cov --no-report run -- /tmp/test_blog --theme fluffy
cargo llvm-cov --no-report run -- /tmp/test_blog --name foo --tagline bar --toc true --enable-search true --colorscheme gruvbox
cargo llvm-cov report --html # generate report without tests (replace with --lcov for file report)

install_hook

Install git pre-commit hook that runs mask pedantic

#!/usr/bin/env bash
hook=".git/hooks/pre-commit"
cat > "$hook" << 'HOOK'
#!/bin/sh
mask pedantic
HOOK
chmod +x "$hook"
echo "Pre-commit hook installed at $hook"

build_python

Build Python wheel with maturin

uv run --with "pip,maturin[zig],cffi" maturin build --release

build_wheel

Build Python wheel with specific interpreter

uv run --with "pip,maturin[zig],cffi" maturin build --release --strip --interpreter python3

python_dev_install

Install Python package in development mode

uv run --with "pip,maturin[zig],cffi" maturin develop --release

maturin_build

Build Python wheel with uv and maturin

uv run --with pip,maturin[zig],cffi maturin build --release

maturin_sdist

Build source distribution with maturin

uv run --with pip,maturin[zig],cffi maturin sdist