on master help sign in
ensure rust grammar is available in CI
db3470dMichael Davis
.github/workflows/build.yml+22−8
@@ -14,8 +14,6 @@ jobs:
14 steps:
14 steps:
15 - name: Checkout sources
15 - name: Checkout sources
16 uses: actions/checkout@v3
16 uses: actions/checkout@v3
17− with:
18− submodules: true
19
17
20 - name: Install stable toolchain
18 - name: Install stable toolchain
21 uses: actions-rs/toolchain@v1
19 uses: actions-rs/toolchain@v1
@@ -53,8 +51,6 @@ jobs:
53 steps:
51 steps:
54 - name: Checkout sources
52 - name: Checkout sources
55 uses: actions/checkout@v3
53 uses: actions/checkout@v3
56− with:
57− submodules: true
58
54
59 - name: Install stable toolchain
55 - name: Install stable toolchain
60 uses: actions-rs/toolchain@v1
56 uses: actions-rs/toolchain@v1
@@ -81,6 +77,28 @@ jobs:
81 path: target
77 path: target
82 key: ${{ runner.os }}-v2-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
78 key: ${{ runner.os }}-v2-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
83
79
80+ - name: Cache test tree-sitter grammar
81+ uses: actions/cache@v2.1.7
82+ with:
83+ path: runtime/grammars
84+ key: ${{ runner.os }}-v2-tree-sitter-grammars-${{ hashFiles('**/Cargo.lock') }}
85+
86+ - run: cp .github/workflows/languages.toml ./languages.toml
87+
88+ - name: Download test tree-sitter grammar
89+ uses: actions-rs/cargo@v1
90+ with:
91+ use-cross: ${{ matrix.cross }}
92+ command: run
93+ args: -- --fetch-grammars
94+
95+ - name: Build test tree-sitter grammar
96+ uses: actions-rs/cargo@v1
97+ with:
98+ use-cross: ${{ matrix.cross }}
99+ command: run
100+ args: -- --build-grammars
101+
84 - name: Run cargo test
102 - name: Run cargo test
85 uses: actions-rs/cargo@v1
103 uses: actions-rs/cargo@v1
86 with:
104 with:
@@ -97,8 +115,6 @@ jobs:
97 steps:
115 steps:
98 - name: Checkout sources
116 - name: Checkout sources
99 uses: actions/checkout@v3
117 uses: actions/checkout@v3
100− with:
101− submodules: true
102
118
103 - name: Install stable toolchain
119 - name: Install stable toolchain
104 uses: actions-rs/toolchain@v1
120 uses: actions-rs/toolchain@v1
@@ -144,8 +160,6 @@ jobs:
144 steps:
160 steps:
145 - name: Checkout sources
161 - name: Checkout sources
146 uses: actions/checkout@v3
162 uses: actions/checkout@v3
147− with:
148− submodules: true
149
163
150 - name: Install stable toolchain
164 - name: Install stable toolchain
151 uses: actions-rs/toolchain@v1
165 uses: actions-rs/toolchain@v1
.github/workflows/languages.tomlnew file+26
@@ -0,0 +1,26 @@
1+# This languages.toml is used for testing in CI.
2+
3+[[language]]
4+name = "rust"
5+scope = "source.rust"
6+injection-regex = "rust"
7+file-types = ["rs"]
8+comment-token = "//"
9+roots = ["Cargo.toml", "Cargo.lock"]
10+indent = { tab-width = 4, unit = " " }
11+
12+[[grammar]]
13+name = "rust"
14+source = { git = "https://github.com/tree-sitter/tree-sitter-rust", rev = "a360da0a29a19c281d08295a35ecd0544d2da211" }
15+
16+[[language]]
17+name = "nix"
18+scope = "source.nix"
19+injection-regex = "nix"
20+file-types = ["nix"]
21+shebangs = []
22+roots = []
23+comment-token = "#"
24+
25+# A grammar entry is not necessary for this language - it is only used for
26+# testing TOML merging behavior.
.github/workflows/release.yml+14−8
@@ -53,8 +53,6 @@ jobs:
53 steps:
53 steps:
54 - name: Checkout sources
54 - name: Checkout sources
55 uses: actions/checkout@v3
55 uses: actions/checkout@v3
56− with:
57− submodules: true
58
56
59 - name: Install ${{ matrix.rust }} toolchain
57 - name: Install ${{ matrix.rust }} toolchain
60 uses: actions-rs/toolchain@v1
58 uses: actions-rs/toolchain@v1
@@ -64,6 +62,20 @@ jobs:
64 target: ${{ matrix.target }}
62 target: ${{ matrix.target }}
65 override: true
63 override: true
66
64
65+ - name: Fetch tree-sitter grammars
66+ uses: actions-rs/cargo@v1
67+ with:
68+ use-cross: ${{ matrix.cross }}
69+ command: run
70+ args: --release --locked --target ${{ matrix.target }} -- --fetch-grammars
71+
72+ - name: Build tree-sitter grammars
73+ uses: actions-rs/cargo@v1
74+ with:
75+ use-cross: ${{ matrix.cross }}
76+ command: run
77+ args: --release --locked --target ${{ matrix.target }} -- --build-grammars
78+
67 - name: Run cargo test
79 - name: Run cargo test
68 uses: actions-rs/cargo@v1
80 uses: actions-rs/cargo@v1
69 with:
81 with:
@@ -114,14 +126,8 @@ jobs:
114 steps:
126 steps:
115 - name: Checkout sources
127 - name: Checkout sources
116 uses: actions/checkout@v3
128 uses: actions/checkout@v3
117− with:
118− submodules: false
119
129
120 - uses: actions/download-artifact@v2
130 - uses: actions/download-artifact@v2
121− # with:
122− # path: dist
123− # - run: ls -al ./dist
124− - run: ls -al bins-*
125
131
126 - name: Calculate tag name
132 - name: Calculate tag name
127 run: |
133 run: |
helix-core/src/syntax.rs+4−8
@@ -2115,14 +2115,10 @@ mod test {
2115 let language = get_language(&crate::RUNTIME_DIR, "Rust").unwrap();
2115 let language = get_language(&crate::RUNTIME_DIR, "Rust").unwrap();
2116 let config = HighlightConfiguration::new(
2116 let config = HighlightConfiguration::new(
2117 language,
2117 language,
2118− &std::fs::read_to_string(
2118+ &std::fs::read_to_string("../runtime/grammars/sources/rust/queries/highlights.scm")
2119− "../helix-syntax/languages/tree-sitter-rust/queries/highlights.scm",
2120− )
2121− .unwrap(),
2119+ .unwrap(),
2122− &std::fs::read_to_string(
2120+ &std::fs::read_to_string("../runtime/grammars/sources/rust/queries/injections.scm")
2123− "../helix-syntax/languages/tree-sitter-rust/queries/injections.scm",
2124− )
2125− .unwrap(),
2121+ .unwrap(),
2126 "", // locals.scm
2122 "", // locals.scm
2127 )
2123 )
2128 .unwrap();
2124 .unwrap();