Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .claude/rules/code-coverage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Code Coverage Measurement

- Use `make coverage` to measure code coverage. This is the authoritative source.
10 changes: 10 additions & 0 deletions .github/actions/setup-dev-environment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: setup dev environment
description: Set up the Node.js and Rust toolchains needed to build the project.
runs:
using: composite
steps:
- name: setup node
uses: ./.github/actions/setup-node

- name: setup rust
uses: ./.github/actions/setup-rust
10 changes: 10 additions & 0 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: setup node
description: Set up the Node.js toolchain used by jarmuz.
runs:
using: composite
steps:
- name: setup node.js
uses: actions/setup-node@v4
with:
node-version: 22
Comment thread
mcharytoniuk marked this conversation as resolved.
cache: npm
7 changes: 7 additions & 0 deletions .github/actions/setup-rust/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: setup rust
description: Set up the Rust build cache.
runs:
using: composite
steps:
- name: cache rust
uses: Swatinem/rust-cache@v2
34 changes: 34 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: unit tests

on:
push:
branches:
- main
pull_request:

jobs:
rust:
name: rust
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: setup rust
uses: ./.github/actions/setup-rust

- name: run tests
run: make test

clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: setup rust
uses: ./.github/actions/setup-rust

- name: run clippy
run: make clippy
45 changes: 32 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ RUST_LOG ?= debug
# Real targets
# -----------------------------------------------------------------------------

package-lock.json: package.json
npm install --package-lock-only

node_modules: package-lock.json
npm install --from-lockfile
touch node_modules

package-lock.json: package.json
npm install --package-lock-only

public: node_modules
./jarmuz-generate.mjs

target/debug/poet: target/debug/poet
Comment thread
mcharytoniuk marked this conversation as resolved.
cargo build

test_site-x86_64.AppImage: test_site.AppDir test_site.AppDir/poet
ARCH=x86_64 appimage-run ~/bin/appimagetool-x86_64.AppImage ./test_site.AppDir

test_site.AppDir:
cargo run make app-dir . \
--name test_site \
--output-directory . \
--title "Test Site" \
--version "1.2.3"

target/debug/poet: target/debug/poet
cargo build

test_site.AppDir/poet: target/debug/poet test_site.AppDir
cp target/debug/poet test_site.AppDir/poet

test_site-x86_64.AppImage: test_site.AppDir test_site.AppDir/poet
ARCH=x86_64 appimage-run ~/bin/appimagetool-x86_64.AppImage ./test_site.AppDir

# -----------------------------------------------------------------------------
# Phony targets
# -----------------------------------------------------------------------------
Expand All @@ -41,14 +41,33 @@ clean:
rm -rf node_modules
rm -rf target

.PHONY: clippy
clippy:
cargo clippy --workspace --all-targets -- -D warnings

.PHONY: coverage
coverage: node_modules
cargo llvm-cov clean --workspace
cargo llvm-cov --workspace --no-report
cargo llvm-cov report --json --output-path target/llvm-cov.json
cargo llvm-cov report
npx rust-coverage-check target/llvm-cov.json \
--workspace-root $(CURDIR) \
--gated rhai_components \
--required-percent 100

.PHONY: fmt
fmt: node_modules
./jarmuz-fmt.mjs

.PHONY: watch
watch: node_modules
./jarmuz-watch.mjs

.PHONY: release
release:
cargo build --release

.PHONY: test
test:
cargo test --workspace

.PHONY: watch
watch: node_modules
./jarmuz-watch.mjs
20 changes: 14 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"type": "module",
"version": "0.1.0",
"devDependencies": {
"@intentee/rust-coverage-check": "0.1.0",
"@types/hotwired__turbo": "^8.0.4",
"@types/react": "^19.1.10",
"@types/react-dom": "^19.1.7",
Expand Down
2 changes: 1 addition & 1 deletion poet/src/build_project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fn render_document<'render>(
let component_context = ContentDocumentComponentContext {
asset_manager: AssetManager::from_esbuild_metafile(esbuild_metafile, asset_path_renderer),
authors: authors.clone(),
available_authors: available_authors,
available_authors,
available_collections,
content_document_collections_ranked,
content_document_linker,
Expand Down
3 changes: 1 addition & 2 deletions poet/src/eval_mdx_element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ where
let tag_name = TagName {
name: name
.clone()
.ok_or_else(|| anyhow!("MdxJsxFlowElement without a name"))?
.into(),
.ok_or_else(|| anyhow!("MdxJsxFlowElement without a name"))?,
};

let props = {
Expand Down
4 changes: 2 additions & 2 deletions poet/src/generate_sitemap.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::path::PathBuf;
use std::path::Path;

use anyhow::Result;
use anyhow::anyhow;
Expand All @@ -16,7 +16,7 @@ pub fn create_sitemap<'a>(

for reference in content_documents {
let url = reference.canonical_link().map_err(|e| anyhow!(e))?;
let priority = if reference.basename_path == PathBuf::from("index") {
let priority = if reference.basename_path == Path::new("index") {
0.8
} else {
0.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ impl Handler for ResourcesListHandler {
}: Self::Request,
session: Self::Session,
) -> Result<HttpResponse<BoxBody>> {
let list_cursor = match cursor {
Some(list_cursor) => list_cursor,
None => ListResourcesCursor::default(),
};
let list_cursor: ListResourcesCursor = cursor.unwrap_or_default();

if list_cursor.per_page < 1 {
return Ok(HttpResponse::BadRequest().json(Error::invalid_params(
Expand Down
Loading
Loading