Skip to content

Commit

Permalink
Add mold linker to CI (#871)
Browse files Browse the repository at this point in the history
* add mold linker

* add nix mold

* added carg-nextest to CI; swapped benchmark OCAML for JSON

* revert release changes

* revert ocaml languages.ncl change

* revert nextest addition

* update github actions

* updated CHANGELOG

* move flake check into separate job

* Revert "move flake check into separate job"

This reverts commit 649bf41.

* switched benchmark to nickel
  • Loading branch information
mkatychev authored Feb 17, 2025
1 parent 2af1310 commit b6ee73d
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 32 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3.1.0
uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@v22
uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixpkgs-unstable

- name: Setup up mold linker
uses: rui314/setup-mold@v1

- name: Set up Nix cache
uses: cachix/cachix-action@v12
uses: cachix/cachix-action@v15
with:
name: tweag-topiary
authToken: "${{ secrets.CACHIX_TWEAG_TOPIARY_AUTH_TOKEN }}"
Expand All @@ -41,7 +44,7 @@ jobs:
run: 'echo \{ \"foo\": \"bar\" \} | nix run . -- fmt -l json'

- name: Build the topiary-cli and test those tests that cannot be performed in Nix
run: nix develop --command bash -c "cargo test -p topiary-cli -F experimental"
run: nix develop --command bash -c "cargo test -p topiary-cli --features experimental"

- name: Build client-app example
run: nix build .#client-app
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ This name should be decided amongst the team before the release.
### Changed
<!-- - <Changes in existing functionality> -->
- [#859](https://github.com/tweag/topiary/pull/859) Break up integration tests per language, thanks to @mkatychev
- [#871](https://github.com/tweag/topiary/pull/859) Switch to `mold` linker for CI tests, thanks to @mkatychev

<!-- ### Deprecated -->
<!-- - <Soon-to-be removed features> -->
Expand Down
14 changes: 8 additions & 6 deletions Cargo.lock

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

11 changes: 2 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,9 @@ tokio-test = "0.4"
toml = "0.8"
tree-sitter = "0.24" # NOTE Update tree-sitter-loader to match
tree-sitter-loader = "0.24" # NOTE Align with tree-sitter
tree-sitter-json = "0.24"
tree-sitter-language = "0.1"
# tree-sitter-bash = { git = "https://github.com/tree-sitter/tree-sitter-bash", rev = "1b0321ee85701d5036c334a6f04761cdc672e64c" }
# tree-sitter-css = { git = "https://github.com/tree-sitter/tree-sitter-css.git", rev = "02b4ee757654b7d54fe35352fd8e53a8a4385d42" }
tree-sitter-json = { git = "https://github.com/tree-sitter/tree-sitter-json.git", rev = "4d770d31f732d50d3ec373865822fbe659e47c75" }
# tree-sitter-nickel = { git = "https://github.com/nickel-lang/tree-sitter-nickel", rev = "43433d8477b24cd13acaac20a66deda49b7e2547" }
tree-sitter-ocaml = { git = "https://github.com/tree-sitter/tree-sitter-ocaml.git", rev = "98c2130c59ca7553b47086f91c5d22180151ad55" }
# tree-sitter-ocamllex = { git = "https://github.com/314eter/tree-sitter-ocamllex.git", rev = "4b9898ccbf198602bb0dec9cd67cc1d2c0a4fad2" }
# tree-sitter-query = { git = "https://github.com/nvim-treesitter/tree-sitter-query", rev = "a0ccc351e5e868ec1f8135e97aa3b53c663cf2df" }
# tree-sitter-rust = { git = "https://github.com/tree-sitter/tree-sitter-rust.git", rev = "e0e8b6de6e4aa354749c794f5f36a906dcccda74" }
# tree-sitter-toml = { git = "https://github.com/tree-sitter/tree-sitter-toml.git", rev = "342d9be207c2dba869b9967124c679b5e6fd0ebe" }
tree-sitter-nickel = "0.3"
unescape = "0.1"
wasm-bindgen = "=0.2.100"
wasm-bindgen-futures = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion bin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
playground = writeShellApplication {
name = "playground";

runtimeInputs = with pkgs; [
runtimeInputs = with pkgs; pkgs.lib.optionals (!stdenv.isDarwin) [
inotify-tools
];

Expand Down
4 changes: 2 additions & 2 deletions topiary-config/languages.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
],
grammar.source.git = {
git = "https://github.com/tree-sitter/tree-sitter-json.git",
rev = "94f5c527b2965465956c2000ed6134dd24daf2a7",
rev = "v0.24.8",
},
},

Expand Down Expand Up @@ -69,7 +69,7 @@
extensions = ["mll"],
grammar.source.git = {
git = "https://github.com/314eter/tree-sitter-ocamllex.git",
rev = "4b9898ccbf198602bb0dec9cd67cc1d2c0a4fad2",
rev = "5da5bb7508ac9fd3317561670ef18c126a0fe2aa",
},
},

Expand Down
6 changes: 3 additions & 3 deletions topiary-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ prettydiff = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
streaming-iterator = { workspace = true }
topiary-tree-sitter-facade = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt"] }
topiary-tree-sitter-facade = { workspace = true }
tree-sitter = { workspace = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand All @@ -32,9 +32,9 @@ topiary-web-tree-sitter-sys.workspace = true
criterion = { workspace = true, features = ["async_futures"] }
env_logger = { workspace = true }
test-log = { workspace = true }
tree-sitter-json.workspace = true
tree-sitter-ocaml.workspace = true
tokio-test = { workspace = true }
tree-sitter-json.workspace = true
tree-sitter-nickel.workspace = true

[[bench]]
name = "benchmark"
Expand Down
14 changes: 7 additions & 7 deletions topiary-core/benches/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ use std::io;
use topiary_core::{formatter, Language, Operation, TopiaryQuery};

async fn format() {
let input = fs::read_to_string("../topiary-cli/tests/samples/input/ocaml.ml").unwrap();
let query_content = fs::read_to_string("../topiary-queries/queries/ocaml.scm").unwrap();
let ocaml = tree_sitter_ocaml::LANGUAGE_OCAML;
let input = fs::read_to_string("../topiary-cli/tests/samples/input/nickel.ncl").unwrap();
let query_content = fs::read_to_string("../topiary-queries/queries/nickel.scm").unwrap();
let nickel = tree_sitter_nickel::language();

let mut input = input.as_bytes();
let mut output = io::BufWriter::new(Vec::new());

let language: Language = Language {
name: "ocaml".to_owned(),
query: TopiaryQuery::new(&ocaml.into(), &query_content).unwrap(),
grammar: ocaml.into(),
name: "nickel".to_owned(),
query: TopiaryQuery::new(&nickel.into(), &query_content).unwrap(),
grammar: tree_sitter_nickel::language().into(),
indent: None,
};

Expand All @@ -32,7 +32,7 @@ async fn format() {
}

fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("format_ocaml", |b| {
c.bench_function("format_nickel", |b| {
b.to_async(FuturesExecutor).iter(format);
});
}
Expand Down

0 comments on commit b6ee73d

Please sign in to comment.