mirror of
https://github.com/Z3Prover/z3
synced 2026-02-04 16:26:17 +00:00
* Initial plan * Add Z3 build cache workflow and documentation Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Address code review feedback: improve cache strategy and documentation Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Fix cache restore-keys and update size documentation Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Delete .github/workflows/example-cached-z3.yml --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
79 lines
2.1 KiB
YAML
79 lines
2.1 KiB
YAML
name: Build and Cache Z3
|
|
|
|
on:
|
|
# Allow manual trigger
|
|
workflow_dispatch:
|
|
# Run on schedule to keep cache fresh (daily at 2 AM UTC)
|
|
schedule:
|
|
- cron: '0 2 * * *'
|
|
# Run on pushes to main to update cache with latest changes
|
|
push:
|
|
branches: [ "master", "main" ]
|
|
# Make this callable as a reusable workflow
|
|
workflow_call:
|
|
outputs:
|
|
cache-key:
|
|
description: "The cache key for the built Z3 binary"
|
|
value: ${{ jobs.build-z3.outputs.cache-key }}
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build-z3:
|
|
name: "Build Z3 for caching"
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 90
|
|
outputs:
|
|
cache-key: ${{ steps.cache-key.outputs.key }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.x'
|
|
|
|
- name: Generate cache key
|
|
id: cache-key
|
|
run: |
|
|
# Create a cache key based on git SHA and relevant source files
|
|
echo "key=z3-build-${{ runner.os }}-${{ github.sha }}" >> $GITHUB_OUTPUT
|
|
echo "fallback-key=z3-build-${{ runner.os }}-" >> $GITHUB_OUTPUT
|
|
|
|
- name: Restore or create cache
|
|
id: cache-z3
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
build/z3
|
|
build/libz3.so
|
|
build/libz3.a
|
|
build/*.so
|
|
build/*.a
|
|
build/python
|
|
key: ${{ steps.cache-key.outputs.key }}
|
|
restore-keys: |
|
|
z3-build-${{ runner.os }}-
|
|
|
|
- name: Configure Z3
|
|
if: steps.cache-z3.outputs.cache-hit != 'true'
|
|
run: python scripts/mk_make.py
|
|
|
|
- name: Build Z3
|
|
if: steps.cache-z3.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd build
|
|
make -j$(nproc)
|
|
|
|
- name: Display build info
|
|
run: |
|
|
echo "Cache key: ${{ steps.cache-key.outputs.key }}"
|
|
echo "Build directory contents:"
|
|
ls -lh build/ || echo "Build directory not found"
|
|
if [ -f build/z3 ]; then
|
|
echo "Z3 version:"
|
|
build/z3 --version
|
|
fi
|