ci.yml 2.3 KB

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