ci.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. # Add concurrency group to control job running
  16. concurrency:
  17. group: ${{ github.event_name }}-${{ github.ref }}-${{ github.actor }}
  18. cancel-in-progress: true
  19. jobs:
  20. build:
  21. runs-on: ubuntu-latest
  22. env:
  23. NETBOX_CONFIGURATION: netbox.configuration_testing
  24. strategy:
  25. matrix:
  26. python-version: ['3.10', '3.11', '3.12']
  27. node-version: ['20.x']
  28. services:
  29. redis:
  30. image: redis
  31. ports:
  32. - 6379:6379
  33. postgres:
  34. image: postgres
  35. env:
  36. POSTGRES_USER: netbox
  37. POSTGRES_PASSWORD: netbox
  38. options: >-
  39. --health-cmd pg_isready
  40. --health-interval 10s
  41. --health-timeout 5s
  42. --health-retries 5
  43. ports:
  44. - 5432:5432
  45. steps:
  46. - name: Check out repo
  47. uses: actions/checkout@v4
  48. - name: Set up Python ${{ matrix.python-version }}
  49. uses: actions/setup-python@v5
  50. with:
  51. python-version: ${{ matrix.python-version }}
  52. - name: Use Node.js ${{ matrix.node-version }}
  53. uses: actions/setup-node@v4
  54. with:
  55. node-version: ${{ matrix.node-version }}
  56. - name: Install Yarn Package Manager
  57. run: npm install -g yarn
  58. - name: Setup Node.js with Yarn Caching
  59. uses: actions/setup-node@v4
  60. with:
  61. node-version: ${{ matrix.node-version }}
  62. cache: yarn
  63. cache-dependency-path: netbox/project-static/yarn.lock
  64. - name: Install Frontend Dependencies
  65. run: yarn --cwd netbox/project-static
  66. - name: Install dependencies & set up configuration
  67. run: |
  68. python -m pip install --upgrade pip
  69. pip install -r requirements.txt
  70. pip install ruff coverage tblib
  71. - name: Build documentation
  72. run: mkdocs build
  73. - name: Collect static files
  74. run: python netbox/manage.py collectstatic --no-input
  75. - name: Check for missing migrations
  76. run: python netbox/manage.py makemigrations --check
  77. - name: Check PEP8 compliance
  78. run: ruff check netbox/
  79. - name: Check UI ESLint, TypeScript, and Prettier Compliance
  80. run: yarn --cwd netbox/project-static validate
  81. - name: Validate Static Asset Integrity
  82. run: scripts/verify-bundles.sh
  83. - name: Run tests
  84. run: coverage run --source="netbox/" netbox/manage.py test netbox/ --parallel
  85. - name: Show coverage report
  86. run: coverage report --skip-covered --omit '*/migrations/*,*/tests/*'