diff --git a/.github/workflows/ci-auto-release.yml b/.github/workflows/ci-auto-release.yml index b4b2c0d16c6..626b7cf8303 100644 --- a/.github/workflows/ci-auto-release.yml +++ b/.github/workflows/ci-auto-release.yml @@ -2,7 +2,7 @@ name: Automated Release on: schedule: - - cron: '0 12 1 * *' # At 12:00 on day-of-month 1 + - cron: "0 12 1 * *" # At 12:00 on day-of-month 1 jobs: build: diff --git a/.github/workflows/ci-bazel.yml b/.github/workflows/ci-bazel.yml index 78640f97310..9e8ed0ea9db 100644 --- a/.github/workflows/ci-bazel.yml +++ b/.github/workflows/ci-bazel.yml @@ -2,11 +2,11 @@ name: "bazel" on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] merge_group: - branches: [ main ] + branches: [main] # Cancel any preceding run on the pull request. concurrency: @@ -14,72 +14,72 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: - build_direct: # Build p4c directly. + build_direct: # Build p4c directly. runs-on: ubuntu-latest env: BAZEL: bazelisk-linux-amd64 steps: - - uses: actions/checkout@v4 - with: - submodules: recursive + - 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: 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: 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: 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: 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 + - name: Build p4c + run: bazel build //... --verbose_failures - build_indirect: # Build 3rd party Bazel project depending on p4c as a subproject. + 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 + - 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: 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: 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 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: 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 + - name: Build bazel/example + run: cd ./bazel/example && bazel build //... --verbose_failures diff --git a/.github/workflows/ci-container-image.yml b/.github/workflows/ci-container-image.yml index 7e4de5fa46c..4b567785528 100644 --- a/.github/workflows/ci-container-image.yml +++ b/.github/workflows/ci-container-image.yml @@ -2,17 +2,17 @@ name: container-image on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] merge_group: - branches: [ main ] + branches: [main] schedule: # Ideally, we would update the image every time the base image # (p4lang/behavioral-model) is updated, this is good enough. # "At minute 15 past every 4th hour from midnight through 23." - - cron: '15 0-23/4 * * *' + - cron: "15 0-23/4 * * *" # Cancel any preceding run on the pull request. concurrency: @@ -24,34 +24,34 @@ jobs: if: ${{ github.repository == 'p4lang/p4c' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Determine Docker image tag - id: get-tag - shell: bash - run: | - TAG="" - if [[ "$GITHUB_REF" =~ "main" ]]; then - TAG="latest" - else - TAG=${GITHUB_REF////_} - fi - 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 + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Determine Docker image tag + id: get-tag + shell: bash + run: | + TAG="" + if [[ "$GITHUB_REF" =~ "main" ]]; then + TAG="latest" + else + TAG=${GITHUB_REF////_} + fi + 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.yaml b/.github/workflows/ci-lint.yaml index d52577fdf8c..7da7dcc766d 100644 --- a/.github/workflows/ci-lint.yaml +++ b/.github/workflows/ci-lint.yaml @@ -2,11 +2,11 @@ name: "p4c-lint" on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] merge_group: - branches: [ main ] + branches: [main] jobs: p4c-lint: @@ -15,36 +15,36 @@ jobs: 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 - - # TODO: This check is disabled because git on the Github serves behaves differently. Unclear why. - # - name: Check submodule ref points. - # run: | - # ./tools/check-git-submodules.sh - - - name: Build (Ubuntu 20.04) - run: | - tools/ci-build.sh - - - name: Run cpplint on C/C++ files. - run: make cpplint - working-directory: ./build - - - name: Run clang-format on C/C++ files. - run: make clang-format - working-directory: ./build - - - name: Run black and isort on Python files. - run: | - make black - make isort - working-directory: ./build + - 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 + + # TODO: This check is disabled because git on the Github serves behaves differently. Unclear why. + # - name: Check submodule ref points. + # run: | + # ./tools/check-git-submodules.sh + + - name: Build (Ubuntu 20.04) + run: | + tools/ci-build.sh + + - name: Run cpplint on C/C++ files. + run: make cpplint + working-directory: ./build + + - name: Run clang-format on C/C++ files. + run: make clang-format + working-directory: ./build + + - name: Run black and isort on Python files. + run: | + make black + make isort + working-directory: ./build diff --git a/.github/workflows/ci-p4tools.yml b/.github/workflows/ci-p4tools.yml index 9c8450d37b5..6925c294819 100644 --- a/.github/workflows/ci-p4tools.yml +++ b/.github/workflows/ci-p4tools.yml @@ -2,11 +2,11 @@ name: "test-tools" on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] merge_group: - branches: [ main ] + branches: [main] # Cancel any preceding run on the pull request. concurrency: @@ -23,21 +23,21 @@ jobs: CMAKE_UNITY_BUILD: ON ENABLE_TEST_TOOLS: ON steps: - - uses: actions/checkout@v4 - with: - submodules: recursive + - uses: actions/checkout@v4 + with: + submodules: recursive - - name: ccache - uses: hendrikmuhs/ccache-action@v1 - with: - key: test-tools-${{ runner.os }} - max-size: 1000M + - 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: 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 + - 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-kernels-weekly.yml b/.github/workflows/ci-ptf-kernels-weekly.yml index 3a0be8f0fba..9073f755a7c 100644 --- a/.github/workflows/ci-ptf-kernels-weekly.yml +++ b/.github/workflows/ci-ptf-kernels-weekly.yml @@ -17,7 +17,7 @@ name: "ptf-ebpf-kernels-weekly" on: schedule: # Every sunday at 1:17 am UTC - - cron: '17 1 * * 0' + - cron: "17 1 * * 0" env: VM_NAME: inner diff --git a/.github/workflows/ci-ptf.yml b/.github/workflows/ci-ptf.yml index e4eaa3f6584..155a8ce3fb2 100644 --- a/.github/workflows/ci-ptf.yml +++ b/.github/workflows/ci-ptf.yml @@ -17,11 +17,11 @@ name: "ptf-ebpf" on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] merge_group: - branches: [ main ] + branches: [main] # Cancel any preceding run on the pull request. concurrency: diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index 42905ab19ab..1589924c74b 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -3,10 +3,10 @@ name: GitHub Release on: push: branches: - - main + - main paths: - - 'Version.txt' - - '.github/workflows/ci-release.yml' + - "Version.txt" + - ".github/workflows/ci-release.yml" # Cancel any preceding run on the pull request. concurrency: @@ -18,52 +18,52 @@ jobs: if: ${{ github.repository == 'p4lang/p4c' }} runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Get version - run: | - VERSION="$(cat Version.txt)" - TAG="v$(cat Version.txt)" - echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "TAG=$TAG" >> $GITHUB_ENV + - name: Get version + run: | + VERSION="$(cat Version.txt)" + TAG="v$(cat Version.txt)" + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "TAG=$TAG" >> $GITHUB_ENV - - name: Check if tag exists - id: check_tag - run: | - TAG="${{ env.TAG }}" - if git rev-parse "$TAG" >/dev/null 2>&1; then - echo "Tag $TAG already exists, skipping release creation." - echo "tag_exists=true" >> $GITHUB_OUTPUT - else - echo "Tag $TAG does not exist." - echo "tag_exists=false" >> $GITHUB_OUTPUT - fi + - name: Check if tag exists + id: check_tag + run: | + TAG="${{ env.TAG }}" + if git rev-parse "$TAG" >/dev/null 2>&1; then + echo "Tag $TAG already exists, skipping release creation." + echo "tag_exists=true" >> $GITHUB_OUTPUT + else + echo "Tag $TAG does not exist." + echo "tag_exists=false" >> $GITHUB_OUTPUT + fi - - name: Release - if: steps.check_tag.outputs.tag_exists == 'false' - uses: softprops/action-gh-release@v1 - with: - tag_name: ${{ env.TAG }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Release + if: steps.check_tag.outputs.tag_exists == 'false' + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ env.TAG }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + - name: Login to DockerHub + 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: true - tags: p4lang/p4c:${{ env.VERSION }} - cache-from: type=gha - cache-to: type=gha,mode=max + - name: Build and push Docker image to registry + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: p4lang/p4c:${{ env.VERSION }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/ci-static-build-test.yml b/.github/workflows/ci-static-build-test.yml index f0a8a4f8183..531b24e3c86 100644 --- a/.github/workflows/ci-static-build-test.yml +++ b/.github/workflows/ci-static-build-test.yml @@ -2,11 +2,11 @@ name: "static-build-test-p4c" on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] merge_group: - branches: [ main ] + branches: [main] # Cancel any preceding run on the pull request. concurrency: @@ -23,35 +23,35 @@ jobs: BUILD_STATIC_RELEASE_SANS_GLIBC: ON ENABLE_TEST_TOOLS: ON steps: - - uses: actions/checkout@v4 - with: - submodules: recursive + - uses: actions/checkout@v4 + with: + submodules: recursive - - name: ccache - uses: hendrikmuhs/ccache-action@v1 - with: - key: test-static-${{ runner.os }} - max-size: 1000M + - 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 - # Disabling these checks until we find a better way to build a fully static binary. - # ldd ./build/p4c-bm2-psa 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" - # ldd ./build/p4c-bm2-ss 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" - # ldd ./build/p4c-dpdk 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" - # ldd ./build/p4c-ebpf 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" - # ldd ./build/p4c-pna-p4tc 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" - # ldd ./build/p4c-ubpf 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" - # ldd ./build/p4test 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" - # ldd ./build/p4testgen 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" + - shell: bash + name: Build (Ubuntu 20.04) + run: | + sudo -E tools/ci-build.sh + # Disabling these checks until we find a better way to build a fully static binary. + # ldd ./build/p4c-bm2-psa 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" + # ldd ./build/p4c-bm2-ss 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" + # ldd ./build/p4c-dpdk 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" + # ldd ./build/p4c-ebpf 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" + # ldd ./build/p4c-pna-p4tc 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" + # ldd ./build/p4c-ubpf 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" + # ldd ./build/p4test 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" + # ldd ./build/p4testgen 2>&1 | grep -E -qi "(not a dynamic executable)|(statically linked)" - ! ldd ./build/p4c-bm2-psa 2>&1 | grep -E "libgc|libboost_iostreams" - ! ldd ./build/p4c-bm2-ss 2>&1 | grep -E "libgc|libboost_iostreams" - ! ldd ./build/p4c-dpdk 2>&1 | grep -E "libgc|libboost_iostreams" - ! ldd ./build/p4c-ebpf 2>&1 | grep -E "libgc|libboost_iostreams" - ! ldd ./build/p4c-pna-p4tc 2>&1 | grep -E "libgc|libboost_iostreams" - ! ldd ./build/p4c-ubpf 2>&1 | grep -E "libgc|libboost_iostreams" - ! ldd ./build/p4test 2>&1 | grep -E "libgc|libboost_iostreams" - ! ldd ./build/p4testgen 2>&1 | grep -E "libgc|libboost_iostreams" + ! ldd ./build/p4c-bm2-psa 2>&1 | grep -E "libgc|libboost_iostreams" + ! ldd ./build/p4c-bm2-ss 2>&1 | grep -E "libgc|libboost_iostreams" + ! ldd ./build/p4c-dpdk 2>&1 | grep -E "libgc|libboost_iostreams" + ! ldd ./build/p4c-ebpf 2>&1 | grep -E "libgc|libboost_iostreams" + ! ldd ./build/p4c-pna-p4tc 2>&1 | grep -E "libgc|libboost_iostreams" + ! ldd ./build/p4c-ubpf 2>&1 | grep -E "libgc|libboost_iostreams" + ! ldd ./build/p4test 2>&1 | grep -E "libgc|libboost_iostreams" + ! ldd ./build/p4testgen 2>&1 | grep -E "libgc|libboost_iostreams" diff --git a/.github/workflows/ci-test-debian.yml b/.github/workflows/ci-test-debian.yml index 66b6c8dd1b6..ea896c824d4 100644 --- a/.github/workflows/ci-test-debian.yml +++ b/.github/workflows/ci-test-debian.yml @@ -2,11 +2,11 @@ name: "test-p4c-debian" on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] merge_group: - branches: [ main ] + branches: [main] # Cancel any preceding run on the pull request. concurrency: @@ -21,25 +21,25 @@ jobs: CTEST_PARALLEL_LEVEL: 4 IMAGE_TYPE: test steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-depth: 0 + - 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: 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: 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 + - 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: @@ -54,23 +54,23 @@ jobs: IMAGE_TYPE: test CMAKE_UNITY_BUILD: ${{ matrix.unity }} steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-depth: 0 + - 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: 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: 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' + - 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' diff --git a/.github/workflows/ci-test-fedora.yml b/.github/workflows/ci-test-fedora.yml index df679ed79e2..eefcbe5b73c 100644 --- a/.github/workflows/ci-test-fedora.yml +++ b/.github/workflows/ci-test-fedora.yml @@ -2,11 +2,11 @@ name: "test-p4c-fedora" on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] merge_group: - branches: [ main ] + branches: [main] # Cancel any preceding run on the pull request. concurrency: @@ -24,29 +24,29 @@ jobs: 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 -j$((`nproc`+1)) -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 + # 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 -j$((`nproc`+1)) -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 diff --git a/.github/workflows/ci-test-mac.yml b/.github/workflows/ci-test-mac.yml index bdd806cbc9a..4f26d4053ef 100644 --- a/.github/workflows/ci-test-mac.yml +++ b/.github/workflows/ci-test-mac.yml @@ -2,11 +2,11 @@ name: "test-p4c-mac" on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] merge_group: - branches: [ main ] + branches: [main] # Cancel any preceding run on the pull request. concurrency: @@ -20,46 +20,46 @@ jobs: 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: | + - 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 make -Cbuild -j$((`nproc`+1)) - - name: Run tests (MacOS) - run: | - source ~/.bash_profile - ctest --output-on-failure --schedule-random -LE "bpf|ubpf|testgen" - working-directory: ./build + - 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: @@ -67,63 +67,49 @@ jobs: 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: | + - 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 unlink python@3.12 - brew uninstall --force azure-cli - brew uninstall --force aws-sam-cli - brew uninstall --force pipx - brew uninstall --force python@3.11 - brew uninstall --force python@3.12 - rm -f '/usr/local/bin/2to3' - rm -f '/usr/local/bin/2to3-3.12' - rm -f '/usr/local/bin/idle3' - rm -f '/usr/local/bin/idle3.12' - rm -f '/usr/local/bin/pydoc3' - rm -f '/usr/local/bin/pydoc3.12' - rm -f '/usr/local/bin/python3' - rm -f '/usr/local/bin/python3-config' - rm -f '/usr/local/bin/python3.12' - rm -f '/usr/local/bin/python3.12-config' - brew install python@3 || brew link --overwrite python@3 - tools/install_mac_deps.sh - - - name: Build (MacOS) - run: | + 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 make -Cbuild -j$((`nproc`+1)) - - name: Run tests (MacOS) - run: | - source ~/.bash_profile - ctest --output-on-failure --schedule-random -LE "bpf|ubpf|testgen" - working-directory: ./build + - name: Run tests (MacOS) + run: | + source ~/.bash_profile + ctest --output-on-failure --schedule-random -LE "bpf|ubpf|testgen" + working-directory: ./build