-
Notifications
You must be signed in to change notification settings - Fork 9
112 lines (111 loc) · 4.05 KB
/
ci.yaml
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: ci
on:
workflow_dispatch:
pull_request:
pull_request_target:
types: [labeled]
jobs:
builder:
if: ${{ !( ( github.event_name == 'pull_request' ) && ( github.event.pull_request.head.repo.fork == true ) ) }}
uses: ./.github/workflows/build_image.yaml
secrets: inherit
with:
file: ./docker/builder.Dockerfile
platforms: linux/amd64
targets: >-
["builder"]
build-snmpd:
if: ${{ !( ( github.event_name == 'pull_request' ) && ( github.event.pull_request.head.repo.fork == true ) ) }}
uses: ./.github/workflows/build_image.yaml
secrets: inherit
with:
file: ./docker/snmpd.Dockerfile
platforms: linux/amd64
targets: >-
["snmpd"]
build-agents:
if: ${{ !( ( github.event_name == 'pull_request' ) && ( github.event.pull_request.head.repo.fork == true ) ) }}
needs: builder
uses: ./.github/workflows/build_image.yaml
secrets: inherit
# using matrix here is not supported yet
# https://github.community/t/reusable-workflow-with-strategy-matrix/205676/8
with:
file: ./docker/agent.Dockerfile
platforms: linux/amd64
build-args: GS_MGMT_BUILDER_IMAGE=${{ needs.builder.outputs.tags }}
targets: >-
["north-cli", "north-snmp", "north-netconf", "north-notif", "north-gnmi", "south-sonic", "south-ocnos", "south-tai", "south-onlp", "south-system", "south-gearbox", "south-dpll", "south-netlink", "xlate-oc", "xlate-or", "system-telemetry"]
tester:
if: ${{ !( ( github.event_name == 'pull_request' ) && ( github.event.pull_request.head.repo.fork == true ) ) }}
uses: ./.github/workflows/build_image.yaml
secrets: inherit
with:
file: ./docker/builder.Dockerfile
platforms: linux/amd64
targets: >-
["tester"]
unittest:
if: ${{ !( ( github.event_name == 'pull_request' ) && ( github.event.pull_request.head.repo.fork == true ) ) }}
needs: tester
runs-on: ubuntu-latest
steps:
-
name: Checkout - same repo
uses: actions/checkout@v3
if: github.event.pull_request.head.repo.fork == false
with:
submodules: recursive
fetch-depth: 0
-
name: Checkout - forked repo
uses: actions/checkout@v3
if: >-
( github.event_name == 'pull_request_target' ) &&
( github.event.pull_request.head.repo.fork == true )
with:
submodules: recursive
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
-
name: Lint
run: "docker run -t -v `pwd`:`pwd` -w `pwd` ${{ needs.tester.outputs.tags }} make lint"
-
name: Unittest
run: "docker run -t -v `pwd`:`pwd` -w `pwd` ${{ needs.tester.outputs.tags }} make unittest"
rust-tester:
if: ${{ !( ( github.event_name == 'pull_request' ) && ( github.event.pull_request.head.repo.fork == true ) ) }}
uses: ./.github/workflows/build_image.yaml
secrets: inherit
with:
file: ./docker/builder.Dockerfile
platforms: linux/amd64
targets: >-
["rust-tester"]
rust-unittest:
if: ${{ !( ( github.event_name == 'pull_request' ) && ( github.event.pull_request.head.repo.fork == true ) ) }}
needs: rust-tester
runs-on: ubuntu-latest
steps:
-
name: Checkout - same repo
uses: actions/checkout@v3
if: github.event.pull_request.head.repo.fork == false
with:
submodules: recursive
fetch-depth: 0
-
name: Checkout - forked repo
uses: actions/checkout@v3
if: >-
( github.event_name == 'pull_request_target' ) &&
( github.event.pull_request.head.repo.fork == true )
with:
submodules: recursive
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
-
name: Unittest
run: "docker run -t -v `pwd`:`pwd` -w `pwd` ${{ needs.rust-tester.outputs.tags }} make rust-unittest"