Skip to content

Run UI Lint, Type, and Formatting Checks in Pre-Commit and CI #7024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ jobs:
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
node-version: [14.x, 15.x]
services:
redis:
image: redis
Expand Down Expand Up @@ -33,12 +34,18 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies & set up configuration
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pycodestyle coverage
ln -s configuration.testing.py netbox/netbox/configuration.py
yarn --cwd netbox/project-static

- name: Build documentation
run: mkdocs build
Expand All @@ -47,7 +54,10 @@ jobs:
run: python netbox/manage.py collectstatic --no-input

- name: Check PEP8 compliance
run: pycodestyle --ignore=W504,E501 netbox/
run: pycodestyle --ignore=W504,E501 --exclude=node_modules netbox/

- name: Check UI ESLint, TypeScript, and Prettier Compliance
run: yarn --cwd netbox/project-static validate

- name: Run tests
run: coverage run --source="netbox/" netbox/manage.py test netbox/
Expand Down
6 changes: 6 additions & 0 deletions scripts/git-hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ if [ $? != 0 ]; then
EXIT=1
fi

echo "Checking UI ESLint, TypeScript, and Prettier compliance..."
yarn --cwd "$PWD/netbox/project-static" validate
if [ $? != 0 ]; then
EXIT=1
fi

if [ $EXIT != 0 ]; then
printf "${RED}COMMIT FAILED${NOCOLOR}\n"
fi
Expand Down