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.
This commit is contained in:
Michael Davis 2022-06-05 05:53:20 -05:00 committed by GitHub
parent f1ae496860
commit 0035c29fc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View file

@ -23,11 +23,9 @@ jobs:
- name: Fetch tree-sitter grammars
uses: actions-rs/cargo@v1
env:
HELIX_DISABLE_AUTO_GRAMMAR_BUILD: yes
with:
command: run
args: -- --grammar fetch
args: --package=helix-loader --bin=hx-loader
- name: Bundle grammars
run: tar cJf grammars.tar.xz -C runtime/grammars/sources .

View file

@ -9,6 +9,10 @@ categories = ["editor"]
repository = "https://github.com/helix-editor/helix"
homepage = "https://helix-editor.com"
[[bin]]
name = "hx-loader"
path = "src/main.rs"
[dependencies]
anyhow = "1"
serde = { version = "1.0", features = ["derive"] }
@ -27,4 +31,3 @@ threadpool = { version = "1.0" }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
libloading = "0.7"

9
helix-loader/src/main.rs Normal file
View file

@ -0,0 +1,9 @@
use anyhow::Result;
use helix_loader::grammar::fetch_grammars;
// This binary is used in the Release CI as an optimization to cut down on
// compilation time. This is not meant to be run manually.
fn main() -> Result<()> {
fetch_grammars()
}