--- name: Docker Image CI on: push: branches: - master pull_request: types: [opened, synchronize, reopened] permissions: {} jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: fetch-depth: 0 persist-credentials: false - name: Build the Docker image run: docker compose build --no-cache - name: Verify the Docker image # smoke test by checking if the migrations for app netbox_slm can be displayed run: docker compose run netbox sh -c "/opt/netbox/venv/bin/python manage.py showmigrations netbox_slm" - name: Run Django tests with coverage for netbox_slm run: | chmod go+w ci/reports docker compose run netbox sh -c "\ /opt/netbox/venv/bin/coverage run --source='netbox_slm' manage.py test netbox_slm &&\ /opt/netbox/venv/bin/coverage report --fail-under=0 &&\ /opt/netbox/venv/bin/coverage xml -o /ci/reports/coverage.xml" sed -i "s/\/opt\/netbox\/netbox<\/source>/<\/source>/" ci/reports/coverage.xml timeout-minutes: 6 - name: Sonar scan if: env.SONAR_TOKEN != null uses: SonarSource/sonarqube-scan-action@713881670b6b3676cda39549040e2d88c70d582e # v8.2.0 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}