-
-
Notifications
You must be signed in to change notification settings - Fork 7
82 lines (72 loc) · 2.3 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: CI
on:
push:
branches: ["**"]
tags-ignore: ["**"]
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install dependecies
run: pip install -r requirements/dev.txt
- name: Run black
run: black --check --diff --color validity/
- name: Run isort
run: isort --check --diff --color validity/
- name: Run flake8
run: flake8 validity/
test:
runs-on: ubuntu-latest
strategy:
matrix:
netbox_version: [v3.5.9, v3.6.9, v3.7.1]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build NetBox
uses: ./.github/build_netbox
with:
netbox_version: ${{ matrix.netbox_version }}
- name: Run Tests
id: run_tests
run: >-
set -o pipefail
&& cd development
&& docker compose run netbox sh -c "cd /plugin/validity && pytest --cov"
| tee /dev/stderr | grep -oP '(?<=Total coverage:\s)[0-9.]+'
| awk '{print "cov="$1}' > $GITHUB_OUTPUT
- name: Create Coverage Badge
if: github.ref == 'refs/heads/master'
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_TOKEN }}
gistID: 9e518ae8babd18b7edd8ee5aad58146b
filename: cov.json
label: Coverage
message: ${{ fromJSON(steps.run_tests.outputs.cov) }}%
valColorRange: ${{ fromJSON(steps.run_tests.outputs.cov) }}
maxColorRange: 90
minColorRange: 50
test_migrations:
runs-on: ubuntu-latest
strategy:
matrix:
netbox_version: [v3.5.9, v3.6.9, v3.7.1]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build NetBox
uses: ./.github/build_netbox
with:
netbox_version: ${{ matrix.netbox_version }}
- name: Check missed migrations
run: cd development && docker compose run netbox sh -c "./manage.py makemigrations --check --dry-run"
- name: Check migrations run
run: cd development && docker compose run netbox sh -c "./manage.py migrate"