Skip to content

ptf-ebpf-kernels-weekly #60

ptf-ebpf-kernels-weekly

ptf-ebpf-kernels-weekly #60

# 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@v4
with:
submodules: recursive
- name: Cache P4C docker image
uses: actions/cache@v4
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@v4
- name: Cache VM image
uses: actions/cache@v4
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@v4
- name: Download P4C docker image
uses: actions/cache/restore@v4
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@v4
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