Skip to content

Commit

Permalink
Move CI Mac and Fedora tests to separate test runs. (#4495)
Browse files Browse the repository at this point in the history
* Move CI Mac tests to separate test run.

* Move Fedora tests to separate run file.

* Remove incorrect yaml elements.

* Update .github/workflows/ci-test-fedora.yml
  • Loading branch information
fruffy authored Mar 5, 2024
1 parent 633d8c5 commit 944af92
Show file tree
Hide file tree
Showing 10 changed files with 237 additions and 219 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ on:

jobs:
p4c-lint:
strategy:
fail-fast: false
runs-on: ubuntu-20.04
env:
IMAGE_TYPE: test
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ci-p4tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ concurrency:
jobs:
# Build and test p4tools on Ubuntu 22.04.
build-and-test-tools:
strategy:
fail-fast: false
runs-on: ubuntu-22.04
env:
CTEST_PARALLEL_LEVEL: 4
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ci-ptf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ concurrency:

jobs:
ptf-linux:
strategy:
fail-fast: false
runs-on: ubuntu-20.04
env:
CTEST_PARALLEL_LEVEL: 4
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ci-static-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ concurrency:
jobs:
# Build a p4c release on Ubuntu 20.04.
build-linux:
strategy:
fail-fast: false
runs-on: ubuntu-20.04
env:
IMAGE_TYPE: test
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/ci-test-debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: "test-p4c-debian"

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
merge_group:
branches: [ main ]

# 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' }}

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'
52 changes: 52 additions & 0 deletions .github/workflows/ci-test-fedora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "test-p4c-fedora"

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
merge_group:
branches: [ main ]

# 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' }}

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
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
109 changes: 109 additions & 0 deletions .github/workflows/ci-test-mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: "test-p4c-mac"

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
merge_group:
branches: [ main ]

# 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' }}

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
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: 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: |
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
Loading

0 comments on commit 944af92

Please sign in to comment.