name: CI on: push: branches: [ "**" ] pull_request: branches: [ "**" ] workflow_dispatch: permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true # This workflow migrates jobs from azure-pipelines.yml to GitHub Actions. # See .github/workflows/CI_MIGRATION.md for details on the migration. jobs: # ============================================================================ # Linux Python Debug Builds # ============================================================================ linux-python-debug: name: "Ubuntu build - python make - ${{ matrix.variant }}" runs-on: ubuntu-latest timeout-minutes: 90 strategy: fail-fast: false matrix: variant: [MT, ST] include: - variant: MT cmdLine: 'python scripts/mk_make.py -d --java --dotnet' runRegressions: true - variant: ST cmdLine: './configure --single-threaded' runRegressions: false steps: - name: Checkout code uses: actions/checkout@v6.0.2 - name: Setup Python uses: actions/setup-python@v6 with: python-version: '3.x' - name: Configure run: ${{ matrix.cmdLine }} - name: Build run: | set -e cd build make -j3 make -j3 examples make -j3 test-z3 cd .. - name: Run unit tests run: | cd build ./test-z3 -a cd .. - name: Clone z3test if: matrix.runRegressions run: git clone https://github.com/z3prover/z3test z3test - name: Run regressions if: matrix.runRegressions run: python z3test/scripts/test_benchmarks.py build/z3 z3test/regressions/smt2 # ============================================================================ # Manylinux Python Builds # ============================================================================ manylinux-python-amd64: name: "Python bindings (manylinux Centos AMD64) build" runs-on: ubuntu-latest timeout-minutes: 90 container: "quay.io/pypa/manylinux_2_34_x86_64:latest" steps: - name: Checkout code uses: actions/checkout@v6.0.2 - name: Setup Python virtual environment run: "/opt/python/cp38-cp38/bin/python -m venv $PWD/env" - name: Install build dependencies run: | source $PWD/env/bin/activate pip install build git+https://github.com/rhelmot/auditwheel - name: Build Python wheel run: | source $PWD/env/bin/activate cd src/api/python python -m build AUDITWHEEL_PLAT= auditwheel repair --best-plat dist/*.whl cd ../../.. - name: Test Python wheel run: | source $PWD/env/bin/activate pip install ./src/api/python/wheelhouse/*.whl python - x86_64 target) # ============================================================================ macos-jni-cross-compile: name: "MacOS JNI cross-compile (ARM64 -> x64) architecture validation" runs-on: macos-15 timeout-minutes: 90 steps: - name: Checkout code uses: actions/checkout@v6.0.2 - name: Setup Python uses: actions/setup-python@v6 with: python-version: '3.x' - name: Configure (cross-compile ARM64 host -> x86_64 target) run: | CXXFLAGS="-arch x86_64" CFLAGS="-arch x86_64" LDFLAGS="-arch x86_64" \ python scripts/mk_make.py --java --arm64=false - name: Build run: | set -e cd build make -j3 libz3java.dylib cd .. - name: Validate libz3java.dylib is x86_64 run: | echo "Checking libz3java.dylib architecture..." ARCH=$(lipo -archs build/libz3java.dylib) echo "libz3java.dylib architecture: $ARCH" if [ "$ARCH" != "x86_64" ]; then echo "ERROR: Expected x86_64 (cross-compiled target), got: $ARCH" echo "This is the regression fixed in: JNI bindings use wrong architecture in macOS cross-compilation" exit 1 fi echo "OK: libz3java.dylib correctly built for x86_64 target on ARM64 host" # ============================================================================ # Python script unit tests (build-script logic validation) # ============================================================================ python-script-tests: name: "Python build-script unit tests" runs-on: ubuntu-latest timeout-minutes: 10 steps: - name: Checkout code uses: actions/checkout@v6.0.2 - name: Setup Python uses: actions/setup-python@v6 with: python-version: '3.x' - name: Run Python script unit tests working-directory: ${{ github.workspace }} run: python -m unittest discover -s scripts/tests -p "test_*.py" -v # ============================================================================ # macOS CMake Builds # ============================================================================ macos-cmake: name: "MacOS build with CMake" runs-on: macos-latest timeout-minutes: 90 steps: - name: Checkout code uses: actions/checkout@v6.0.2 - name: Setup Python uses: actions/setup-python@v6 with: python-version: '3.x' - name: Install dependencies run: | brew install ninja brew install --cask julia - name: Configure run: | julia -e "using Pkg; Pkg.add(PackageSpec(name=\"libcxxwrap_julia_jll\"))" JlCxxDir=$(julia -e "using libcxxwrap_julia_jll; println(joinpath(dirname(libcxxwrap_julia_jll.libcxxwrap_julia_path), \"cmake\", \"JlCxx\"))") set -e mkdir build cd build cmake -DJlCxx_DIR=$JlCxxDir -DZ3_BUILD_JULIA_BINDINGS=True -DZ3_BUILD_JAVA_BINDINGS=True -DZ3_BUILD_PYTHON_BINDINGS=True -DZ3_BUILD_DOTNET_BINDINGS=False -G "Ninja" ../ cd .. - name: Build run: | cd build ninja ninja test-z3 cd .. - name: Run unit tests run: | cd build ./test-z3 -a cd .. - name: Clone z3test run: git clone https://github.com/z3prover/z3test z3test - name: Run regressions run: python z3test/scripts/test_benchmarks.py build/z3 z3test/regressions/smt2