Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ci: switch to upstream workflows #5

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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}}
50 changes: 19 additions & 31 deletions .github/workflows/update-wgsl-parser.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
target
build
test/kajiya
2 changes: 1 addition & 1 deletion bindings/node/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void Init(Local<Object> exports, Local<Object> module) {
Local<Object> 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);
}

Expand Down
4 changes: 2 additions & 2 deletions bindings/node/index.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions bindings/rust/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! 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:
//!
//! ```
//! 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();
//! ```
//!
Expand Down