Skip to content

Commit

Permalink
Sets up CI
Browse files Browse the repository at this point in the history
  • Loading branch information
kritzcreek committed Jul 27, 2024
1 parent c5cda0a commit 88df694
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 10 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Test Suite"
on:
push:
branches:
- main
pull_request:

jobs:
test:
name: CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: cargo-bins/[email protected]
- run: |
# For some reason the cached binaries don't end up on the path
# so we need to --force here
cargo binstall -y --force just wasm-bindgen-cli wasm-opt
just ci
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/target
/*.wasm
/build/
.idea
# Worktree for managing gh-pages branch
gh-pages/
# I use top-level nemo files for experimentation with the `just dev file.nemo` command all the time
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Features we implement "on-top"
- Nested set targets for composite types: `set p.particles[2].vx = 10.0`
- Block scoping

# Working on the project
## Working on the project

The compiler is written in Rust, so at the minimum you'll need a [Rust toolchain].

Expand Down
7 changes: 0 additions & 7 deletions crates/xtask-gen-ast/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,21 +261,14 @@ fn generate_syntax() -> Result<()> {
let mut grammar_str = include_str!("../../frontend/src/syntax/nodes.ungram").to_string();
normalize_newlines(&mut grammar_str);
let grammar = Grammar::from_str(&grammar_str).unwrap();
println!("{:#?}", grammar);

let ast = lower(&grammar);

println!("{:#?}", ast);

let src = generate_nodes(&ast)?;

let nodes_path = project_root()
.join("crates")
.join("frontend")
.join("src")
.join("syntax")
.join("nodes.rs");

let mut file: File = File::create(nodes_path)?;
write!(file, "{}", src)?;
Ok(())
Expand Down
15 changes: 13 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@ set windows-shell := ["pwsh.exe", "-NoLogo", "-Command"]
install:
cargo install --path crates/cli

ci:
just gen
git update-index -q --really-refresh
git diff-index --quiet HEAD crates/frontend/src/syntax/nodes.rs
cargo test --all
cargo clippy --all-targets --all-features
cargo fmt --all --check
just build-playground

gen:
cargo xtask-gen-ast
cargo fmt --all
cargo fmt -- crates/frontend/src/syntax/nodes.rs

build-wasm-lib:
cd crates/wasm-lib && cargo rustc --crate-type cdylib --target wasm32-unknown-unknown --release
Expand All @@ -26,8 +35,10 @@ dev FILE:
playground: build-wasm-lib
cd playground && npm i && npm run dev

update-gh-pages: build-wasm-lib
build-playground: build-wasm-lib
cd playground && npm i && npm run build

update-gh-pages: build-playground
rm -r gh-pages/*
cp -r playground/dist/* gh-pages/

Expand Down
5 changes: 5 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[toolchain]
channel = "1.80"
components = [ "rustfmt" ]
targets = [ "wasm32-unknown-unknown" ]
profile = "default"

0 comments on commit 88df694

Please sign in to comment.