From 9b7aa8b01e201333e688c7d79168d0abaaf802a3 Mon Sep 17 00:00:00 2001 From: fruffy Date: Fri, 1 Mar 2024 15:20:00 -0500 Subject: [PATCH] Build P4Testgen on MacOS. --- .github/workflows/ci-test-mac.yml | 109 ++++++++++++++++++++++++++++++ .github/workflows/ci-test.yml | 94 -------------------------- 2 files changed, 109 insertions(+), 94 deletions(-) create mode 100644 .github/workflows/ci-test-mac.yml diff --git a/.github/workflows/ci-test-mac.yml b/.github/workflows/ci-test-mac.yml new file mode 100644 index 00000000000..e39b55b8afd --- /dev/null +++ b/.github/workflows/ci-test-mac.yml @@ -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-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 -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 + + # 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 -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 diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 3c9bd8c1ba4..88fe1a26924 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -111,97 +111,3 @@ jobs: # Need to use sudo for the eBPF kernel tests. run: sudo -E ctest --output-on-failure --schedule-random working-directory: ./build - - # 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