From 46c8303323d9ff487e634c50d327f62620382efd Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Mon, 1 Apr 2024 18:23:51 +0200 Subject: [PATCH 1/3] ci: switch to upstream workflows --- .github/workflows/ci.yml | 18 +++++---- .github/workflows/publish.yml | 15 +++++++ .github/workflows/update-wgsl-parser.yml | 50 +++++++++--------------- 3 files changed, 44 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5c7e6f..9ffc6a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,20 @@ name: CI + on: push: branches: [master] + paths: pull_request: - branches: [master] + jobs: build: + name: Run tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: tree-sitter/setup-action@v1 + with: + install-lib: false + - uses: tree-sitter/parser-test-action@v1.2 with: - node-version: '16' - - name: Install dependencies - run: npm ci - - name: Run tests - run: npm test + test-library: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ae6ba35 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,15 @@ +name: Publish package + +on: + push: + tags: ["*"] + +jobs: + npm: + uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main + secrets: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + crates: + uses: tree-sitter/workflows/.github/workflows/package-crates.yml@main + secrets: + CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_TOKEN}} diff --git a/.github/workflows/update-wgsl-parser.yml b/.github/workflows/update-wgsl-parser.yml index 4f19ae1..086efff 100644 --- a/.github/workflows/update-wgsl-parser.yml +++ b/.github/workflows/update-wgsl-parser.yml @@ -1,39 +1,27 @@ -name: Update Dependencies +name: Update + on: schedule: - - cron: '0 0 * * *' # every day at midnight + - cron: "0 0 * * 0" push: - branches: ["master"] + branches: [master] + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + jobs: - build: + test: + name: Update dependencies runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: '16' - - name: Update WGSL parser - run: npm update - - name: Install dependencies - run: npm ci - - name: Regenerate Source Files - run: node_modules/.bin/tree-sitter generate --abi 14 - - name: Generate parser - run: npm install - - name: Run tests - run: npm test - - - name: Commit changes - run: | - git config user.name "GitHub" - git config user.email "noreply@github.com" - git commit -am "Update dependencies and regenerate parser" || echo 'No commit necessary!' - git clean -xf - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + cache: npm + node-version: ${{vars.NODE_VERSION}} + - uses: tree-sitter/parser-update-action@v1.1 with: - commit-message: Update dependencies - title: Update dependencies - branch: update-dependencies-pr - base: ${{ github.head_ref }} + parent-name: wgsl + language-name: wgsl_bevy From 9d7bd99407bcddef9e917488b11c7165b292818a Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Mon, 1 Apr 2024 18:29:36 +0200 Subject: [PATCH 2/3] chore: add `target` to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9f98c61..dae4d7f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules +target build test/kajiya From fbb60f87eecfe7899cec44e519da2d56ea2b672e Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Mon, 1 Apr 2024 18:30:21 +0200 Subject: [PATCH 3/3] build: fix grammar name in bindings --- bindings/node/binding.cc | 2 +- bindings/node/index.js | 4 ++-- bindings/rust/lib.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bindings/node/binding.cc b/bindings/node/binding.cc index 1082348..7cab42c 100644 --- a/bindings/node/binding.cc +++ b/bindings/node/binding.cc @@ -19,7 +19,7 @@ void Init(Local exports, Local module) { Local instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked(); Nan::SetInternalFieldPointer(instance, 0, tree_sitter_glsl()); - Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("glsl").ToLocalChecked()); + Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("wgsl_bevy").ToLocalChecked()); Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance); } diff --git a/bindings/node/index.js b/bindings/node/index.js index c448613..4a02e5a 100644 --- a/bindings/node/index.js +++ b/bindings/node/index.js @@ -1,11 +1,11 @@ try { - module.exports = require("../../build/Release/tree_sitter_cuda_binding"); + module.exports = require("../../build/Release/tree_sitter_wgsl_bevy_binding"); } catch (error1) { if (error1.code !== 'MODULE_NOT_FOUND') { throw error1; } try { - module.exports = require("../../build/Debug/tree_sitter_cuda_binding"); + module.exports = require("../../build/Debug/tree_sitter_wgsl_bevy_binding"); } catch (error2) { if (error2.code !== 'MODULE_NOT_FOUND') { throw error2; diff --git a/bindings/rust/lib.rs b/bindings/rust/lib.rs index 4b7d95c..d712329 100644 --- a/bindings/rust/lib.rs +++ b/bindings/rust/lib.rs @@ -1,4 +1,4 @@ -//! This crate provides hlsl language support for the [tree-sitter][] parsing library. +//! This crate provides wgsl_bevy language support for the [tree-sitter][] parsing library. //! //! Typically, you will use the [language][language func] function to add this language to a //! tree-sitter [Parser][], and then use the parser to parse some code: @@ -6,7 +6,7 @@ //! ``` //! let code = ""; //! let mut parser = tree_sitter::Parser::new(); -//! parser.set_language(tree_sitter_hlsl::language()).expect("Error loading hlsl grammar"); +//! parser.set_language(tree_sitter_wgsl_bevy::language()).expect("Error loading wgsl_bevy grammar"); //! let tree = parser.parse(code, None).unwrap(); //! ``` //!