ci.yml 2.5 KB

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