Skip to content

Commit

Permalink
Remove npm dependency from CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Jan 25, 2024
1 parent 4c5c1f2 commit 2b85634
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 25 deletions.
19 changes: 3 additions & 16 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@just
- uses: actions/setup-node@v4
- uses: taiki-e/install-action@v2
with:
node-version: 18
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- uses: actions/cache@v3
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- run: |
npm --version
npx --version
- run: npm install --locked
tool: [email protected]
- uses: Swatinem/rust-cache@v2
- name: Configure
run: just --verbose configure-tree-sitter
- name: Check generated files
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/fuzz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: taiki-e/install-action@just
- uses: taiki-e/install-action@v2
with:
tool: tree-sitter-cli
- run: just fuzz
- name: print tests
if: always()
run: |
find . -name '*.a'
nm -g fuzzer-out/tree-sitter/libtree-sitter.a
find . -name 'timeout-*' |
xargs -IFNAME sh -c 'echo "\nPrinting FNAME" && base64 -i FNAME'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ build
log.html
*.wasm
fuzzer-out/
**.log
16 changes: 7 additions & 9 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ format:
gen *extra-args:
#!/bin/sh
set -eaux
npx tree-sitter generate {{ extra-args }}
tree-sitter generate {{ extra-args }}
python3 build-flavored-queries.py

alias t := test-ts

# Run tests that are built into tree-sitter
test-ts *ts-test-args: gen
npm test -- {{ ts-test-args }}
tree-sitter test {{ ts-test-args }}

# Verify that tree-sitter can parse and highlight all files in the repo. Requires a tree-sitter configuration.
test-parse-highlight:
Expand All @@ -41,9 +41,9 @@ test-parse-highlight:
printf '\n\n\n'
echo "::group::Parse and highlight testing for $fname"
echo "::notice:: checking parsing of $fname"
npx tree-sitter parse "$fname" > /dev/null
tree-sitter parse "$fname" > /dev/null
echo "::notice:: checking highlight of $fname"
npx tree-sitter highlight "$fname" > /dev/null
tree-sitter highlight "$fname" > /dev/null
echo "::endgroup::"
done

Expand Down Expand Up @@ -147,7 +147,7 @@ configure-tree-sitter:

cfg_fname = r"""{{ config_directory() / "tree-sitter" / "config.json" }}"""
if not os.path.isfile(cfg_fname):
sp.run(["npx", "tree-sitter", "init-config"], check=True, shell=shell)
sp.run(["tree-sitter", "init-config"], check=True, shell=shell)

with open(cfg_fname, "r+") as f:
j = json.load(f)
Expand All @@ -166,20 +166,18 @@ ci-codestyle:
deno fmt --check

# Make sure that files have not changed
ci-validate-generated-files:
ci-validate-generated-files: gen
#!/bin/sh
set -eaux

git tag ci-tmp-pre-updates

npm run gen

failed=false
git diff ci-tmp-pre-updates --exit-code || failed=true

if ! [ "$failed" = "false" ]; then
echo '::warning::Generated files are out of date!'
echo '::warning::run `npm run gen` and commit the changes'
echo '::warning::run `just gen` or `npm run gen` and commit the changes'
fi

git tag -d ci-tmp-pre-updates

0 comments on commit 2b85634

Please sign in to comment.