From 80392f25abec75cbcee884ef6a503b197eaa9f82 Mon Sep 17 00:00:00 2001 From: Fabian Ruffy <5960321+fruffy@users.noreply.github.com> Date: Sun, 13 Oct 2024 14:03:35 +0200 Subject: [PATCH] Fix Fedora CI build. (#4957) Signed-off-by: fruffy --- .github/workflows/ci-test-fedora.yml | 6 ++++-- tools/install_fedora_deps.sh | 19 ++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-test-fedora.yml b/.github/workflows/ci-test-fedora.yml index 8644592288a..2b4a4d95287 100644 --- a/.github/workflows/ci-test-fedora.yml +++ b/.github/workflows/ci-test-fedora.yml @@ -21,6 +21,8 @@ jobs: container: image: registry.fedoraproject.org/fedora:latest options: --privileged + env: + IN_DOCKER: "TRUE" env: CTEST_PARALLEL_LEVEL: 4 steps: @@ -47,6 +49,6 @@ jobs: cmake --build build -- -j $(nproc) - name: Run p4c tests (Fedora Linux) - # Need to use sudo for the eBPF kernel tests. - run: sudo -E ctest --output-on-failure --schedule-random + run: | + export PATH="$HOME/.local/bin:$PATH"; ctest --output-on-failure --schedule-random working-directory: ./build diff --git a/tools/install_fedora_deps.sh b/tools/install_fedora_deps.sh index 8d9ce30f21c..759f0305073 100755 --- a/tools/install_fedora_deps.sh +++ b/tools/install_fedora_deps.sh @@ -1,6 +1,15 @@ #!/bin/bash -set -e +# Script for building P4C on Fedora for continuous integration builds. + +set -e # Exit on error. +set -x # Make command execution verbose + +# In Docker builds, sudo is not available. So make it a noop. +if [ "$IN_DOCKER" == "TRUE" ]; then + echo "Executing within docker container." + function sudo() { command "$@"; } +fi sudo dnf install -y -q \ automake \ @@ -47,12 +56,12 @@ sudo dnf install -y -q \ zlib-devel \ ninja-build -sudo pip3 install ply ptf scapy==2.5.0 wheel +pip3 install --user ply ptf scapy==2.5.0 wheel # Install dependencies for the BMv2 PTF runner and P4Runtime. -sudo pip3 install --upgrade protobuf==3.20.3 -sudo pip3 install --upgrade googleapis-common-protos==1.61.0 -sudo pip3 install --upgrade grpcio==1.59.2 +pip3 install --user --upgrade protobuf==3.20.3 +pip3 install --user --upgrade googleapis-common-protos==1.61.0 +pip3 install --user --upgrade grpcio==1.59.2 MAKEFLAGS="-j$(nproc)" export MAKEFLAGS