Skip to content

Commit

Permalink
chore: updates workflows (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbprod committed Apr 18, 2023
1 parent 04dcb2c commit adf879c
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 93 deletions.
69 changes: 33 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,40 @@
name: CI

on:
pull_request:
branches:
- '**'
push:
branches:
- 'main'
pull_request:
branches:
- '**'
push:
branches:
- 'main'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Run validation tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install dependencies
run: npm install

- name: Run tree-sitter tests
run: npm test

- name: Ensure generated parser files are up-to-date
# On Windows, tree-sitter generate results in a diff, not sure why
if: runner.os != 'Windows'
run: |
git status
test -z "$(git status --porcelain)"
test:
name: Run validation tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Run tree-sitter tests
run: npm test
- name: Ensure generated parser files are up-to-date
# On Windows, tree-sitter generate results in a diff, not sure why
if: runner.os != 'Windows'
run: |
git status
test -z "$(git status --porcelain)"
21 changes: 0 additions & 21 deletions .github/workflows/crates.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/npm.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Publish
on:
release:
types: [released]
workflow_dispatch:

jobs:
bump:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Update npm version
run: npm version ${GITHUB_REF_NAME#v} --no-git-tag-version
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install cargo bump
run: cargo install cargo-bump
- name: Update cargo version
run: cargo bump ${GITHUB_REF_NAME#v}
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'chore: bump version'
branch: main

publish_npm:
runs-on: ubuntu-latest
needs: bump
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: main
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies and build 🔧
run: npm ci && npm run build
- name: Publish package on NPM 📦
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_GBPROD_GITCOMMIT }}

publish_crates:
runs-on: ubuntu-latest
needs: bump
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: main
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: cargo publish --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_GBPROD_GITCOMMIT }}
14 changes: 7 additions & 7 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"jsxBracketSameLine": true,
"printWidth": 120,
"arrowParens": "always",
"tabWidth": 2
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"jsxBracketSameLine": true,
"printWidth": 80,
"arrowParens": "always",
"tabWidth": 2
}
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tree-sitter-gitcommit"
description = "gitcommit grammar for the tree-sitter parsing library"
version = "0.0.1"
version = "0.3.0"
keywords = ["incremental", "parsing", "gitcommit"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/tree-sitter/tree-sitter-gitcommit"
Expand All @@ -20,7 +20,7 @@ include = [
path = "bindings/rust/lib.rs"

[dependencies]
tree-sitter = "~0.20.3"
tree-sitter = ">= 0.19"

[build-dependencies]
cc = "1.0"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The currently supported locales are listed below:

## Note about injected languages

This parser _only_ parse git commit subject, message and generated comments, it doesn't handle diff and git rebase informations that could be included.
This parser _only_ parses git commit subject, message and generated comments, it doesn't handle diff and git rebase information that could be included.
To handle that, you must have `diff` and `git_rebase` tree-sitter grammars installed and add injection queries.

If you're using Neovim and [`nvim-treesitter`](https://github.com/nvim-treesitter/nvim-treesitter), you just have to be sure that `diff` and `git_rebase` are installed (using `TSInstall diff git_rebase` for example).
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tree-sitter-gitcommit",
"version": "1.0.0",
"version": "0.3.0",
"description": "A tree-sitter grammar for git commit messages",
"main": "bindings/node",
"scripts": {
Expand Down

0 comments on commit adf879c

Please sign in to comment.