Skip to content

Commit a68b579

Browse files
committed
ci: add automated ptf testing for tutorial exercises
1 parent d28a6c6 commit a68b579

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: P4 Tutorials CI
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
push:
7+
branches: [ master ]
8+
9+
jobs:
10+
test-basic-exercise:
11+
runs-on: ubuntu-latest
12+
# We use need a privileged container because P4 tests need to create veth interfaces
13+
container:
14+
image: p4lang/p4c:latest
15+
options: --privileged
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Install build dependencies
22+
run: |
23+
apt-get update
24+
apt-get install -y make python3-pip sudo libboost-iostreams-dev libboost-graph-devs
25+
pip3 install protobuf==3.20.3 grpcio grpcio-tools googleapis-common-protos scapy
26+
27+
- name: Ensure scripts are executable
28+
run: |
29+
chmod +x exercises/basic/runptf.sh
30+
31+
- name: Run PTF Tests
32+
run: |
33+
cd exercises/basic
34+
mkdir -p logs
35+
make test
36+
# Retain logs in case runs fail
37+
- name: Upload Logs
38+
if: always()
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: p4-logs
42+
path: exercises/basic/logs/

0 commit comments

Comments
 (0)