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
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Setup Rust
description: Setup Rust toolchain

runs:
using: composite
steps:
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo dependencies
uses: Swatinem/rust-cache@v2
7 changes: 0 additions & 7 deletions .gitmodules

This file was deleted.

1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,7 @@ Then use `mcp__beads__*` functions instead of CLI commands.
- ❌ Do NOT create markdown TODO lists
- ❌ Do NOT use external issue trackers
- ❌ Do NOT duplicate tracking systems
- ❌ Do NOT run `bd sync` — beads is local-only in this project, there is nothing to sync

---

Expand Down
117 changes: 0 additions & 117 deletions src/css/style.css

This file was deleted.

12 changes: 6 additions & 6 deletions src/rs/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use tracing::info;

use crate::Result;

const RHEO_TOML: &str = include_str!("../../examples/init_template/rheo.toml");
const STYLE_CSS: &str = include_str!("../../examples/init_template/style.css");
const INDEX_TYP: &str = include_str!("../../examples/init_template/content/index.typ");
const ABOUT_TYP: &str = include_str!("../../examples/init_template/content/about.typ");
const REFERENCES_BIB: &str = include_str!("../../examples/init_template/content/references.bib");
const HEADER_SVG: &str = include_str!("../../examples/init_template/content/img/header.svg");
const RHEO_TOML: &str = include_str!("../templates/init/rheo.toml");
const STYLE_CSS: &str = include_str!("../templates/init/style.css");
const INDEX_TYP: &str = include_str!("../templates/init/content/index.typ");
const ABOUT_TYP: &str = include_str!("../templates/init/content/about.typ");
const REFERENCES_BIB: &str = include_str!("../templates/init/content/references.bib");
const HEADER_SVG: &str = include_str!("../templates/init/content/img/header.svg");

