mirror of
https://github.com/netbox-community/netbox.git
synced 2026-05-06 14:04:12 +08:00
Add explicit CI job names showing the Python and Node versions, with the coverage job clearly marked in the GitHub Actions UI. Run coverage only for the designated coverage matrix entry to avoid redundant coverage collection and reporting across the full test matrix. Also add the YAML document marker and clean up trailing whitespace.
134 lines
3.7 KiB
YAML
134 lines
3.7 KiB
YAML
---
|
|
name: CI
|
|
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- '.github/ISSUE_TEMPLATE/**'
|
|
- '.github/PULL_REQUEST_TEMPLATE.md'
|
|
- 'contrib/**'
|
|
- 'docs/**'
|
|
- 'netbox/translations/**'
|
|
pull_request:
|
|
paths-ignore:
|
|
- '.github/ISSUE_TEMPLATE/**'
|
|
- '.github/PULL_REQUEST_TEMPLATE.md'
|
|
- 'contrib/**'
|
|
- 'docs/**'
|
|
- 'netbox/translations/**'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
# Add concurrency group to control job running
|
|
concurrency:
|
|
group: ${{ github.event_name }}-${{ github.ref }}-${{ github.actor }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
name: >-
|
|
Tests (Python ${{ matrix.python-version }},
|
|
Node ${{ matrix.node-version }}${{ matrix.coverage && ', coverage' || '' }})
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
NETBOX_CONFIGURATION: netbox.configuration_testing
|
|
strategy:
|
|
matrix:
|
|
python-version: ['3.12', '3.13', '3.14']
|
|
node-version: ['20.x']
|
|
include:
|
|
- coverage: false
|
|
# Run coverage only once, using the Python 3.14 job.
|
|
- python-version: '3.14'
|
|
node-version: '20.x'
|
|
coverage: true
|
|
services:
|
|
redis:
|
|
image: redis
|
|
ports:
|
|
- 6379:6379
|
|
postgres:
|
|
image: postgres
|
|
env:
|
|
POSTGRES_USER: netbox
|
|
POSTGRES_PASSWORD: netbox
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
ports:
|
|
- 5432:5432
|
|
|
|
steps:
|
|
- name: Check out repo
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Check Python linting & PEP8 compliance
|
|
uses: astral-sh/ruff-action@0ce1b0bf8b818ef400413f810f8a11cdbda0034b # v4.0.0
|
|
with:
|
|
version: "0.15.10"
|
|
args: "check --output-format=github"
|
|
src: "netbox/"
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
- name: Install Yarn Package Manager
|
|
run: npm install -g yarn
|
|
|
|
- name: Setup Node.js with Yarn Caching
|
|
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: yarn
|
|
cache-dependency-path: netbox/project-static/yarn.lock
|
|
|
|
- name: Install Frontend Dependencies
|
|
run: yarn --cwd netbox/project-static
|
|
|
|
- name: Install dependencies & set up configuration
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install coverage tblib
|
|
|
|
- name: Build documentation
|
|
run: zensical build
|
|
|
|
- name: Collect static files
|
|
run: python netbox/manage.py collectstatic --no-input
|
|
|
|
- name: Check for missing migrations
|
|
run: python netbox/manage.py makemigrations --check
|
|
|
|
- name: Check UI ESLint, TypeScript, and Prettier Compliance
|
|
run: yarn --cwd netbox/project-static validate
|
|
|
|
- name: Validate Static Asset Integrity
|
|
run: scripts/verify-bundles.sh
|
|
|
|
- name: Run tests
|
|
if: ${{ ! matrix.coverage }}
|
|
run: python netbox/manage.py test netbox/ --parallel
|
|
|
|
- name: Run tests with coverage
|
|
if: ${{ matrix.coverage }}
|
|
run: >-
|
|
coverage run --source="netbox/"
|
|
netbox/manage.py test netbox/ --parallel
|
|
|
|
- name: Show coverage report
|
|
if: ${{ matrix.coverage }}
|
|
run: >-
|
|
coverage report --skip-covered
|
|
--omit '*/migrations/*,*/tests/*'
|