Skip to content

Commit bed9429

Browse files
committed
Added Deb12 test workflows
Signed-off-by: Andriy Kokhan <andriy.kokhan@plvision.eu>
1 parent c9deec3 commit bed9429

File tree

2 files changed

+289
-0
lines changed

2 files changed

+289
-0
lines changed
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
name: sc-client-server-deb12
2+
3+
on:
4+
pull_request:
5+
types: [ opened, synchronize, reopened ]
6+
branches: [ "**" ]
7+
paths:
8+
- '.github/workflows/sc-client-server-deb12.yml'
9+
- 'dockerfiles/bookworm/Dockerfile.client'
10+
- 'dockerfiles/bookworm/Dockerfile.server'
11+
- 'dockerfiles/bookworm/Dockerfile.saithrift-server'
12+
- 'npu/broadcom/BCM56850/saivs/Dockerfile.server'
13+
- 'common/**'
14+
- 'cli/**'
15+
- 'scripts/**'
16+
- 'configs/**'
17+
- 'tests/**'
18+
- 'setup.py'
19+
- 'build.sh'
20+
- 'run.sh'
21+
- 'exec.sh'
22+
- '.dockerignore'
23+
- 'sai.env'
24+
25+
env:
26+
DOCKER_CLIENT: 'dockerfiles/bookworm/Dockerfile.client'
27+
DOCKER_SERVER_BASE: 'dockerfiles/bookworm/Dockerfile.server'
28+
DOCKER_SERVER: 'npu/broadcom/BCM56850/saivs/Dockerfile.server'
29+
DOCKER_THRIFT_SERVER: 'dockerfiles/bookworm/Dockerfile.saithrift-server'
30+
REDIS_CLIENT: 0
31+
REDIS_SERVER: 0
32+
THRIFT_SERVER: 0
33+
34+
jobs:
35+
build-sc-server:
36+
name: Build SAI Challenger server image
37+
runs-on: ubuntu-24.04
38+
steps:
39+
- uses: actions/checkout@v3
40+
with:
41+
fetch-depth: 2
42+
- name: Update submodules
43+
run: git submodule update --init
44+
45+
- name: Check what files were updated
46+
id: check_changes
47+
run: |
48+
echo 'changed_files<<EOF' >> $GITHUB_OUTPUT
49+
echo "$(git diff --name-only HEAD~1)" >> $GITHUB_OUTPUT
50+
echo 'EOF' >> $GITHUB_OUTPUT
51+
52+
- name: Check what Docker images have to be rebuild
53+
run: |
54+
for file in "$DOCKER_SERVER_BASE" "$DOCKER_SERVER" "sai.env"; do
55+
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
56+
echo "REDIS_SERVER=1" >> $GITHUB_ENV
57+
fi
58+
done
59+
for file in "$DOCKER_THRIFT_SERVER" "sai.env"; do
60+
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
61+
echo "THRIFT_SERVER=1" >> $GITHUB_ENV
62+
fi
63+
done
64+
65+
- name: Build server Docker image
66+
run: ./build.sh -i server -o deb12
67+
if: ${{ env.REDIS_SERVER == '1' }}
68+
69+
- name: Pull SAI-C server
70+
run: ./run.sh -i server -o deb12
71+
if: ${{ env.REDIS_SERVER == '0' }}
72+
73+
- name: Save server Docker image
74+
run: docker save sc-server-trident2-saivs > sc-server.tar
75+
- name: Upload server image
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: Server Image
79+
path: sc-server.tar
80+
81+
- name: Build Thrift server Docker image
82+
run: ./build.sh -i server -o deb12 -s thrift
83+
if: ${{ env.THRIFT_SERVER == '1' }}
84+
85+
build-sc-client:
86+
name: Build SAI Challenger client image
87+
runs-on: ubuntu-24.04
88+
steps:
89+
- uses: actions/checkout@v3
90+
with:
91+
fetch-depth: 2
92+
- name: Update submodules
93+
run: git submodule update --init
94+
95+
- name: Check what files were updated
96+
id: check_changes
97+
run: |
98+
echo 'changed_files<<EOF' >> $GITHUB_OUTPUT
99+
echo "$(git diff --name-only HEAD~1)" >> $GITHUB_OUTPUT
100+
echo 'EOF' >> $GITHUB_OUTPUT
101+
102+
- name: Check what Docker images have to be rebuild
103+
run: |
104+
for file in "$DOCKER_CLIENT" "sai.env"; do
105+
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
106+
echo "REDIS_CLIENT=1" >> $GITHUB_ENV
107+
fi
108+
done
109+
110+
- name: Build client Docker image
111+
run: ./build.sh -i client -o deb12 --nosnappi
112+
if: ${{ env.REDIS_CLIENT == '1' }}
113+
114+
- name: Pull SAI-C client
115+
run: ./run.sh -i client -o deb12
116+
if: ${{ env.REDIS_CLIENT == '0' }}
117+
118+
- name: Save client Docker image
119+
run: docker save sc-client > sc-client.tar
120+
- name: Upload client Docker image
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: Client Image
124+
path: sc-client.tar
125+
126+
run-sc-tests:
127+
name: Run SAI Challenger tests in client-server mode
128+
needs: [build-sc-client, build-sc-server]
129+
runs-on: ubuntu-24.04
130+
steps:
131+
- uses: actions/checkout@v3
132+
- name: Update submodules.
133+
run: git submodule update --init
134+
135+
- name: Download client Docker image
136+
uses: actions/download-artifact@v4
137+
with:
138+
name: Client Image
139+
- name: Load client image
140+
run: docker load < sc-client.tar
141+
- name: Download server Docker image
142+
uses: actions/download-artifact@v4
143+
with:
144+
name: Server Image
145+
- name: Load server image
146+
run: docker load < sc-server.tar
147+
- name: Delete client image artifact
148+
uses: geekyeggo/delete-artifact@v5
149+
with:
150+
name: Client Image
151+
- name: Delete server image artifact
152+
uses: geekyeggo/delete-artifact@v5
153+
with:
154+
name: Server Image
155+
156+
- name: Start SAI-C client
157+
run: ./run.sh -i client -o deb12
158+
- name: Wait for the client to get the IP address first
159+
run: sleep 5s
160+
- name: Start SAI-C server
161+
run: ./run.sh -i server -o deb12
162+
- name: Update SAI-C server package
163+
run: ./exec.sh -i server --no-tty pip3 install /sai-challenger/common /sai-challenger
164+
if: ${{ env.REDIS_SERVER == '0' }}
165+
- name: Update SAI-C client package
166+
run: ./exec.sh -i client --no-tty pip3 install /sai-challenger/common /sai-challenger
167+
if: ${{ env.REDIS_CLIENT == '0' }}
168+
- name: Create veth links between client and server dockers
169+
run: sudo ./veth-create-host.sh sc-server-trident2-saivs-run sc-client-run
170+
171+
- name: Run functional test cases
172+
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v -k "test_l2_basic"
173+
- name: Run unit tests
174+
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
175+
- name: Run unit tests
176+
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v -k \
177+
"test_switch_ut and not sai_map_list_t"
178+
- name: Run thift data-driven tests
179+
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v test_l2_basic_dd.py
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: sc-standalone-deb12
2+
3+
on:
4+
pull_request:
5+
types: [ opened, synchronize, reopened ]
6+
branches: [ "**" ]
7+
paths:
8+
- '.github/workflows/sc-standalone-deb12.yml'
9+
- 'dockerfiles/bookworm/Dockerfile'
10+
- 'npu/broadcom/BCM56850/saivs/Dockerfile'
11+
- 'npu/broadcom/BCM56850/saivs/Dockerfile.saithrift'
12+
- 'common/**'
13+
- 'cli/**'
14+
- 'scripts/**'
15+
- 'configs/**'
16+
- 'tests/**'
17+
- 'setup.py'
18+
- 'build.sh'
19+
- 'run.sh'
20+
- 'exec.sh'
21+
- '.dockerignore'
22+
- 'sai.env'
23+
24+
env:
25+
DOCKER_BASE: 'dockerfiles/bookworm/Dockerfile'
26+
DOCKER_REDIS: 'npu/broadcom/BCM56850/saivs/Dockerfile'
27+
DOCKER_THRIFT: 'npu/broadcom/BCM56850/saivs/Dockerfile.saithrift'
28+
REDIS_RPC: 0
29+
THRIFT_RPC: 0
30+
31+
jobs:
32+
build-sc-stadalone:
33+
name: Build SAI Challenger standalone image
34+
runs-on: ubuntu-24.04
35+
steps:
36+
- uses: actions/checkout@v3
37+
with:
38+
fetch-depth: 2
39+
- name: Update submodules
40+
run: git submodule update --init
41+
42+
- name: Check what files were updated
43+
id: check_changes
44+
run: |
45+
echo 'changed_files<<EOF' >> $GITHUB_OUTPUT
46+
echo "$(git diff --name-only HEAD~1)" >> $GITHUB_OUTPUT
47+
echo 'EOF' >> $GITHUB_OUTPUT
48+
49+
- name: Check what Docker images have to be rebuild
50+
run: |
51+
for file in "$DOCKER_BASE" "$DOCKER_REDIS" "sai.env"; do
52+
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
53+
echo "REDIS_RPC=1" >> $GITHUB_ENV
54+
fi
55+
done
56+
for file in "$DOCKER_BASE" "$DOCKER_THRIFT" "sai.env"; do
57+
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
58+
echo "THRIFT_RPC=1" >> $GITHUB_ENV
59+
fi
60+
done
61+
62+
- name: Build standalone Docker image
63+
run: ./build.sh -i standalone -o deb12
64+
if: ${{ env.REDIS_RPC == '1' }}
65+
66+
- name: Start SAI-C in standalone mode
67+
run: ./run.sh -i standalone -o deb12
68+
- name: Update SAI-C package
69+
run: ./exec.sh --no-tty pip3 install /sai-challenger/common /sai-challenger
70+
if: ${{ env.REDIS_RPC == '0' }}
71+
72+
- name: Run tests
73+
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -v test_l2_basic.py -v test_vrf.py -v test_dc_t1.py
74+
- name: Run sairedis tests
75+
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -v -k "test_sairec"
76+
- name: Run unit tests
77+
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -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
78+
- name: Run unit tests
79+
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -v -k "test_switch_ut and not sai_map_list_t"
80+
- name: Run data-driven tests
81+
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -v test_l2_basic_dd.py
82+
- name: Run API tests
83+
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -v api/
84+
85+
# - name: Build standalone docker image with SAI thrift
86+
# run: ./build.sh -i standalone -s thrift -o deb12
87+
# if: ${{ env.THRIFT_RPC == '1' }}
88+
89+
# - name: Start SAI-C in standalone mode with SAI thrift
90+
# run: ./run.sh -i standalone -s thrift -o deb12
91+
# - name: Update SAI-C package
92+
# run: ./exec.sh --no-tty -s thrift pip3 install /sai-challenger/common /sai-challenger
93+
# if: ${{ env.THRIFT_RPC == '0' }}
94+
95+
# - name: Run thrift tests
96+
# run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v test_l2_basic.py -v test_vrf.py -v test_dc_t1.py
97+
# - name: Run thift data-driven tests
98+
# run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v test_l2_basic_dd.py
99+
# - name: Run thrift unit tests
100+
# run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v ut/test_vrf_ut.py ut/test_bridge_ut.py ut/test_acl_ut.py ut/test_fdb_ut.py ut/test_lag_ut.py
101+
# - name: Run thrift unit tests
102+
# run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v -k \
103+
# "(test_switch_ut and not sai_map_list_t and not sai_system_port_config_list_t and not (SAI_SWITCH_ATTR_DASH or SAI_SWITCH_ATTR_HA)) or (test_port_ut and not sai_map_list_t)"
104+
# - name: Run thrift sairedis tests
105+
# run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v -k "test_sairec"
106+
# - name: Run thrift API tests
107+
# run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v api/
108+
109+
# - name: Run PTF tests
110+
# run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v ../usecases/sai-ptf/SAI/ptf/saifdb.py -k FdbAttributeTest

0 commit comments

Comments
 (0)