Skip to content

Commit 0546752

Browse files
committed
ci: refactor to matrix strategy, add concurrency and timeout
1 parent 810cd74 commit 0546752

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

.github/workflows/test-exercises.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,22 @@ on:
55
branches: [ master ]
66
push:
77
branches: [ master ]
8+
# Add concurrency so only most recent push have CI
9+
concurrency:
10+
group: p4-tutorials-ci-${{ github.ref }}
11+
cancel-in-progress: true
812

913
jobs:
10-
test-basic-exercise:
14+
test-exercise:
15+
timeout-minutes: 30
1116
runs-on: ubuntu-latest
1217
# We use need a privileged container because P4 tests need to create veth interfaces
1318
container:
1419
image: p4lang/p4c:latest
1520
options: --privileged
21+
strategy:
22+
matrix:
23+
exercise: [basic, basic_tunnel] # Add more exercises here for future tests
1624

1725
steps:
1826
- name: Checkout code
@@ -24,18 +32,16 @@ jobs:
2432
apt-get install -y make python3-pip sudo libboost-iostreams-dev libboost-graph-dev
2533
pip3 install protobuf==3.20.3 grpcio grpcio-tools googleapis-common-protos scapy
2634
27-
- name: Ensure scripts are executable
28-
run: |
29-
chmod +x exercises/basic/runptf.sh
30-
3135
- name: Run PTF Tests
3236
run: |
33-
cd exercises/basic
37+
chmod +x exercises/${{ matrix.exercise }}/runptf.sh
38+
cd exercises/${{ matrix.exercise }}
3439
make test
3540
# Retain logs in case runs fail
3641
- name: Upload Logs
3742
if: always()
3843
uses: actions/upload-artifact@v4
3944
with:
40-
name: p4-logs
41-
path: exercises/basic/logs/
45+
name: p4-logs-${{ matrix.exercise }}
46+
path: exercises/${{ matrix.exercise }}/logs/
47+

0 commit comments

Comments
 (0)