on master help sign in
ensure rust grammar is available in CI
commitdb3470d973ed97445d180c18035c2858e4749782 authorMichael Davis <mcarsondavis@gmail.com> dateMon 14 Feb 2022, 17:36 (5 years ago) parent8081e9f
4 files changed+66−24
.github/workflows/build.yml+22−8 .github/workflows/languages.toml+26 .github/workflows/release.yml+14−8 helix-core/src/syntax.rs+4−8
.github/workflows/build.yml+22−8
@@ -14,8 +14,6 @@ jobs:
1414 steps:
1515 - name: Checkout sources
1616 uses: actions/checkout@v3
17− with:
18− submodules: true
1917
2018 - name: Install stable toolchain
2119 uses: actions-rs/toolchain@v1
@@ -53,8 +51,6 @@ jobs:
5351 steps:
5452 - name: Checkout sources
5553 uses: actions/checkout@v3
56− with:
57− submodules: true
5854
5955 - name: Install stable toolchain
6056 uses: actions-rs/toolchain@v1
@@ -81,6 +77,28 @@ jobs:
8177 path: target
8278 key: ${{ runner.os }}-v2-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
8379
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+
84102 - name: Run cargo test
85103 uses: actions-rs/cargo@v1
86104 with:
@@ -97,8 +115,6 @@ jobs:
97115 steps:
98116 - name: Checkout sources
99117 uses: actions/checkout@v3
100− with:
101− submodules: true
102118
103119 - name: Install stable toolchain
104120 uses: actions-rs/toolchain@v1
@@ -144,8 +160,6 @@ jobs:
144160 steps:
145161 - name: Checkout sources
146162 uses: actions/checkout@v3
147− with:
148− submodules: true
149163
150164 - name: Install stable toolchain
151165 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:
5353 steps:
5454 - name: Checkout sources
5555 uses: actions/checkout@v3
56− with:
57− submodules: true
5856
5957 - name: Install ${{ matrix.rust }} toolchain
6058 uses: actions-rs/toolchain@v1
@@ -64,6 +62,20 @@ jobs:
6462 target: ${{ matrix.target }}
6563 override: true
6664
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+
6779 - name: Run cargo test
6880 uses: actions-rs/cargo@v1
6981 with:
@@ -114,14 +126,8 @@ jobs:
114126 steps:
115127 - name: Checkout sources
116128 uses: actions/checkout@v3
117− with:
118− submodules: false
119129
120130 - uses: actions/download-artifact@v2
121− # with:
122− # path: dist
123− # - run: ls -al ./dist
124− - run: ls -al bins-*
125131
126132 - name: Calculate tag name
127133 run: |
helix-core/src/syntax.rs+4−8
@@ -2115,14 +2115,10 @@ mod test {
21152115 let language = get_language(&crate::RUNTIME_DIR, "Rust").unwrap();
21162116 let config = HighlightConfiguration::new(
21172117 language,
2118− &std::fs::read_to_string(
2119− "../helix-syntax/languages/tree-sitter-rust/queries/highlights.scm",
2120− )
2121− .unwrap(),
2122− &std::fs::read_to_string(
2123− "../helix-syntax/languages/tree-sitter-rust/queries/injections.scm",
2124− )
2125− .unwrap(),
2118+ &std::fs::read_to_string("../runtime/grammars/sources/rust/queries/highlights.scm")
2119+ .unwrap(),
2120+ &std::fs::read_to_string("../runtime/grammars/sources/rust/queries/injections.scm")
2121+ .unwrap(),
21262122 "", // locals.scm
21272123 )
21282124 .unwrap();