/// Initialize a new Rheo project at the given path.
///
Expand Down
2 changes: 1 addition & 1 deletion src/rs/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl OutputConfig {
/// * `Err` if copying failed
pub fn copy_html_assets(&self, project_style_css: Option<&Path>) -> Result<()> {
// Default bundled CSS (embedded at compile time)
const DEFAULT_CSS: &str = include_str!("../css/style.css");
const DEFAULT_CSS: &str = include_str!("../templates/init/style.css");

let dest_path = self.html_dir.join("style.css");

Expand Down
File renamed without changes.
File renamed without changes.
34 changes: 0 additions & 34 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ tests/
│ │ │ ├── pdf/ # Reference PDF metadata (*.metadata.json)
│ │ │ └── epub/ # Reference EPUB metadata
│ │ ├── blog_post/
│ │ ├── rheo_docs/
│ │ ├── fcl_site/
│ │ └── init_template/
│ ├── cases/ # Custom project tests
│ └── files/ # Single-file tests
Expand Down Expand Up @@ -49,38 +47,6 @@ cargo test --test harness
cargo test -- --nocapture
```

## Git Submodules

This project includes external example repositories as git submodules:

- `examples/rheo_docs` - Rheo documentation/manual

### Setup

After cloning the repository, initialize submodules before running tests:

```bash
# Initialize submodules
git submodule update --init --recursive
```

### Updating Submodules

To update submodules to the latest upstream version:

```bash
# Update all submodules to latest
git submodule update --remote

# Or update specific submodule
cd examples/rheo_docs
git pull origin main
cd ../..
git add examples/rheo_docs
```

**Note**: While rheo uses Jujutsu (jj) for version control, git submodule commands must be used for submodule management. After using git commands for submodules, return to the normal jj workflow for committing changes.

## Font Consistency

To ensure tests produce identical output across different environments (local machines and CI), tests automatically use only Typst's embedded fonts. This prevents font-related rendering differences that cause page count and layout variations.
Expand Down
70 changes: 67 additions & 3 deletions tests/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ use std::path::PathBuf;

#[test_case("examples/blog_site")]
#[test_case("examples/blog_post")]
#[test_case("examples/rheo_docs")]
#[test_case("examples/fcl_site")]
#[test_case("examples/init_template")]
#[test_case("examples/cover-letter.typ")]
#[test_case("examples/blog_site/content/index.typ")]
#[test_case("examples/blog_site/content/severance-ep-1.typ")]
Expand Down Expand Up @@ -579,3 +576,70 @@ fn test_warning_formatting() {
.args(["run", "--", "clean", test_dir.to_str().unwrap()])
.output();
}

/// Test that `rheo init` creates a valid project that compiles successfully
#[test]
fn test_rheo_init_and_compile() {
let test_dir = PathBuf::from("tests/store/init_project");

// Clean previous test artifacts
if test_dir.exists() {
std::fs::remove_dir_all(&test_dir).expect("Failed to clean test dir");
}

// Run `rheo init`
let init_output = std::process::Command::new("cargo")
.args(["run", "--", "init", test_dir.to_str().unwrap()])
.output()
.expect("Failed to run rheo init");

assert!(
init_output.status.success(),
"rheo init failed: {}",
String::from_utf8_lossy(&init_output.stderr)
);

// Verify expected files exist
assert!(test_dir.join("rheo.toml").exists(), "Missing rheo.toml");
assert!(test_dir.join("style.css").exists(), "Missing style.css");
assert!(
test_dir.join("content/index.typ").exists(),
"Missing content/index.typ"
);
assert!(
test_dir.join("content/about.typ").exists(),
"Missing content/about.typ"
);

// Compile the initialized project
let build_dir = test_dir.join("build");
let compile_output = std::process::Command::new("cargo")
.args([
"run",
"--",
"compile",
test_dir.to_str().unwrap(),
"--build-dir",
build_dir.to_str().unwrap(),
])
.env("TYPST_IGNORE_SYSTEM_FONTS", "1")
.output()
.expect("Failed to run rheo compile");

assert!(
compile_output.status.success(),
"Compilation of init project failed: {}",
String::from_utf8_lossy(&compile_output.stderr)
);

// Verify outputs were created
assert!(
build_dir.join("html").exists(),
"HTML output directory missing"
);

// Clean up
if test_dir.exists() {
std::fs::remove_dir_all(&test_dir).ok();
}
}
7 changes: 6 additions & 1 deletion tests/helpers/comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,12 @@ where

fn extract_build_relative_path(repo_relative_path: &str) -> PathBuf {
let path = PathBuf::from(repo_relative_path);
let after_project = path.components().skip(2).collect::<PathBuf>();
let components: Vec<_> = path.components().collect();
// If path has fewer than 3 components, it's already a build-relative path (e.g. "style.css")
if components.len() <= 2 {
return path;
}
let after_project = components.into_iter().skip(2).collect::<PathBuf>();
after_project
.strip_prefix("content")
.unwrap_or(&after_project)
Expand Down
4 changes: 2 additions & 2 deletions tests/helpers/reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,9 @@ fn create_binary_metadata(
};

// Detect source file location to create repo-relative path
// For CSS files, use the common source location since they're copied from src/css/
// For CSS files, store the build-relative path directly (CSS is at the html root)
let repo_relative_path = if filetype == "css" {
PathBuf::from("src/css").join(rel_path)
PathBuf::from(rel_path)
} else if project_path.join("content").join(rel_path).exists() {
project_path.join("content").join(rel_path)
} else if project_path.join(rel_path).exists() {
Expand Down
2 changes: 1 addition & 1 deletion tests/ref/cases/pdf_merge/html/style.metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"filetype": "css",
"file_size": 1080,
"path": "src/css/style.css",
"path": "style.css",
"hash": "4d7f5be0d96185eadac50dc80ff33a0e3d435dac98b42929216b4311b589d6db"
}
6 changes: 3 additions & 3 deletions tests/ref/examples/blog_post/html/style.metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"filetype": "css",
"file_size": 2603,
"path": "src/css/style.css",
"hash": "02d37b0efd17dd8c8570eb1e3a71db78cde94f9de017e354aca839b6134ca93e"
"file_size": 2740,
"path": "style.css",
"hash": "fa215e69d8daf48f3c044f959d9071cceca24e0582656defd654cfd1581695ec"
}
6 changes: 3 additions & 3 deletions tests/ref/examples/blog_site/html/style.metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"filetype": "css",
"file_size": 2603,
"path": "src/css/style.css",
"hash": "02d37b0efd17dd8c8570eb1e3a71db78cde94f9de017e354aca839b6134ca93e"
"file_size": 2740,
"path": "style.css",
"hash": "fa215e69d8daf48f3c044f959d9071cceca24e0582656defd654cfd1581695ec"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"filetype": "css",
"file_size": 2603,
"path": "src/css/style.css",
"hash": "02d37b0efd17dd8c8570eb1e3a71db78cde94f9de017e354aca839b6134ca93e"
"file_size": 2740,
"path": "style.css",
"hash": "fa215e69d8daf48f3c044f959d9071cceca24e0582656defd654cfd1581695ec"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"filetype": "css",
"file_size": 2603,
"path": "src/css/style.css",
"hash": "02d37b0efd17dd8c8570eb1e3a71db78cde94f9de017e354aca839b6134ca93e"
"file_size": 2740,
"path": "style.css",
"hash": "fa215e69d8daf48f3c044f959d9071cceca24e0582656defd654cfd1581695ec"
}
Loading
Loading