|
| 1 | +name: Compiler build (reusable) |
| 2 | + |
| 3 | +# Reusable: compile the MiniZinc compiler for ONE platform against the pinned |
| 4 | +# minizinc-vendor release (vendor.lock) and upload it as the `minizinc-<platform>` |
| 5 | +# artifact. Called by ci.yml (matrixed over all platforms) and benchmark.yml |
| 6 | +# (linux only). Not triggered directly. |
| 7 | +# |
| 8 | +# Same build model as minizinc-vendor: glibc-linux builds run in a manylinux |
| 9 | +# container (low glibc floor), musl in alpine, osx/win64 natively. A per-platform |
| 10 | +# `setup` installs whatever the bare base image lacks, then scripts/build.sh runs. |
| 11 | + |
| 12 | +on: |
| 13 | + workflow_call: |
| 14 | + inputs: |
| 15 | + platform: { type: string, required: true } |
| 16 | + triple: { type: string, required: true } |
| 17 | + runner: { type: string, required: true } |
| 18 | + container: { type: string, default: "" } |
| 19 | + setup: { type: string, default: "" } # deps to install in the container |
| 20 | + generator: { type: string, default: "Ninja" } # manylinux -> "Unix Makefiles" |
| 21 | + |
| 22 | +permissions: |
| 23 | + contents: read |
| 24 | + |
| 25 | +env: |
| 26 | + # Lets `gh release download` read minizinc-vendor's (public) releases. |
| 27 | + GH_TOKEN: ${{ github.token }} |
| 28 | + |
| 29 | +jobs: |
| 30 | + build: |
| 31 | + runs-on: ${{ inputs.runner }} |
| 32 | + name: build |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v7 |
| 35 | + |
| 36 | + # TODO: re-add `cbc` (fetch here + -DOsiCBC_ROOT in scripts/build.sh) once |
| 37 | + # cbc:win64 is fixed and CBC is reactivated in minizinc-vendor. |
| 38 | + - name: Fetch pinned vendor deps (gecode) |
| 39 | + shell: bash |
| 40 | + run: bash scripts/fetch_vendor.sh ${{ inputs.triple }} gecode |
| 41 | + |
| 42 | + - name: Set up MSVC (win64) |
| 43 | + if: startsWith(inputs.platform, 'win64') |
| 44 | + uses: ilammy/msvc-dev-cmd@v1 |
| 45 | + with: |
| 46 | + arch: ${{ inputs.platform == 'win64-arm' && 'arm64' || 'x64' }} |
| 47 | + |
| 48 | + - name: Configure & build |
| 49 | + shell: bash |
| 50 | + env: |
| 51 | + # MSVC reports __cplusplus as 199711L unless asked not to, so Gecode's |
| 52 | + # bundled Boost cannot pick a rounding-control implementation on ARM64, |
| 53 | + # where its x86/x64 paths do not apply. minizinc-vendor builds Gecode |
| 54 | + # itself with the same flag. |
| 55 | + CXXFLAGS: ${{ inputs.platform == 'win64-arm' && '/Zc:__cplusplus' || '' }} |
| 56 | + run: | |
| 57 | + set -eux |
| 58 | + SETUP='${{ inputs.setup }}' |
| 59 | + if [ -n "${{ inputs.container }}" ]; then |
| 60 | + docker run --rm -v "$PWD:/work" -w /work \ |
| 61 | + -e ROOT=/work \ |
| 62 | + -e CMAKE_GENERATOR="${{ inputs.generator }}" \ |
| 63 | + -e BUILD_REF="${{ github.run_id }}" \ |
| 64 | + "${{ inputs.container }}" \ |
| 65 | + sh -c "${SETUP}${SETUP:+ && }bash scripts/build.sh" |
| 66 | + else |
| 67 | + ROOT="$PWD" \ |
| 68 | + CMAKE_GENERATOR="${{ inputs.generator }}" \ |
| 69 | + BUILD_REF="${{ github.run_id }}" \ |
| 70 | + bash scripts/build.sh |
| 71 | + fi |
| 72 | +
|
| 73 | + # Catches the deployment target silently following the runner image. |
| 74 | + - name: Check macOS deployment target |
| 75 | + if: inputs.platform == 'osx' |
| 76 | + shell: bash |
| 77 | + run: vtool -show-build minizinc/bin/minizinc | grep -w "minos 12.0" |
| 78 | + |
| 79 | + # Archived here, not uploaded as a tree: artifacts do not preserve the |
| 80 | + # executable bit, so a bare tree arrives unrunnable and every consumer has |
| 81 | + # to chmod it back. This tarball is also exactly what the release ships, so |
| 82 | + # it is built once and never repacked. |
| 83 | + - name: Archive |
| 84 | + shell: bash |
| 85 | + run: tar -czf "minizinc-compiler-only-${{ inputs.triple }}.tar.gz" -C minizinc . |
| 86 | + |
| 87 | + - uses: actions/upload-artifact@v7 |
| 88 | + with: |
| 89 | + name: minizinc-${{ inputs.platform }} |
| 90 | + path: minizinc-compiler-only-${{ inputs.triple }}.tar.gz |
0 commit comments