From 1d0c72f5fada27b90a134aab64763610c3b8d7af Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 24 Aug 2021 00:41:10 -0700 Subject: [PATCH] Add UI checks to pre-commit and CI --- .github/workflows/ci.yml | 10 ++++++++++ scripts/git-hooks/pre-commit | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8e62642e..6e94933ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -49,6 +56,9 @@ jobs: - name: Check PEP8 compliance run: pycodestyle --ignore=W504,E501 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/ diff --git a/scripts/git-hooks/pre-commit b/scripts/git-hooks/pre-commit index f710326af..71b8cca6e 100755 --- a/scripts/git-hooks/pre-commit +++ b/scripts/git-hooks/pre-commit @@ -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