ci.yml 2.8 KB

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