diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 97e918aab37f3dc375eb259f416f7998b4b196fd..cdf01b1aa91dd722de2533887d44182a9c55fcb0 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -139,6 +139,21 @@ jobs: uses: crate-ci/typos@2d0ce569feab1f8752f1dde43cc2f2aa53236e06 with: 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: 60 clippy_windows: needs: diff --git a/tooling/xtask/src/tasks/workflows/run_tests.rs b/tooling/xtask/src/tasks/workflows/run_tests.rs index 8b633edab6d81ad71c31e25c5171af076402fa9d..f40e02335c5bbccd396ebed916a9a4d3a6a22f29 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 { named::uses( @@ -276,6 +280,30 @@ fn check_style() -> NamedJob { ) // v1.40.0 .with(("config", "./typos.toml")) } + + fn fetch_ts_query_ls() -> Step { + 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 { + 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()), ) }