ci.yml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. name: CI
  2. on:
  3. push:
  4. paths-ignore:
  5. - 'contrib/**'
  6. - 'docs/**'
  7. pull_request:
  8. paths-ignore:
  9. - 'contrib/**'
  10. - 'docs/**'
  11. permissions:
  12. contents: read
  13. jobs:
  14. build:
  15. runs-on: ubuntu-latest
  16. env:
  17. NETBOX_CONFIGURATION: netbox.configuration_testing
  18. strategy:
  19. matrix:
  20. python-version: ['3.10', '3.11', '3.12']
  21. node-version: ['18.x']
  22. services:
  23. redis:
  24. image: redis
  25. ports:
  26. - 6379:6379
  27. postgres:
  28. image: postgres
  29. env:
  30. POSTGRES_USER: netbox
  31. POSTGRES_PASSWORD: netbox
  32. options: >-
  33. --health-cmd pg_isready
  34. --health-interval 10s
  35. --health-timeout 5s
  36. --health-retries 5
  37. ports:
  38. - 5432:5432
  39. steps:
  40. - name: Check out repo
  41. uses: actions/checkout@v4
  42. - name: Set up Python ${{ matrix.python-version }}
  43. uses: actions/setup-python@v5
  44. with:
  45. python-version: ${{ matrix.python-version }}
  46. - name: Use Node.js ${{ matrix.node-version }}
  47. uses: actions/setup-node@v4
  48. with:
  49. node-version: ${{ matrix.node-version }}
  50. - name: Install Yarn Package Manager
  51. run: npm install -g yarn
  52. - name: Setup Node.js with Yarn Caching
  53. uses: actions/setup-node@v4
  54. with:
  55. node-version: ${{ matrix.node-version }}
  56. cache: yarn
  57. cache-dependency-path: netbox/project-static/yarn.lock
  58. - name: Install Frontend Dependencies
  59. run: yarn --cwd netbox/project-static
  60. - name: Install dependencies & set up configuration
  61. run: |
  62. python -m pip install --upgrade pip
  63. pip install -r requirements.txt
  64. pip install pycodestyle coverage tblib
  65. - name: Build documentation
  66. run: mkdocs build
  67. - name: Collect static files
  68. run: python netbox/manage.py collectstatic --no-input
  69. - name: Check for missing migrations
  70. run: python netbox/manage.py makemigrations --check
  71. - name: Check PEP8 compliance
  72. run: pycodestyle --ignore=W504,E501 --exclude=node_modules netbox/
  73. - name: Check UI ESLint, TypeScript, and Prettier Compliance
  74. run: yarn --cwd netbox/project-static validate
  75. - name: Validate Static Asset Integrity
  76. run: scripts/verify-bundles.sh
  77. - name: Run tests
  78. run: coverage run --source="netbox/" netbox/manage.py test netbox/ --parallel
  79. - name: Show coverage report
  80. run: coverage report --skip-covered --omit '*/migrations/*,*/tests/*'