Summary
Several CI workflows contain nearly identical setup steps for building p4c:
- Checkout repository with recursive submodules
- Configure ccache
- Run
tools/ci-build.sh
This pattern appears in multiple workflows, including:
ci-lint.yaml
ci-p4tools.yml
ci-ptf.yml
ci-static-build-test.yml
ci-validation-nightly.yml
ci-test-debian.yml
- and others
Proposal
Introduce a reusable composite action under:
.github/actions/setup-p4c-build/action.yml
to encapsulate common setup logic.
Example:
name: Setup p4c build environment
inputs:
ccache-key:
required: true
runs:
using: composite
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ inputs.ccache-key }}-${{ runner.os }}
max-size: 1000M
Workflows would then invoke the composite action and keep only workflow-specific build and test steps.
Benefits
- Reduces duplicated CI configuration.
- Makes future CI updates easier (e.g. cache configuration changes).
- Lowers the risk of workflow drift between jobs.
- Improves maintainability by centralizing common setup logic.
Expected Changes
- Add
.github/actions/setup-p4c-build/action.yml.
- Migrate affected workflows to use the composite action.
- Preserve existing workflow behavior and cache keys.
- Reduce duplicated CI setup code across the repository.
Summary
Several CI workflows contain nearly identical setup steps for building p4c:
tools/ci-build.shThis pattern appears in multiple workflows, including:
ci-lint.yamlci-p4tools.ymlci-ptf.ymlci-static-build-test.ymlci-validation-nightly.ymlci-test-debian.ymlProposal
Introduce a reusable composite action under:
to encapsulate common setup logic.
Example:
Workflows would then invoke the composite action and keep only workflow-specific build and test steps.
Benefits
Expected Changes
.github/actions/setup-p4c-build/action.yml.