From 0d2c3a8f7fb242f4545324f330eb5c4feeca3cf2 Mon Sep 17 00:00:00 2001 From: Rupesh Chiluka Date: Mon, 17 Jun 2024 21:21:14 +0530 Subject: [PATCH] Added workflow tests on test branch --- .github/workflows/ci-bazel-test.yml | 81 ++++++++++++++ .github/workflows/ci-container-image-test.yml | 41 +++++++ .github/workflows/ci-lint-test.yaml | 38 +++++++ .github/workflows/ci-p4tools-test.yml | 39 +++++++ .github/workflows/ci-ptf-test.yml | 52 +++++++++ .../workflows/ci-static-build-test-test.yml | 48 ++++++++ .github/workflows/ci-test-debian-test.yml | 78 +++++++++++++ .github/workflows/ci-test-fedora-test.yml | 47 ++++++++ .github/workflows/ci-test-mac-test.yml | 105 ++++++++++++++++++ .../workflows/ci-ubuntu-18-nightly-test.yml | 35 ++++++ .../ci-ubuntu-20-sanitizer-nightly-test.yml | 38 +++++++ .../workflows/ci-validation-nightly-test.yml | 36 ++++++ 12 files changed, 638 insertions(+) create mode 100644 .github/workflows/ci-bazel-test.yml create mode 100644 .github/workflows/ci-container-image-test.yml create mode 100644 .github/workflows/ci-lint-test.yaml create mode 100644 .github/workflows/ci-p4tools-test.yml create mode 100644 .github/workflows/ci-ptf-test.yml create mode 100644 .github/workflows/ci-static-build-test-test.yml create mode 100644 .github/workflows/ci-test-debian-test.yml create mode 100644 .github/workflows/ci-test-fedora-test.yml create mode 100644 .github/workflows/ci-test-mac-test.yml create mode 100644 .github/workflows/ci-ubuntu-18-nightly-test.yml create mode 100644 .github/workflows/ci-ubuntu-20-sanitizer-nightly-test.yml create mode 100644 .github/workflows/ci-validation-nightly-test.yml diff --git a/.github/workflows/ci-bazel-test.yml b/.github/workflows/ci-bazel-test.yml new file mode 100644 index 00000000000..41a47e8a265 --- /dev/null +++ b/.github/workflows/ci-bazel-test.yml @@ -0,0 +1,81 @@ +name: "bazel" + +on: + push: + branches: [main, p4c_pna_dev_v1, p4c_pna_dev_test] + +# Cancel any preceding run on the pull request. +concurrency: + group: bazel-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + build_direct: # Build p4c directly. + runs-on: ubuntu-latest + env: + BAZEL: bazelisk-linux-amd64 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Mount bazel cache + uses: actions/cache@v4 + with: + # See https://docs.bazel.build/versions/master/output_directories.html + path: "~/.cache/bazel" + # Create cash entry for every run (by using unique key derived from commit hash). + # See https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows + key: ${{ runner.os }}-build-direct-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-build-direct- + + - name: Install bazelisk + run: | + curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/$BAZEL" + chmod +x $BAZEL + sudo mv $BAZEL /usr/local/bin/bazel + + - name: First, pass the lint test + run: bazel run //:buildifier_check + + - name: Install Flex and Bison + run: sudo apt-get update && sudo apt-get install bison flex libfl-dev + + - name: Build p4c + run: bazel build //... --verbose_failures + + build_indirect: # Build 3rd party Bazel project depending on p4c as a subproject. + runs-on: ubuntu-latest + env: + BAZEL: bazelisk-linux-amd64 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Mount bazel cache + uses: actions/cache@v4 + with: + # See https://docs.bazel.build/versions/master/output_directories.html + path: "~/.cache/bazel" + # Create cash entry for every run (by using unique key derived from commit hash). + # See https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows + key: ${{ runner.os }}-build-indirect-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-build-indirect- + + - name: First, pass the lint test + run: bazel run //:buildifier_check + + - name: Install bazelisk + run: | + curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/$BAZEL" + chmod +x $BAZEL + sudo mv $BAZEL /usr/local/bin/bazel + + - name: Install Flex and Bison + run: sudo apt-get update && sudo apt-get install bison flex libfl-dev + + - name: Build bazel/example + run: cd ./bazel/example && bazel build //... --verbose_failures diff --git a/.github/workflows/ci-container-image-test.yml b/.github/workflows/ci-container-image-test.yml new file mode 100644 index 00000000000..6f241deb3cd --- /dev/null +++ b/.github/workflows/ci-container-image-test.yml @@ -0,0 +1,41 @@ +name: container-image + +on: + push: + branches: [main, p4c_pna_dev_v1, p4c_pna_dev_test] + +# Cancel any preceding run on the pull request. +concurrency: + group: container-image-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' || github.ref != 'refs/heads/p4c_pna_dev_v1' || github.ref != 'refs/heads/p4c_pna_dev_test' }} + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Determine Docker image tag + id: get-tag + shell: bash + run: | + TAG=${GITHUB_REF////_} + echo "Tag is $TAG" + echo "::set-output name=tag::$TAG" + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build and push Docker image to registry + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: p4lang/p4c:${{ steps.get-tag.outputs.tag }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/ci-lint-test.yaml b/.github/workflows/ci-lint-test.yaml new file mode 100644 index 00000000000..09d070f01f7 --- /dev/null +++ b/.github/workflows/ci-lint-test.yaml @@ -0,0 +1,38 @@ + +name: "p4c-lint" + +on: + push: + branches: [main, p4c_pna_dev_v1, p4c_pna_dev_test] + +jobs: + p4c-lint: + runs-on: ubuntu-20.04 + env: + IMAGE_TYPE: test + CMAKE_ONLY: ON + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: actions/setup-python@v5 + + - name: ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: apply-linters-${{ runner.os }} + max-size: 1000M + + - name: Build (Ubuntu 20.04) + run: | + tools/ci-build.sh + - name: Run cpplint on C/C++ files. + run: cmake --build build --target cpplint + + - name: Run clang-format on C/C++ files. + run: cmake --build build --target clang-format + + - name: Run black and isort on Python files. + run: | + cmake --build build --target black + cmake --build build --target isort diff --git a/.github/workflows/ci-p4tools-test.yml b/.github/workflows/ci-p4tools-test.yml new file mode 100644 index 00000000000..5cc7ecd2a71 --- /dev/null +++ b/.github/workflows/ci-p4tools-test.yml @@ -0,0 +1,39 @@ +name: "test-tools" + +on: + push: + branches: [main, p4c_pna_dev_v1, p4c_pna_dev_test] + +# Cancel any preceding run on the pull request. +concurrency: + group: tools-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + # Build and test p4tools on Ubuntu 22.04. + build-and-test-tools: + runs-on: ubuntu-22.04 + env: + CTEST_PARALLEL_LEVEL: 4 + IMAGE_TYPE: test + CMAKE_UNITY_BUILD: ON + ENABLE_TEST_TOOLS: ON + BUILD_GENERATOR: Ninja + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: test-tools-${{ runner.os }} + max-size: 1000M + + - name: Build (Ubuntu 22.04) + run: | + tools/ci-build.sh + - name: Run tests (Ubuntu 22.04) + # Need to use sudo for the eBPF kernel tests. + run: sudo -E ctest -R testgen- --output-on-failure --schedule-random + working-directory: ./build diff --git a/.github/workflows/ci-ptf-test.yml b/.github/workflows/ci-ptf-test.yml new file mode 100644 index 00000000000..89c515e622f --- /dev/null +++ b/.github/workflows/ci-ptf-test.yml @@ -0,0 +1,52 @@ +# Copyright 2022-present Orange +# Copyright 2022-present Open Networking Foundation +# +# 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" + +on: + push: + branches: [main, p4c_pna_dev_v1, p4c_pna_dev_test] + +# Cancel any preceding run on the pull request. +concurrency: + group: ptf-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' || github.ref != 'refs/heads/p4c_pna_dev_v1' || github.ref != 'refs/heads/p4c_pna_dev_test' }} + +jobs: + ptf-linux: + runs-on: ubuntu-20.04 + env: + CTEST_PARALLEL_LEVEL: 4 + IMAGE_TYPE: test + CMAKE_UNITY_BUILD: ON + INSTALL_PTF_EBPF_DEPENDENCIES: ON + BUILD_GENERATOR: Ninja + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: test-ptf-${{ runner.os }} + max-size: 1000M + + - name: Build (Ubuntu 20.04) + run: | + tools/ci-build.sh + - name: Run PTF tests for eBPF backend (Ubuntu 20.04) + run: sudo -E ./test.sh + working-directory: ./backends/ebpf/tests diff --git a/.github/workflows/ci-static-build-test-test.yml b/.github/workflows/ci-static-build-test-test.yml new file mode 100644 index 00000000000..28a7fbff8fd --- /dev/null +++ b/.github/workflows/ci-static-build-test-test.yml @@ -0,0 +1,48 @@ +name: "static-build-test-p4c" + +on: + push: + branches: [main, p4c_pna_dev_v1, p4c_pna_dev_test] + +# Cancel any preceding run on the pull request. +concurrency: + group: static-build-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + # Build a p4c release on Ubuntu 20.04. + build-linux: + # Only run on pull requests with the "run-static" label. + if: ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'run-static') }} + # Note: Actions have no real ternary condition operator, but this hack works because non-empty + # strings are true. + name: Dynamic ${{ matrix.dynamic.glibc == 'ON' && 'glibc' || 'stdlib' }} + strategy: + fail-fast: false + matrix: + dynamic: [{glibc: ON, stdlib: OFF}, {glibc: OFF, stdlib: ON}] + runs-on: ubuntu-20.04 + env: + IMAGE_TYPE: test + CMAKE_UNITY_BUILD: ON + STATIC_BUILD_WITH_DYNAMIC_GLIBC: "${{ matrix.dynamic.glibc }}" + STATIC_BUILD_WITH_DYNAMIC_STDLIB: "${{ matrix.dynamic.stdlib }}" + ENABLE_TEST_TOOLS: ON + BUILD_GENERATOR: Ninja + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: test-static-${{ runner.os }} + max-size: 1000M + + - shell: bash + name: Build (Ubuntu 20.04) + run: | + sudo -E tools/ci-build.sh + ./tools/ci-check-static.sh ./build/p4c-bm2-ss ./build/p4c-dpdk ./build/p4c-ebpf \ + ./build/p4c-pna-p4tc ./build/p4c-ubpf ./build/p4test ./build/p4testgen diff --git a/.github/workflows/ci-test-debian-test.yml b/.github/workflows/ci-test-debian-test.yml new file mode 100644 index 00000000000..c2660ebd31d --- /dev/null +++ b/.github/workflows/ci-test-debian-test.yml @@ -0,0 +1,78 @@ +name: "test-p4c-debian" + +on: + push: + branches: [main, p4c_pna_dev_v1, p4c_pna_dev_test] + +# Cancel any preceding run on the pull request. +concurrency: + group: test-p4c-debian-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' || github.ref != 'refs/heads/p4c_pna_dev_v1' || github.ref != 'refs/heads/p4c_pna_dev_test' }} + +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 + BUILD_GENERATOR: Ninja + 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 }}, GTest ${{ matrix.gtest }}) + strategy: + fail-fast: false + matrix: + unity: [ON, OFF] + include: + - unity: ON + gtest: ON + - unity: OFF + gtest: OFF + runs-on: ubuntu-20.04 + env: + CTEST_PARALLEL_LEVEL: 4 + IMAGE_TYPE: test + ENABLE_GTESTS: ${{ matrix.gtest }} + CMAKE_UNITY_BUILD: ${{ matrix.unity }} + BUILD_GENERATOR: Ninja + 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' && matrix.gtest == 'ON' diff --git a/.github/workflows/ci-test-fedora-test.yml b/.github/workflows/ci-test-fedora-test.yml new file mode 100644 index 00000000000..ac32a14384f --- /dev/null +++ b/.github/workflows/ci-test-fedora-test.yml @@ -0,0 +1,47 @@ +name: "test-p4c-fedora" + +on: + push: + branches: [main, p4c_pna_dev_v1, p4c_pna_dev_test] + +# Cancel any preceding run on the pull request. +concurrency: + group: test-p4c-fedora-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' || github.ref != 'refs/heads/p4c_pna_dev_v1' || github.ref != 'refs/heads/p4c_pna_dev_test' }} + +jobs: + # 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 --build-generator "Ninja" + 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 + working-directory: ./build diff --git a/.github/workflows/ci-test-mac-test.yml b/.github/workflows/ci-test-mac-test.yml new file mode 100644 index 00000000000..954e80b708b --- /dev/null +++ b/.github/workflows/ci-test-mac-test.yml @@ -0,0 +1,105 @@ +name: "test-p4c-mac" + +on: + push: + branches: [main, p4c_pna_dev_v1, p4c_pna_dev_test] + +# Cancel any preceding run on the pull request. +concurrency: + group: test-p4c-mac-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' || github.ref != 'refs/heads/p4c_pna_dev_v1' || github.ref != 'refs/heads/p4c_pna_dev_test' }} + +jobs: + # 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: Get brew cache dir + id: brew-cache + run: | + echo "dir=$(brew --prefix)" >> $GITHUB_OUTPUT + - name: Cache Homebrew Packages + id: cache-homebrew-packages + uses: actions/cache@v4 + env: + cache-name: homebrew-packages + with: + path: ${{ steps.brew-cache.outputs.dir }} + key: ${{ runner.os }}-m1-${{ 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 -DENABLE_TEST_TOOLS=ON --build-generator "Ninja" + cmake --build build -- -j $(nproc) + - name: Run tests (MacOS) + run: | + source ~/.bash_profile + ctest --output-on-failure --schedule-random -LE "bpf|ubpf|testgen" + 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: Get brew cache dir + id: brew-cache + run: | + echo "dir=$(brew --prefix)" >> $GITHUB_OUTPUT + - name: Cache Homebrew Packages + id: cache-homebrew-packages + uses: actions/cache@v4 + env: + cache-name: homebrew-packages + with: + path: ${{ steps.brew-cache.outputs.dir }} + key: ${{ runner.os }}-${{ hashFiles('tools/install_mac_deps.sh') }} + + - name: Install dependencies (MacOS) + run: | + # FIXME: We should not need to do this, but there are currently some complications with Github CI. + # See https://github.com/actions/runner-images/issues/4020. + # See https://github.com/actions/runner-images/issues/8838. + brew install python@3.12 || true + brew link --overwrite python@3.12 + brew pin python@3.12 + 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 -DENABLE_TEST_TOOLS=ON --build-generator "Ninja" + cmake --build build -- -j $(nproc) + - name: Run tests (MacOS) + run: | + source ~/.bash_profile + ctest --output-on-failure --schedule-random -LE "bpf|ubpf|testgen" + working-directory: ./build diff --git a/.github/workflows/ci-ubuntu-18-nightly-test.yml b/.github/workflows/ci-ubuntu-18-nightly-test.yml new file mode 100644 index 00000000000..d5484463193 --- /dev/null +++ b/.github/workflows/ci-ubuntu-18-nightly-test.yml @@ -0,0 +1,35 @@ +name: "test-p4c-ubuntu-18.04" + +on: + branches: [main, p4c_pna_dev_v1, p4c_pna_dev_test] + +jobs: + # Build with GCC and test p4c on Ubuntu 18.04. + test-ubuntu18: + # Only run on pull requests with the "run-ubuntu18" label. + if: ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'run-ubuntu18') }} + runs-on: ubuntu-latest + env: + CTEST_PARALLEL_LEVEL: 4 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + + - name: ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: test-ubuntu-18.04-gcc + max-size: 1000M + + - name: Build (Ubuntu 18.04, GCC) + run: | + docker build -t p4c --build-arg BASE_IMAGE=ubuntu:18.04 --build-arg IMAGE_TYPE=test \ + --build-arg ENABLE_TEST_TOOLS=OFF . + ./tools/export_ccache.sh + # run with sudo (...) --privileged + # this is needed to create network namespaces for the ebpf tests. + - name: Run tests (Ubuntu 18.04) + run: | + sudo -E docker run --privileged -w /p4c/build -e $CTEST_PARALLEL_LEVEL p4c ctest --output-on-failure --schedule-random diff --git a/.github/workflows/ci-ubuntu-20-sanitizer-nightly-test.yml b/.github/workflows/ci-ubuntu-20-sanitizer-nightly-test.yml new file mode 100644 index 00000000000..6c1dd198ebe --- /dev/null +++ b/.github/workflows/ci-ubuntu-20-sanitizer-nightly-test.yml @@ -0,0 +1,38 @@ +name: "test-p4c-ubuntu-20.04-sanitizers" + +on: + push: + branches: [main, p4c_pna_dev_v1, p4c_pna_dev_test] + +jobs: + # Build with clang and test p4c on Ubuntu 20.04. + test-ubuntu20-clang-sanitizers: + # Only run on pull requests with the "run-sanitizer" label. + if: ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'run-sanitizer') }} + runs-on: ubuntu-20.04 + env: + CTEST_PARALLEL_LEVEL: 2 + IMAGE_TYPE: test + COMPILE_WITH_CLANG: ON + BUILD_AUTO_VAR_INIT_PATTERN: ON + ENABLE_SANITIZERS: ON + UBSAN_OPTIONS: print_stacktrace=1 + ASAN_OPTIONS: print_stacktrace=1:detect_leaks=0 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: test-${{ runner.os }}-clang + max-size: 1000M + + - name: Build (Ubuntu 20.04, Clang, Sanitizers) + 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 diff --git a/.github/workflows/ci-validation-nightly-test.yml b/.github/workflows/ci-validation-nightly-test.yml new file mode 100644 index 00000000000..1efa2bb7722 --- /dev/null +++ b/.github/workflows/ci-validation-nightly-test.yml @@ -0,0 +1,36 @@ +name: "validate-p4c" + +on: + push: + branches: [main, p4c_pna_dev_v1, p4c_pna_dev_test] + +jobs: + # We run validation in parallel with the normal tests. + # Validation ensures that P4C compiles P4-16 programs correctly. + # We only test the front end and some mid end passes for now. + validate: + # Only run on pull requests with the "run-validation" label. + if: ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'run-validation') }} + env: + CTEST_PARALLEL_LEVEL: 4 + IMAGE_TYPE: test + VALIDATION: ON + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: validation-${{ runner.os }} + max-size: 1000M + + - name: Build (Ubuntu 20.04) + run: | + tools/ci-build.sh + - name: Validate + run: | + ctest -R toz3-validate-p4c --output-on-failure --schedule-random + working-directory: ./build