test-p4c #6620
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "test-p4c" | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
merge_group: | |
branches: [ main ] | |
# Cancel any preceding run on the pull request. | |
concurrency: | |
group: test-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
jobs: | |
# Build with gcc and test p4c on Ubuntu 22.04. | |
test-ubuntu22: | |
runs-on: ubuntu-22.04 | |
env: | |
CTEST_PARALLEL_LEVEL: 4 | |
IMAGE_TYPE: test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: ccache | |
uses: hendrikmuhs/ccache-action@v1 | |
with: | |
key: test-${{ runner.os }}-gcc | |
max-size: 1000M | |
- name: Build (Ubuntu 22.04, GCC) | |
run: | | |
tools/ci-build.sh | |
- name: Run tests (Ubuntu 22.04) | |
# Need to use sudo for the eBPF kernel tests. | |
run: sudo -E ctest --output-on-failure --schedule-random | |
working-directory: ./build | |
# Build with gcc and test p4c on Ubuntu 20.04. | |
test-ubuntu20: | |
name: test-ubuntu20 (Unity ${{ matrix.unity }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
unity: [ON, OFF] | |
runs-on: ubuntu-20.04 | |
env: | |
CTEST_PARALLEL_LEVEL: 4 | |
IMAGE_TYPE: test | |
CMAKE_UNITY_BUILD: ${{ matrix.unity }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: ccache | |
uses: hendrikmuhs/ccache-action@v1 | |
with: | |
key: test-${{ matrix.unity }}-${{ runner.os }}-gcc | |
max-size: 1000M | |
- name: Build (Ubuntu 20.04, GCC) | |
run: | | |
tools/ci-build.sh | |
- name: Run tests (Ubuntu 20.04) | |
# Need to use sudo for the eBPF kernel tests. | |
run: sudo -E ctest --output-on-failure --schedule-random | |
working-directory: ./build | |
if: matrix.unity == 'ON' | |
# Build and test p4c on Fedora. | |
test-fedora-linux: | |
# This job runs in Fedora container that runs in Ubuntu VM. | |
runs-on: ubuntu-latest | |
container: | |
image: registry.fedoraproject.org/fedora:latest | |
options: --privileged | |
env: | |
CTEST_PARALLEL_LEVEL: 4 | |
steps: | |
# We need to install git here because it is not provided out of the box in Fedora container. | |
- name: Install git | |
run: dnf install -y -q git | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install dependencies (Fedora Linux) | |
run: tools/install_fedora_deps.sh | |
- name: ccache | |
uses: hendrikmuhs/ccache-action@v1 | |
with: | |
key: fedora-test-${{ runner.os }} | |
max-size: 1000M | |
- name: Build p4c (Fedora Linux) | |
run: | | |
./bootstrap.sh -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_UNITY_BUILD=ON | |
make -j2 -C build | |
- name: Run p4c tests (Fedora Linux) | |
# Need to use sudo for the eBPF kernel tests. | |
run: sudo -E ctest --output-on-failure --schedule-random | |
working-directory: ./build | |
# Build and test p4c on MacOS for M1 Macs. | |
test-mac-os-m1: | |
runs-on: macos-14 | |
env: | |
CTEST_PARALLEL_LEVEL: 4 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: ccache | |
uses: hendrikmuhs/ccache-action@v1 | |
with: | |
key: test-${{ runner.os }} | |
max-size: 1000M | |
- name: Cache Homebrew Packages | |
id: cache-homebrew-packages | |
uses: actions/cache@v4 | |
env: | |
cache-name: homebrew-packages | |
with: | |
path: $(brew --prefix) | |
key: ${{ runner.os }}-${{ hashFiles('tools/install_mac_deps.sh') }} | |
- name: Install dependencies (MacOS) | |
run: | | |
tools/install_mac_deps.sh | |
- name: Build (MacOS) | |
run: | | |
source ~/.bash_profile | |
./bootstrap.sh -DENABLE_GC=ON -DCMAKE_BUILD_TYPE=RELEASE \ | |
-DCMAKE_UNITY_BUILD=ON | |
make -Cbuild -j$((`nproc`+1)) | |
- name: Run tests (MacOS) | |
run: | | |
source ~/.bash_profile | |
ctest --output-on-failure --schedule-random -LE "bpf|ubpf" | |
working-directory: ./build | |
# Build and test p4c on MacOS 13 on x86. | |
test-mac-os: | |
runs-on: macos-13 | |
env: | |
CTEST_PARALLEL_LEVEL: 4 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: ccache | |
uses: hendrikmuhs/ccache-action@v1 | |
with: | |
key: test-${{ runner.os }} | |
max-size: 1000M | |
- name: Cache Homebrew Packages | |
id: cache-homebrew-packages | |
uses: actions/cache@v4 | |
env: | |
cache-name: homebrew-packages | |
with: | |
path: $(brew --prefix) | |
key: ${{ runner.os }}-${{ hashFiles('tools/install_mac_deps.sh') }} | |
- name: Install dependencies (MacOS) | |
run: | | |
tools/install_mac_deps.sh | |
- name: Build (MacOS) | |
run: | | |
source ~/.bash_profile | |
./bootstrap.sh -DENABLE_GC=ON -DCMAKE_BUILD_TYPE=RELEASE \ | |
-DCMAKE_UNITY_BUILD=ON | |
make -Cbuild -j$((`nproc`+1)) | |
- name: Run tests (MacOS) | |
run: | | |
source ~/.bash_profile | |
ctest --output-on-failure --schedule-random -LE "bpf|ubpf" | |
working-directory: ./build |