aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Davis2022-02-14 23:36:02 +0000
committerBlaž Hrastnik2022-03-10 08:31:57 +0000
commitdb3470d973ed97445d180c18035c2858e4749782 (patch)
treeed79d7cd3c84b1546ea690c98c52611ea815af58
parent8081e9f0520819309fef9a3df7cad8df24126a28 (diff)
ensure rust grammar is available in CI
-rw-r--r--.github/workflows/build.yml30
-rw-r--r--.github/workflows/languages.toml26
-rw-r--r--.github/workflows/release.yml22
-rw-r--r--helix-core/src/syntax.rs12
4 files changed, 66 insertions, 24 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 659c9c78..e0eb5322 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -14,8 +14,6 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v3
- with:
- submodules: true
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
@@ -53,8 +51,6 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v3
- with:
- submodules: true
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
@@ -81,6 +77,28 @@ jobs:
path: target
key: ${{ runner.os }}-v2-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
+ - name: Cache test tree-sitter grammar
+ uses: actions/cache@v2.1.7
+ with:
+ path: runtime/grammars
+ key: ${{ runner.os }}-v2-tree-sitter-grammars-${{ hashFiles('**/Cargo.lock') }}
+
+ - run: cp .github/workflows/languages.toml ./languages.toml
+
+ - name: Download test tree-sitter grammar
+ uses: actions-rs/cargo@v1
+ with:
+ use-cross: ${{ matrix.cross }}
+ command: run
+ args: -- --fetch-grammars
+
+ - name: Build test tree-sitter grammar
+ uses: actions-rs/cargo@v1
+ with:
+ use-cross: ${{ matrix.cross }}
+ command: run
+ args: -- --build-grammars
+
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
@@ -97,8 +115,6 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v3
- with:
- submodules: true
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
@@ -144,8 +160,6 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v3
- with:
- submodules: true
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
diff --git a/.github/workflows/languages.toml b/.github/workflows/languages.toml
new file mode 100644
index 00000000..18cf71cf
--- /dev/null
+++ b/.github/workflows/languages.toml
@@ -0,0 +1,26 @@
+# This languages.toml is used for testing in CI.
+
+[[language]]
+name = "rust"
+scope = "source.rust"
+injection-regex = "rust"
+file-types = ["rs"]
+comment-token = "//"
+roots = ["Cargo.toml", "Cargo.lock"]
+indent = { tab-width = 4, unit = " " }
+
+[[grammar]]
+name = "rust"
+source = { git = "https://github.com/tree-sitter/tree-sitter-rust", rev = "a360da0a29a19c281d08295a35ecd0544d2da211" }
+
+[[language]]
+name = "nix"
+scope = "source.nix"
+injection-regex = "nix"
+file-types = ["nix"]
+shebangs = []
+roots = []
+comment-token = "#"
+
+# A grammar entry is not necessary for this language - it is only used for
+# testing TOML merging behavior.
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 1f9b6a32..2a9ea80e 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -53,8 +53,6 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v3
- with:
- submodules: true
- name: Install ${{ matrix.rust }} toolchain
uses: actions-rs/toolchain@v1
@@ -64,6 +62,20 @@ jobs:
target: ${{ matrix.target }}
override: true
+ - name: Fetch tree-sitter grammars
+ uses: actions-rs/cargo@v1
+ with:
+ use-cross: ${{ matrix.cross }}
+ command: run
+ args: --release --locked --target ${{ matrix.target }} -- --fetch-grammars
+
+ - name: Build tree-sitter grammars
+ uses: actions-rs/cargo@v1
+ with:
+ use-cross: ${{ matrix.cross }}
+ command: run
+ args: --release --locked --target ${{ matrix.target }} -- --build-grammars
+
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
@@ -114,14 +126,8 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v3
- with:
- submodules: false
- uses: actions/download-artifact@v2
- # with:
- # path: dist
- # - run: ls -al ./dist
- - run: ls -al bins-*
- name: Calculate tag name
run: |
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index 038fbfdd..52239d10 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -2115,14 +2115,10 @@ mod test {
let language = get_language(&crate::RUNTIME_DIR, "Rust").unwrap();
let config = HighlightConfiguration::new(
language,
- &std::fs::read_to_string(
- "../helix-syntax/languages/tree-sitter-rust/queries/highlights.scm",
- )
- .unwrap(),
- &std::fs::read_to_string(
- "../helix-syntax/languages/tree-sitter-rust/queries/injections.scm",
- )
- .unwrap(),
+ &std::fs::read_to_string("../runtime/grammars/sources/rust/queries/highlights.scm")
+ .unwrap(),
+ &std::fs::read_to_string("../runtime/grammars/sources/rust/queries/injections.scm")
+ .unwrap(),
"", // locals.scm
)
.unwrap();