2020-12-08 14:55:06 -05:00
|
|
|
name: CI
|
2020-12-16 13:23:45 -05:00
|
|
|
on: [push, pull_request]
|
2020-12-08 14:55:06 -05:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
2022-02-15 12:36:03 -05:00
|
|
|
env:
|
|
|
|
NETBOX_CONFIGURATION: netbox.configuration_testing
|
2020-12-08 14:55:06 -05:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-12-09 15:39:50 -05:00
|
|
|
python-version: ['3.8', '3.9', '3.10']
|
|
|
|
node-version: ['14.x']
|
2020-12-08 14:55:06 -05:00
|
|
|
services:
|
|
|
|
redis:
|
|
|
|
image: redis
|
|
|
|
ports:
|
|
|
|
- 6379:6379
|
|
|
|
postgres:
|
|
|
|
image: postgres
|
|
|
|
env:
|
|
|
|
POSTGRES_USER: netbox
|
|
|
|
POSTGRES_PASSWORD: netbox
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
ports:
|
|
|
|
- 5432:5432
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Check out repo
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
|
2021-08-24 00:41:10 -07:00
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
2022-02-08 13:44:20 -07:00
|
|
|
|
|
|
|
- name: Install Yarn Package Manager
|
|
|
|
run: npm install -g yarn
|
|
|
|
|
|
|
|
- name: Setup Node.js with Yarn Caching
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
cache: yarn
|
|
|
|
cache-dependency-path: netbox/project-static/yarn.lock
|
|
|
|
|
|
|
|
- name: Install Frontend Dependencies
|
|
|
|
run: yarn --cwd netbox/project-static
|
2021-08-24 00:41:10 -07:00
|
|
|
|
2020-12-08 14:55:06 -05:00
|
|
|
- name: Install dependencies & set up configuration
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install -r requirements.txt
|
2022-03-18 11:47:43 -04:00
|
|
|
pip install pycodestyle coverage tblib
|
2020-12-08 14:55:06 -05:00
|
|
|
|
2021-07-19 14:18:08 -04:00
|
|
|
- name: Build documentation
|
|
|
|
run: mkdocs build
|
|
|
|
|
2021-04-27 13:42:57 -04:00
|
|
|
- name: Collect static files
|
2021-04-27 13:47:29 -04:00
|
|
|
run: python netbox/manage.py collectstatic --no-input
|
2021-04-27 13:42:57 -04:00
|
|
|
|
2020-12-08 14:55:06 -05:00
|
|
|
- name: Check PEP8 compliance
|
2021-08-24 06:40:00 -07:00
|
|
|
run: pycodestyle --ignore=W504,E501 --exclude=node_modules netbox/
|
2020-12-08 14:55:06 -05:00
|
|
|
|
2021-08-24 00:41:10 -07:00
|
|
|
- name: Check UI ESLint, TypeScript, and Prettier Compliance
|
|
|
|
run: yarn --cwd netbox/project-static validate
|
2021-09-07 16:20:36 -07:00
|
|
|
|
|
|
|
- name: Validate Static Asset Integrity
|
|
|
|
run: scripts/verify-bundles.sh
|
2021-08-24 00:41:10 -07:00
|
|
|
|
2020-12-08 14:55:06 -05:00
|
|
|
- name: Run tests
|
2022-02-08 13:44:20 -07:00
|
|
|
run: coverage run --source="netbox/" netbox/manage.py test netbox/ --parallel
|
2020-12-08 14:55:06 -05:00
|
|
|
|
|
|
|
- name: Show coverage report
|
|
|
|
run: coverage report --skip-covered --omit *migrations*
|