Skip to content

Commit

Permalink
Chore: Update CI, scripts and README on wasm
Browse files Browse the repository at this point in the history
We no longer track and update the wasm files in our project, related terms on wasm should be updated.
  • Loading branch information
WilsonZiweiWang committed Aug 1, 2024
1 parent f487f7e commit 0529934
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Inspired by bash-language-server under MIT license
# Reference: https://github.com/bash-lsp/bash-language-server/blob/8c42218c77a9451b308839f9a754abde901323d5/.github/workflows/upgrade-tree-sitter.yml

name: Update Tree Sitter WASM File
name: Update Tree Sitter Parser Info File

on:
workflow_dispatch:
schedule:
- cron: '0 12 * * 2'

jobs:
update-tree-sitter-wasm:
update-tree-sitter-parser-info-file:

runs-on: ubuntu-latest

Expand Down Expand Up @@ -45,15 +45,13 @@ jobs:
- name: Install Dependencies
run: npm install

- name: Update tree-sitter wasm
run: bash scripts/update-${{ matrix.tree-sitter-name }}-wasm.sh
- name: Update tree-sitter parser info file
run: bash scripts/update-${{ matrix.tree-sitter-name }}.sh

- name: Verify file changes
uses: tj-actions/verify-changed-files@v20
id: verify-changed-files
with:
# The script generates a new wasm file and replaces the existing one. Git will treat it as a different file even it is generated with the same commit and CLI
# Hence, we only compare the .info file. It should be enough to tell the difference
files: |
server/${{ matrix.tree-sitter-name }}.info
Expand All @@ -63,9 +61,8 @@ jobs:
with:
add-paths: |
server/${{ matrix.tree-sitter-name }}.info
server/${{ matrix.tree-sitter-name }}.wasm
title: Auto update ${{ matrix.tree-sitter-name }} wasm file
commit-message: Auto update ${{ matrix.tree-sitter-name }} wasm file and parser info
branch: update-${{ matrix.tree-sitter-name }}-wasm-file
title: Auto update ${{ matrix.tree-sitter-name }} parser info file
commit-message: Auto update ${{ matrix.tree-sitter-name }} parser info
branch: update-${{ matrix.tree-sitter-name }}-parser-info-file
base: ${{ env.BASE_BRANCH }}
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion README-DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ See [the individual integration tests README](integration-tests/README.md).
## Tree-sitter
This extension uses [tree-sitter-bitbake](https://github.com/tree-sitter-grammars/tree-sitter-bitbake) and [tree-sitter-bash](https://github.com/tree-sitter/tree-sitter-bash) to parse the BitBake documents. They are installed with `npm run fetch:wasm`. The versions of tree-sitter-bitbake and tree-sitter-bash are documented in [server/tree-sitter-bitbake.info](server/tree-sitter-bitbake.info) and [server/tree-sitter-bash.info](server/tree-sitter-bash.info) respectively, along with the versions of the tree-sitter-cli that have to be used.

To update the .info files with the latest versions of tree-sitter-bitbake and tree-sitter-bash, it is recommended to use the scripts [scripts/update-tree-sitter-bitbake-wasm.sh](scripts/update-tree-sitter-bitbake-wasm.sh) and [scripts/update-tree-sitter-bash-wasm.sh](scripts/update-tree-sitter-bash-wasm.sh). The GitHub workflow [update-tree-sitter-wasm-file.yml](.github/workflows/update-tree-sitter-wasm-file.yml) is already responsible for doing it automatically.
To update the .info files with the latest versions of tree-sitter-bitbake and tree-sitter-bash, it is recommended to use the scripts [scripts/update-tree-sitter-bitbake.sh](scripts/update-tree-sitter-bitbake.sh) and [scripts/update-tree-sitter-bash.sh](scripts/update-tree-sitter-bash.sh). The GitHub workflow [update-tree-sitter-parser-info-file.yml](.github/workflows/update-tree-sitter-parser-info-file.yml) is already responsible for doing it automatically.

After updating the .info files, it is required to call `npm run fetch:wasm` in order to rebuild the Wasm files.

Expand Down
9 changes: 0 additions & 9 deletions scripts/update-tree-sitter-bash-wasm.sh

This file was deleted.

9 changes: 9 additions & 0 deletions scripts/update-tree-sitter-bash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -e

. "$(dirname "$0")/update-tree-sitter.sh"

repo_name=tree-sitter-bash
repo_owner=tree-sitter

update-tree-sitter $repo_name $repo_owner
9 changes: 0 additions & 9 deletions scripts/update-tree-sitter-bitbake-wasm.sh

This file was deleted.

9 changes: 9 additions & 0 deletions scripts/update-tree-sitter-bitbake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -e

. "$(dirname "$0")/update-tree-sitter.sh"

repo_name=tree-sitter-bitbake
repo_owner=tree-sitter-grammars

update-tree-sitter $repo_name $repo_owner
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

set -euox pipefail

update-tree-sitter-wasm() {
update-tree-sitter() {
local repo_name=$1
local repo_owner=$2
local info_file="$repo_name.info"
Expand Down

0 comments on commit 0529934

Please sign in to comment.