-
Notifications
You must be signed in to change notification settings - Fork 34
179 lines (160 loc) · 5.93 KB
/
sc-client-server-deb11.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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: sc-client-server-deb11
on:
pull_request:
types: [ opened, synchronize, reopened ]
branches: [ "**" ]
paths:
- '.github/workflows/sc-client-server-deb11.yml'
- 'dockerfiles/bullseye/Dockerfile.client'
- 'dockerfiles/bullseye/Dockerfile.server'
- 'dockerfiles/bullseye/Dockerfile.saithrift-server'
- 'npu/broadcom/BCM56850/saivs/Dockerfile.server'
- 'common/**'
- 'cli/**'
- 'scripts/**'
- 'configs/**'
- 'tests/**'
- 'setup.py'
- 'build.sh'
- 'run.sh'
- 'exec.sh'
- '.dockerignore'
- 'sai.env'
env:
DOCKER_CLIENT: 'dockerfiles/bullseye/Dockerfile.client'
DOCKER_SERVER_BASE: 'dockerfiles/bullseye/Dockerfile.server'
DOCKER_SERVER: 'npu/broadcom/BCM56850/saivs/Dockerfile.server'
DOCKER_THRIFT_SERVER: 'dockerfiles/bullseye/Dockerfile.saithrift-server'
REDIS_CLIENT: 0
REDIS_SERVER: 0
THRIFT_SERVER: 0
jobs:
build-sc-server:
name: Build SAI Challenger server image
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Update submodules
run: git submodule update --init
- name: Check what files were updated
id: check_changes
run: |
echo 'changed_files<<EOF' >> $GITHUB_OUTPUT
echo "$(git diff --name-only HEAD~1)" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Check what Docker images have to be rebuild
run: |
for file in "$DOCKER_SERVER_BASE" "$DOCKER_SERVER" "sai.env"; do
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
echo "REDIS_SERVER=1" >> $GITHUB_ENV
fi
done
for file in "$DOCKER_THRIFT_SERVER" "sai.env"; do
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
echo "THRIFT_SERVER=1" >> $GITHUB_ENV
fi
done
- name: Build server Docker image
run: ./build.sh -i server -o deb11
if: ${{ env.REDIS_SERVER == '1' }}
- name: Pull SAI-C server
run: ./run.sh -i server -o deb11
if: ${{ env.REDIS_SERVER == '0' }}
- name: Save server Docker image
run: docker save sc-server-trident2-saivs > sc-server.tar
- name: Upload server image
uses: actions/upload-artifact@v3
with:
name: Server Image
path: sc-server.tar
- name: Build Thrift server Docker image
run: ./build.sh -i server -o deb11 -s thrift
if: ${{ env.THRIFT_SERVER == '1' }}
build-sc-client:
name: Build SAI Challenger client image
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Update submodules
run: git submodule update --init
- name: Check what files were updated
id: check_changes
run: |
echo 'changed_files<<EOF' >> $GITHUB_OUTPUT
echo "$(git diff --name-only HEAD~1)" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Check what Docker images have to be rebuild
run: |
for file in "$DOCKER_CLIENT" "sai.env"; do
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
echo "REDIS_CLIENT=1" >> $GITHUB_ENV
fi
done
- name: Build client Docker image
run: ./build.sh -i client -o deb11 --nosnappi
if: ${{ env.REDIS_CLIENT == '1' }}
- name: Pull SAI-C client
run: ./run.sh -i client -o deb11
if: ${{ env.REDIS_CLIENT == '0' }}
- name: Save client Docker image
run: docker save sc-client > sc-client.tar
- name: Upload client Docker image
uses: actions/upload-artifact@v3
with:
name: Client Image
path: sc-client.tar
run-sc-tests:
name: Run SAI Challenger tests in client-server mode
needs: [build-sc-client, build-sc-server]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Update submodules.
run: git submodule update --init
- name: Download client Docker image
uses: actions/download-artifact@v3
with:
name: Client Image
- name: Load client image
run: docker load < sc-client.tar
- name: Download server Docker image
uses: actions/download-artifact@v3
with:
name: Server Image
- name: Load server image
run: docker load < sc-server.tar
- name: Delete client image artifact
uses: geekyeggo/delete-artifact@v2
with:
name: Client Image
- name: Delete server image artifact
uses: geekyeggo/delete-artifact@v2
with:
name: Server Image
- name: Start SAI-C client
run: ./run.sh -i client -o deb11
- name: Wait for the client to get the IP address first
run: sleep 5s
- name: Start SAI-C server
run: ./run.sh -i server -o deb11
- name: Update SAI-C server package
run: ./exec.sh -i server --no-tty pip3 install /sai-challenger/common /sai-challenger
if: ${{ env.REDIS_SERVER == '0' }}
- name: Update SAI-C client package
run: ./exec.sh -i client --no-tty pip3 install /sai-challenger/common /sai-challenger
if: ${{ env.REDIS_CLIENT == '0' }}
- name: Create veth links between client and server dockers
run: sudo ./veth-create-host.sh sc-server-trident2-saivs-run sc-client-run
- name: Run functional test cases
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v -k "test_l2_basic"
- name: Run unit tests
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v ut/test_acl_ut.py ut/test_bridge_ut.py ut/test_vrf_ut.py ut/test_port_ut.py ut/test_fdb_ut.py ut/test_lag_ut.py
- name: Run unit tests
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v -k \
"test_switch_ut and not sai_map_list_t"
- name: Run thift data-driven tests
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v test_l2_basic_dd.py