forked from p4lang/p4c
-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (108 loc) · 3.99 KB
/
ci-ptf-kernels-weekly.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
# Copyright 2022-present Orange
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "ptf-ebpf-kernels-weekly"
on:
schedule:
# Every sunday at 1:17 am UTC
- cron: '17 1 * * 0'
env:
VM_NAME: inner
DISK_IMAGE: /tmp/vm_disk_image.qcow2
P4C_IMAGE: p4c.img
WORKING_DISK_IMAGE: /var/lib/libvirt/images/vm_disk.qcow2
DOCKER_VOLUME_IMAGE: /var/lib/libvirt/images/docker_disk.qcow2
UBUNTU_2004_KERNELS: 5.8.0-63 5.11.0-46 5.13.0-52 5.15.0-69
jobs:
build-p4c:
# Prevent triggering by a fork because this workflow is resource intensive
if: ${{ github.repository == 'p4lang/p4c' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Cache P4C docker image
uses: actions/cache@v3
id: p4c_cache
with:
path: ${{ env.P4C_IMAGE }}
key: ptf-weekly-p4c-${{ github.sha }}
# No need to download the image, because it is only build in this job
lookup-only: true
- name: Build P4C docker image
if: steps.p4c_cache.outputs.cache-hit != 'true'
run: |
docker build --network host -t p4c --build-arg MAKEFLAGS=-j2 --build-arg IMAGE_TYPE=test --build-arg CMAKE_UNITY_BUILD=ON --build-arg INSTALL_PTF_EBPF_DEPENDENCIES=ON .
docker save -o ${{ env.P4C_IMAGE }} p4c
build-ubuntu-2004:
# Prevent triggering by a fork because this workflow is resource intensive
if: ${{ github.repository == 'p4lang/p4c' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
env:
OS_TYPE: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Cache VM image
uses: actions/cache@v3
id: vm_cache
with:
path: ${{ env.DISK_IMAGE }}
key: ${{ env.OS_TYPE }} ${{ env.UBUNTU_2004_KERNELS }}
# No need to download the image, because it is only build in this job
lookup-only: true
- name: Build VM image
if: steps.vm_cache.outputs.cache-hit != 'true'
run: |
sudo -E ./tools/ci-ptf/prepare_runner.sh
sudo -E ./tools/ci-ptf/build_vm.sh ${{ env.UBUNTU_2004_KERNELS }}
ptf-ubuntu-2004:
needs: [build-ubuntu-2004, build-p4c]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
kernels: [5.8, 5.11, 5.13, 5.15]
include:
- kernels: 5.8
kernel_version: 5.8.0-63
- kernels: 5.11
kernel_version: 5.11.0-46
- kernels: 5.13
kernel_version: 5.13.0-52
- kernels: 5.15
kernel_version: 5.15.0-69
env:
OS_TYPE: ubuntu-20.04
KERNEL_VERSION: ${{ matrix.kernel_version }}
steps:
- uses: actions/checkout@v3
- name: Download P4C docker image
uses: actions/cache/restore@v3
id: p4c_cache
with:
path: ${{ env.P4C_IMAGE }}
key: ptf-weekly-p4c-${{ github.sha }}
fail-on-cache-miss: true
- name: Download VM image
uses: actions/cache/restore@v3
id: vm_cache
with:
path: ${{ env.DISK_IMAGE }}
key: ${{ env.OS_TYPE }} ${{ env.UBUNTU_2004_KERNELS }}
fail-on-cache-miss: true
- name: Prepare runner
run: sudo -E ./tools/ci-ptf/prepare_runner.sh
- name: Install VM and run PTF tests for eBPF backend
run: |
sudo -E ./tools/ci-ptf/run_test.sh sudo docker run --privileged -v /sys/fs/bpf:/sys/fs/bpf -w /p4c/backends/ebpf/tests p4c ./test.sh