Skip to content

Commit

Permalink
Simplify CI. Aggressive batch size.
Browse files Browse the repository at this point in the history
Fix template.
  • Loading branch information
fruffy committed Aug 18, 2022
1 parent ea7c546 commit 9ea33cf
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 35 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci-ptf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ concurrency:
jobs:
ptf-linux:
env:
UNIFIED: ON
ENABLE_GMP: ON
runs-on: ubuntu-latest
steps:
Expand All @@ -40,12 +39,12 @@ jobs:
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: test-${{ env.UNIFIED }}-${{ runner.os }}
key: test-ptf-${{ runner.os }}
max-size: 1000M

- name: Build (Linux)
run: |
docker build --network host -t p4c --build-arg MAKEFLAGS=-j8 --build-arg IMAGE_TYPE=test --build-arg CMAKE_UNITY_BUILD=$UNIFIED --build-arg ENABLE_GMP=$ENABLE_GMP --build-arg INSTALL_PTF_EBPF_DEPENDENCIES=ON .
docker build --network host -t p4c --build-arg MAKEFLAGS=-j8 --build-arg IMAGE_TYPE=test --build-arg CMAKE_UNITY_BUILD=ON --build-arg ENABLE_GMP=$ENABLE_GMP --build-arg INSTALL_PTF_EBPF_DEPENDENCIES=ON .
./tools/export_ccache.sh
- name: Run PTF tests for eBPF backend (Linux)
Expand Down
59 changes: 30 additions & 29 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ concurrency:

jobs:
# Build and test p4c on Ubuntu 20.04.
build-linux:
test-linux:
strategy:
fail-fast: false
matrix:
unified: [ON, OFF]
enable_gmp: [ON, OFF]
exclude:
- unified: OFF
enable_gmp: OFF
runs-on: ubuntu-latest
env:
CTEST_PARALLEL_LEVEL: 4
Expand All @@ -33,34 +29,49 @@ jobs:
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: test-${{ matrix.unified }}-${{ runner.os }}
key: test-${{ runner.os }}
max-size: 1000M

- name: Build (Ubuntu Linux)
run: |
# To flush out issues with unified vs. non-unified builds,
# do a non-unified build before continuing with the rest,
# which produces a unified build.
docker build -t p4c --build-arg IMAGE_TYPE=test --build-arg CMAKE_UNITY_BUILD=${{ matrix.unified }} --build-arg ENABLE_GMP=${{ matrix.enable_gmp }} .
docker build -t p4c --build-arg IMAGE_TYPE=test --build-arg CMAKE_UNITY_BUILD=ON --build-arg ENABLE_GMP=${{ matrix.enable_gmp }} .
./tools/export_ccache.sh
# run with sudo (...) --privileged
# this is needed to create network namespaces for the ebpf tests.
- name: Run tests (Ubuntu Linux)
run: |
sudo docker run --privileged -w /p4c/build -e $CTEST_PARALLEL_LEVEL p4c ctest --output-on-failure --schedule-random
if: matrix.unified == 'ON'
# Build and test p4c on Ubuntu 20.04.
build-linux-non-unity:
strategy:
fail-fast: false
runs-on: ubuntu-latest
env:
CTEST_PARALLEL_LEVEL: 4
steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: test-non-unity-${{ runner.os }}
max-size: 1000M

- name: Build (Ubuntu Linux)
run: |
docker build -t p4c --build-arg IMAGE_TYPE=test --build-arg CMAKE_UNITY_BUILD=OFF --build-arg ENABLE_GMP=OFF .
./tools/export_ccache.sh
# Build and test p4c on Fedora.
build-fedora-linux:
test-fedora-linux:
strategy:
fail-fast: false
matrix:
unified: [ON, OFF]
enable_gmp: [ON, OFF]
exclude:
- unified: OFF
enable_gmp: OFF
# This job runs in Fedora container that runs in Ubuntu VM.
runs-on: ubuntu-latest
container:
Expand All @@ -87,25 +98,19 @@ jobs:

- name: Build p4c (Fedora Linux)
run: |
./bootstrap.sh -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_UNITY_BUILD=${{ matrix.unified }} -DENABLE_GMP=${{ matrix.enable_gmp }}
./bootstrap.sh -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_UNITY_BUILD=ON -DENABLE_GMP=${{ matrix.enable_gmp }}
make -j2 -C build
- name: Run p4c tests (Fedora Linux)
run: ctest --output-on-failure --schedule-random
working-directory: ./build
if: matrix.unified == 'ON'

# Build and test p4c on MacOS 10.15
build-mac-os:
test-mac-os:
strategy:
fail-fast: false
matrix:
unified: [ON, OFF]
enable_gmp: [ON, OFF]
exclude:
- unified: OFF
enable_gmp: OFF
runs-on: macos-10.15
env:
CTEST_PARALLEL_LEVEL: 4
Expand All @@ -127,12 +132,8 @@ jobs:
- name: Build (MacOS)
run: |
# To flush out issues with unified vs. non-unified builds,
# do a non-unified build before continuing with the rest,
# which produces a unified build.
./bootstrap.sh -DENABLE_GC=ON -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_UNITY_BUILD=${{ matrix.unified }} -DENABLE_GMP=${{ matrix.enable_gmp }} && cd build && make -j2
./bootstrap.sh -DENABLE_GC=ON -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_UNITY_BUILD=ON -DENABLE_GMP=${{ matrix.enable_gmp }} && cd build && make -j2
- name: Run tests (MacOS)
run: |
ctest --output-on-failure -j 2 --schedule-random -LE "bpf$"
if: matrix.unified == 'ON'
4 changes: 1 addition & 3 deletions .github/workflows/ci-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
# We only test the front end and some mid end passes for now.
validate:
env:
UNIFIED: ON
ENABLE_GMP: ON
BUILD_SUCCESS: true
CTEST_PARALLEL_LEVEL: 4
runs-on: ubuntu-latest
Expand All @@ -35,7 +33,7 @@ jobs:

- name: Build (Linux)
run: |
docker build -t p4c --build-arg IMAGE_TYPE=test --build-arg CMAKE_UNITY_BUILD=$UNIFIED --build-arg ENABLE_GMP=$ENABLE_GMP --build-arg VALIDATION=ON . || echo "BUILD_SUCCESS=false" >> $GITHUB_ENV
docker build -t p4c --build-arg IMAGE_TYPE=test --build-arg CMAKE_UNITY_BUILD=ON --build-arg ENABLE_GMP=ON --build-arg VALIDATION=ON . || echo "BUILD_SUCCESS=false" >> $GITHUB_ENV
./tools/export_ccache.sh || echo "BUILD_SUCCESS=false" >> $GITHUB_ENV
- name: Validate
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ include(P4CUtils)
set (P4C_CXX_FLAGS "")
set (P4C_LIB_DEPS)


# If unity builds are enable, choose an aggressive batch size.
if (CMAKE_UNITY_BUILD)
set(CMAKE_UNITY_BUILD_BATCH_SIZE 16 CACHE UNINITIALIZED "Set the unity build batch size.")
endif ()
# set the required options for a static release build
if (BUILD_STATIC_RELEASE)
message(STATUS "Building static release binaries")
Expand Down

0 comments on commit 9ea33cf

Please sign in to comment.