RFC PDLL patterns #830
Workflow file for this run
This file contains hidden or 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
| name: build-and-test | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| # Cancel any preceding run on the pull request. | |
| concurrency: | |
| group: p4mlir-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| build-and-test: | |
| name: test-${{ matrix.distribution }} | |
| runs-on: ${{ matrix.distribution }} | |
| strategy: | |
| fail-fast: false # Let all matrix jobs complete, even if one fails | |
| matrix: | |
| distribution: [ubuntu-22.04, ubuntu-24.04] | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Get LLVM hash | |
| id: get-llvm-hash | |
| run: echo "hash=$(git rev-parse @:./third_party/llvm-project)" >> $GITHUB_OUTPUT | |
| - name: Enable ccache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| # The ccache key combines runner OS and distribution, LLVM version, and build configuration to prevent unsafe cache hits while maximizing valid reuse. | |
| # ccache key components: | |
| # - ${{ steps.get-llvm-hash.outputs.hash }} | |
| # - Pins cache to the exact LLVM commit. Without this, a cache hit could return incompatible build results. | |
| # - hashFiles('${{ github.workspace }}/build_tools/build_mlir.sh') | |
| # - The build_mlir.sh script defines critical build flags (e.g., -DLLVM_ENABLE_RTTI=ON, compiler choices, linker options). | |
| # If the script changes (e.g., enabling/disabling features), cached objects from a previous version might be invalid or unsafe to reuse. | |
| key: ${{ runner.os }}-${{ matrix.distribution }}-llvm-commit-${{ steps.get-llvm-hash.outputs.hash }}-mlir-build-script-${{ hashFiles('${{ github.workspace }}/build_tools/build_mlir.sh') }} | |
| max-size: 2G | |
| - name: Cache LLVM | |
| id: cache-llvm | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| third_party/llvm-project/build/bin/llvm-lit | |
| install | |
| key: ${{ runner.os }}-${{ matrix.distribution }}-llvm-commit-${{ steps.get-llvm-hash.outputs.hash }}-mlir-build-script-${{ hashFiles('${{ github.workspace }}/build_tools/build_mlir.sh') }} | |
| - name: Install requirements | |
| run: | | |
| build_tools/ubuntu_install_mlir_requirements.sh | |
| # -------- | |
| # Build and test MLIR. Use cache when available. | |
| # -------- | |
| - name: Build and test MLIR | |
| if: steps.cache-llvm.outputs.cache-hit != 'true' | |
| run: | | |
| build_tools/build_mlir.sh | |
| # -------- | |
| # Build and test P4MLIR. | |
| # -------- | |
| - name: Build and test P4MLIR | |
| run: | | |
| build_tools/build_p4c_with_p4mlir_ext.sh |