Dependencies #491
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: Dependencies | |
| on: | |
| workflow_call: | |
| inputs: | |
| cxx_standard: | |
| description: "What C++ Standard to build with. [cpp03, cpp11, cpp14, cpp17, cpp20, cpp23]" | |
| required: true | |
| type: string | |
| default: "cpp17" | |
| outputs: | |
| cache_key: | |
| description: "GH Actions Cache key associated with the built dependencies" | |
| value: ${{ jobs.build_dependencies.outputs.cache_key }} | |
| schedule: | |
| # Rebuild dependencies cache from the "main" branch at the beginning of a new day, | |
| # so it is accessible from other branches' PRs | |
| - cron: "10 0 * * *" | |
| concurrency: | |
| group: global-${{ inputs.cxx_standard }} | |
| cancel-in-progress: false | |
| jobs: | |
| build_dependencies: | |
| name: Build and cache dependencies [${{ inputs.cxx_standard }}] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| cache_key: ${{ steps.get-cache-key.outputs.cache_key }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Generate dependencies cache key | |
| id: get-cache-key | |
| run: | | |
| echo "cache_key=deps-`date +%y-%m-%d`-`cat docker/build_deps.sh | shasum`" >> $GITHUB_OUTPUT | |
| - name: Cache lookup | |
| uses: actions/cache/restore@v4 | |
| id: cache-lookup | |
| with: | |
| path: deps | |
| key: ${{ steps.get-cache-key.outputs.cache_key }} | |
| lookup-only: true | |
| - name: Set up build dependencies | |
| if: steps.cache-lookup.outputs.cache-hit != 'true' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -qy build-essential \ | |
| gdb \ | |
| curl \ | |
| python3.10 \ | |
| python3-pip \ | |
| cmake \ | |
| ninja-build \ | |
| pkg-config \ | |
| bison \ | |
| libfl-dev \ | |
| libbenchmark-dev \ | |
| libgmock-dev \ | |
| libz-dev | |
| - name: Fetch & build non packaged dependencies | |
| if: steps.cache-lookup.outputs.cache-hit != 'true' | |
| run: | | |
| mkdir -p deps | |
| cd deps | |
| ../docker/build_deps.sh --cxx-standard=${{ inputs.cxx_standard }} | |
| - name: Cache save | |
| if: steps.cache-lookup.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: deps | |
| key: ${{ steps.get-cache-key.outputs.cache_key }} |