forked from p4lang/p4c
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba4f5fe
commit dcf336d
Showing
12 changed files
with
652 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# 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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
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' |
Oops, something went wrong.