ci.yml 2.2 KB

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