ci.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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.12', '3.13', '3.14']
  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: Check Python linting & PEP8 compliance
  53. uses: astral-sh/ruff-action@4919ec5cf1f49eff0871dbcea0da843445b837e6 # v3.6.1
  54. with:
  55. version: "0.15.2"
  56. args: "check --output-format=github"
  57. src: "netbox/"
  58. - name: Set up Python ${{ matrix.python-version }}
  59. uses: actions/setup-python@v5
  60. with:
  61. python-version: ${{ matrix.python-version }}
  62. - name: Use Node.js ${{ matrix.node-version }}
  63. uses: actions/setup-node@v4
  64. with:
  65. node-version: ${{ matrix.node-version }}
  66. - name: Install Yarn Package Manager
  67. run: npm install -g yarn
  68. - name: Setup Node.js with Yarn Caching
  69. uses: actions/setup-node@v4
  70. with:
  71. node-version: ${{ matrix.node-version }}
  72. cache: yarn
  73. cache-dependency-path: netbox/project-static/yarn.lock
  74. - name: Install Frontend Dependencies
  75. run: yarn --cwd netbox/project-static
  76. - name: Install dependencies & set up configuration
  77. run: |
  78. python -m pip install --upgrade pip
  79. pip install -r requirements.txt
  80. pip install coverage tblib
  81. - name: Build documentation
  82. run: mkdocs build
  83. - name: Collect static files
  84. run: python netbox/manage.py collectstatic --no-input
  85. - name: Check for missing migrations
  86. run: python netbox/manage.py makemigrations --check
  87. - name: Check UI ESLint, TypeScript, and Prettier Compliance
  88. run: yarn --cwd netbox/project-static validate
  89. - name: Validate Static Asset Integrity
  90. run: scripts/verify-bundles.sh
  91. - name: Run tests
  92. run: coverage run --source="netbox/" netbox/manage.py test netbox/ --parallel
  93. - name: Show coverage report
  94. run: coverage report --skip-covered --omit '*/migrations/*,*/tests/*'