Skip to content

Commit b63c838

Browse files
Merge pull request #7024 from netbox-community/feature-precommit-ui
Run UI Lint, Type, and Formatting Checks in Pre-Commit and CI
2 parents 1c6fdea + 9d0e6f0 commit b63c838

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ jobs:
66
strategy:
77
matrix:
88
python-version: [3.7, 3.8, 3.9]
9+
node-version: [14.x, 15.x]
910
services:
1011
redis:
1112
image: redis
@@ -33,12 +34,18 @@ jobs:
3334
with:
3435
python-version: ${{ matrix.python-version }}
3536

37+
- name: Use Node.js ${{ matrix.node-version }}
38+
uses: actions/setup-node@v2
39+
with:
40+
node-version: ${{ matrix.node-version }}
41+
3642
- name: Install dependencies & set up configuration
3743
run: |
3844
python -m pip install --upgrade pip
3945
pip install -r requirements.txt
4046
pip install pycodestyle coverage
4147
ln -s configuration.testing.py netbox/netbox/configuration.py
48+
yarn --cwd netbox/project-static
4249
4350
- name: Build documentation
4451
run: mkdocs build
@@ -47,7 +54,10 @@ jobs:
4754
run: python netbox/manage.py collectstatic --no-input
4855

4956
- name: Check PEP8 compliance
50-
run: pycodestyle --ignore=W504,E501 netbox/
57+
run: pycodestyle --ignore=W504,E501 --exclude=node_modules netbox/
58+
59+
- name: Check UI ESLint, TypeScript, and Prettier Compliance
60+
run: yarn --cwd netbox/project-static validate
5161

5262
- name: Run tests
5363
run: coverage run --source="netbox/" netbox/manage.py test netbox/

scripts/git-hooks/pre-commit

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ if [ $? != 0 ]; then
3434
EXIT=1
3535
fi
3636

37+
echo "Checking UI ESLint, TypeScript, and Prettier compliance..."
38+
yarn --cwd "$PWD/netbox/project-static" validate
39+
if [ $? != 0 ]; then
40+
EXIT=1
41+
fi
42+
3743
if [ $EXIT != 0 ]; then
3844
printf "${RED}COMMIT FAILED${NOCOLOR}\n"
3945
fi

0 commit comments

Comments
 (0)