Skip to content

Commit

Permalink
Convert generated code checks to errors on Ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Feb 22, 2024
1 parent 6e4fa76 commit 384a1a6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:

jobs:
codestyle:
name: Codestyle (format and lint)
name: codestyle & generated files
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
Expand All @@ -29,11 +29,11 @@ jobs:
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: just setup
- run: just --verbose ci-codestyle
- name: Verify generated files are up to date (error)
run: just --verbose ci-validate-generated-files
- name: Check codestyle
run: just --verbose ci-codestyle

test:
runs-on: ${{ matrix.os }}
Expand All @@ -58,16 +58,13 @@ jobs:
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
- run: just setup --locked
- name: Configure
run: just --verbose configure-tree-sitter
- name: Check generated files
run: just --verbose ci-validate-generated-files
- name: Run tests
run: just --verbose test
- name: Check if generated files are up to date (warn only)
run: just --verbose ci-validate-generated-files 0

static-validation:
runs-on: ubuntu-latest
Expand Down
10 changes: 5 additions & 5 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ default:
just --list

# Install needed packages and make sure tools are setup
setup:
setup *npm-args:
#!/bin/bash
set -eau

Expand All @@ -54,7 +54,7 @@ setup:
check_installed clang-format

if which npm > /dev/null; then
npm install --include=dev
npm install --include=dev {{ npm-args }}
else
echo "npm not found: skipping install"
fi
Expand Down Expand Up @@ -229,7 +229,7 @@ configure-tree-sitter:
ci-codestyle: lint format-check

# Make sure that files have not changed
ci-validate-generated-files:
ci-validate-generated-files exit-code="1":
#!/bin/sh
set -eaux

Expand All @@ -239,14 +239,14 @@ ci-validate-generated-files:

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

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

git tag -d ci-tmp-pre-updates

# Run a subset of CI checks before committing.
pre-commit: _lint-min format-check

Expand Down
2 changes: 1 addition & 1 deletion queries/just/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

; Comments

(comment) @comment
(comment) @spell @comment

(shebang) @comment

Expand Down

0 comments on commit 384a1a6

Please sign in to comment.