on master help sign in
Use a minimal binary to fetch grammar sources in release CI (#2557)

This is an optimization for the release CI. The release CI can take a while since it compiles release builds for all operating systems. We cut down on duplicate work and overall time by fetching tree-sitter grammar repositories and then using those repositories in all later steps. Previously we built all of helix just to run helix_loader::grammar::fetch_grammars() which is wasteful on time. With this change we only build the helix-loader crate.

commit0035c29fc16f6c795257e241fddd9f2178bc4b4c authorMichael Davis <mcarsondavis@gmail.com> dateSun 5 Jun 2022, 05:53 (4 years ago) parentf1ae496
3 files changed+14−4
.github/workflows/release.yml+1−3 helix-loader/Cargo.toml+4−1 helix-loader/src/main.rs+9
.github/workflows/release.yml+1−3
@@ -23,11 +23,9 @@ jobs:
2323
2424 - name: Fetch tree-sitter grammars
2525 uses: actions-rs/cargo@v1
26− env:
27− HELIX_DISABLE_AUTO_GRAMMAR_BUILD: yes
2826 with:
2927 command: run
30− args: -- --grammar fetch
28+ args: --package=helix-loader --bin=hx-loader
3129
3230 - name: Bundle grammars
3331 run: tar cJf grammars.tar.xz -C runtime/grammars/sources .
helix-loader/Cargo.toml+4−1
@@ -9,6 +9,10 @@ categories = ["editor"]
99repository = "https://github.com/helix-editor/helix"
1010homepage = "https://helix-editor.com"
1111
12+[[bin]]
13+name = "hx-loader"
14+path = "src/main.rs"
15+
1216[dependencies]
1317anyhow = "1"
1418serde = { version = "1.0", features = ["derive"] }
@@ -27,4 +31,3 @@ threadpool = { version = "1.0" }
2731
2832[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
2933libloading = "0.7"
30−
helix-loader/src/main.rsnew file+9
@@ -0,0 +1,9 @@
1+use anyhow::Result;
2+use helix_loader::grammar::fetch_grammars;
3+
4+// This binary is used in the Release CI as an optimization to cut down on
5+// compilation time. This is not meant to be run manually.
6+
7+fn main() -> Result<()> {
8+ fetch_grammars()
9+}