Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ci: Add check for formatting of query files (#50140)
Finn Evers9c7686942ea8
diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.ymlindex 97e918aab37..cdf01b1aa91 100644--- a/.github/workflows/run_tests.yml+++ b/.github/workflows/run_tests.yml@@ -139,6 +139,21 @@ jobs:uses: crate-ci/typos@2d0ce569feab1f8752f1dde43cc2f2aa53236e06with:config: ./typos.toml+ - name: run_tests::check_style::fetch_ts_query_ls+ uses: dsaltares/fetch-gh-release-asset@aa37ae5c44d3c9820bc12fe675e8670ecd93bd1c+ with:+ repo: ribru17/ts_query_ls+ version: tags/v3.15.1+ file: ts_query_ls-x86_64-unknown-linux-gnu.tar.gz+ - name: run_tests::check_style::run_ts_query_ls+ run: |-+ tar -xf ts_query_ls-x86_64-unknown-linux-gnu.tar.gz+ ./ts_query_ls format --check . || {+ echo "Found unformatted queries, please format them with ts_query_ls."+ echo "For easy use, install the Tree-sitter query extension:"+ echo "zed://extension/tree-sitter-query"+ false+ }timeout-minutes: 60clippy_windows:needs:diff --git a/tooling/xtask/src/tasks/workflows/run_tests.rs b/tooling/xtask/src/tasks/workflows/run_tests.rsindex 8b633edab6d..f40e02335c5 100644--- a/tooling/xtask/src/tasks/workflows/run_tests.rs+++ b/tooling/xtask/src/tasks/workflows/run_tests.rs@@ -3,6 +3,7 @@ use gh_workflow::{Workflow,};use indexmap::IndexMap;+use indoc::formatdoc;use crate::tasks::workflows::{steps::{CommonJobConditions, repository_owner_guard_expression},@@ -267,6 +268,9 @@ pub fn tests_pass(jobs: &[NamedJob]) -> NamedJob {named::job(job)}+const TS_QUERY_LS_FILE: &str = "ts_query_ls-x86_64-unknown-linux-gnu.tar.gz";+const CI_TS_QUERY_RELEASE: &str = "tags/v3.15.1";+fn check_style() -> NamedJob {fn check_for_typos() -> Step<Use> {named::uses(@@ -276,6 +280,30 @@ fn check_style() -> NamedJob {) // v1.40.0.with(("config", "./typos.toml"))}++ fn fetch_ts_query_ls() -> Step<Use> {+ named::uses(+ "dsaltares",+ "fetch-gh-release-asset",+ "aa37ae5c44d3c9820bc12fe675e8670ecd93bd1c",+ ) // v1.1.1+ .add_with(("repo", "ribru17/ts_query_ls"))+ .add_with(("version", CI_TS_QUERY_RELEASE))+ .add_with(("file", TS_QUERY_LS_FILE))+ }++ fn run_ts_query_ls() -> Step<Run> {+ named::bash(formatdoc!(+ r#"tar -xf {TS_QUERY_LS_FILE}+ ./ts_query_ls format --check . || {{+ echo "Found unformatted queries, please format them with ts_query_ls."+ echo "For easy use, install the Tree-sitter query extension:"+ echo "zed://extension/tree-sitter-query"+ false+ }}"#+ ))+ }+named::job(release_job(&[]).runs_on(runners::LINUX_MEDIUM)@@ -286,7 +314,9 @@ fn check_style() -> NamedJob {.add_step(steps::cargo_fmt()).add_step(steps::script("./script/check-todos")).add_step(steps::script("./script/check-keymaps"))- .add_step(check_for_typos()),+ .add_step(check_for_typos())+ .add_step(fetch_ts_query_ls())+ .add_step(run_ts_query_ls()),)}