Skip to content

Commit 8c1c4c3

Browse files
committed
ci: update workflows, add query validation
1 parent d1a5dc3 commit 8c1c4c3

File tree

4 files changed

+65
-97
lines changed

4 files changed

+65
-97
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,58 @@ name: CI
22

33
on:
44
push:
5-
branches:
6-
- master
5+
branches: [ master ]
76
pull_request:
8-
branches:
9-
- "**"
7+
branches: [ master ]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{github.workflow}}-${{github.ref}}
12+
cancel-in-progress: true
1013

1114
jobs:
1215
test:
13-
runs-on: ${{ matrix.os }}
16+
name: Test parsers
17+
runs-on: ${{matrix.os}}
1418
strategy:
15-
fail-fast: true
19+
fail-fast: false
1620
matrix:
17-
os: [macos-latest, ubuntu-latest]
21+
os: [ubuntu-latest, windows-latest, macos-latest]
1822
steps:
19-
- uses: actions/checkout@v3
20-
- uses: actions/setup-node@v2
23+
- name: Set up repository
24+
uses: actions/checkout@v5
25+
26+
- name: Set up tree-sitter
27+
uses: tree-sitter/setup-action@v2
2128
with:
22-
node-version: 18
23-
- run: |
24-
npm install
25-
npm run build
29+
install-lib: false
2630

27-
test_windows:
28-
runs-on: windows-2019
31+
- name: Run tests
32+
uses: tree-sitter/parser-test-action@v3
33+
with:
34+
generate: false
35+
36+
query:
37+
name: Validate queries
38+
runs-on: ubuntu-latest
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
parser: [csv, psv, tsv]
2943
steps:
30-
- uses: actions/checkout@v3
31-
- uses: actions/setup-node@v2
44+
- name: Set up repository
45+
uses: actions/checkout@v5
46+
47+
- name: Set up tree-sitter
48+
uses: tree-sitter/setup-action@v2
3249
with:
33-
node-version: 18
34-
- run: |
35-
npm install
36-
npm run build
50+
install-lib: false
51+
52+
- name: Build parser
53+
run: tree-sitter build ${{matrix.parser}} -o ${{matrix.parser}}/${{matrix.parser}}.so
54+
55+
- name: Set up ts_query_ls
56+
run: curl -fL https://github.com/ribru17/ts_query_ls/releases/latest/download/ts_query_ls-x86_64-unknown-linux-gnu.tar.gz | tar -xz
57+
58+
- name: Check queries
59+
run: ./ts_query_ls check -f ${{matrix.parser}}/queries/

.github/workflows/lint.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ on:
66
- master
77
pull_request:
88
branches:
9-
- "**"
9+
- master
10+
workflow_dispatch:
1011

1112
jobs:
1213
lint:
1314
runs-on: ubuntu-latest
1415
steps:
15-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v5
1617
- name: Install modules
1718
run: npm install
1819
- name: Run ESLint

.github/workflows/release.yml

Lines changed: 13 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,21 @@
1-
name: Release
1+
name: Create release
22

33
on:
4-
workflow_run:
5-
workflows: ["CI"]
6-
types:
7-
- completed
4+
push:
5+
tags: ["*"]
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ${{github.workflow}}-${{github.ref}}
10+
cancel-in-progress: true
811

912
permissions:
1013
contents: write
11-
pull-requests: write
14+
id-token: write
15+
attestations: write
1216

1317
jobs:
1418
release:
15-
runs-on: ubuntu-latest
16-
if: ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/master' }}
17-
steps:
18-
- uses: google-github-actions/release-please-action@v3
19-
id: release
20-
with:
21-
release-type: node
22-
package-name: tree-sitter-csv
23-
24-
- uses: actions/checkout@v3
25-
with:
26-
token: ${{ secrets.GITHUB_TOKEN }}
27-
28-
- name: Update Rust version
29-
run: |
30-
git fetch origin release-please--branches--master--components--tree-sitter-csv
31-
git checkout release-please--branches--master--components--tree-sitter-csv
32-
33-
git config user.name github-actions[bot]
34-
git config user.email github-actions[bot]@users.noreply.github.com
35-
36-
repo_name="${{ github.repository }}"
37-
repo_name="${repo_name##*/}"
38-
version=$(grep -o '"version": *"[^"]*"' package.json | sed 's/"version": "\(.*\)"/\1/')
39-
40-
sed -i "s/version = \"[^\"]*\"/version = \"$version\"/g" Cargo.toml
41-
sed -i "s/$repo_name = \"[^\"]*\"/$repo_name = \"$version\"/g" bindings/rust/README.md
42-
43-
git add Cargo.toml bindings/rust/README.md
44-
git commit --amend --no-edit
45-
git push -f
46-
47-
- name: Setup Node
48-
if: ${{ steps.release.outputs.release_created }}
49-
uses: actions/setup-node@v3
50-
with:
51-
node-version: 18
52-
registry-url: "https://registry.npmjs.org"
53-
- name: Publish to NPM
54-
if: ${{ steps.release.outputs.release_created }}
55-
env:
56-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
57-
run: npm publish
58-
59-
- name: Setup Rust
60-
if: ${{ steps.release.outputs.release_created }}
61-
uses: actions-rs/toolchain@v1
62-
with:
63-
profile: minimal
64-
toolchain: stable
65-
override: true
66-
- name: Publish to Crates.io
67-
if: ${{ steps.release.outputs.release_created }}
68-
uses: katyo/publish-crates@v2
69-
with:
70-
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
71-
72-
- name: Tag stable versions
73-
if: ${{ steps.release.outputs.release_created }}
74-
run: |
75-
git checkout master
76-
git config user.name github-actions[bot]
77-
git config user.email github-actions[bot]@users.noreply.github.com
78-
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git"
79-
git tag -d stable || true
80-
git push origin :stable || true
81-
git tag -a stable -m "Last Stable Release"
82-
git push origin stable
19+
uses: tree-sitter/workflows/.github/workflows/release.yml@main
20+
with:
21+
attestations: true

.tsqueryrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/ribru17/ts_query_ls/refs/heads/master/schemas/config.json",
3+
"parser_install_directories": ["."],
4+
"language_retrieval_patterns": ["([^/]+)/queries/[^/]+\\.scm$"]
5+
}

0 commit comments

Comments
 (0)