|
| 1 | +# TODO for the release after 0.28.0: pin a Roc nightly containing #12949, |
| 2 | +# remove this workflow, and retire the fixed-address musl startup patch. |
| 3 | +name: Static runtime compatibility |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | +permissions: {} |
| 8 | +jobs: |
| 9 | + native: |
| 10 | + permissions: |
| 11 | + contents: read |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + target: [x64musl, arm64musl, x64mac, arm64mac, x64win] |
| 16 | + compiler: [pinned, pie] |
| 17 | + include: |
| 18 | + - {target: x64musl, os: ubuntu-24.04} |
| 19 | + - {target: arm64musl, os: ubuntu-24.04-arm} |
| 20 | + - {target: x64mac, os: macos-26-intel} |
| 21 | + - {target: arm64mac, os: macos-26} |
| 22 | + - {target: x64win, os: windows-2025} |
| 23 | + runs-on: ${{ matrix.os }} |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v7 |
| 26 | + - uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f |
| 27 | + if: matrix.compiler == 'pie' |
| 28 | + with: |
| 29 | + version: 0.17.1 |
| 30 | + - uses: roc-lang/setup-roc@cbe782d6f165b89c87d99f50a59ac4f5f73b4427 |
| 31 | + if: matrix.compiler == 'pinned' |
| 32 | + with: |
| 33 | + version: nightly-new-compiler |
| 34 | + nightly-tag: nightly-2026-11-06-34f137a |
| 35 | + - uses: actions/checkout@v7 |
| 36 | + if: matrix.compiler == 'pie' |
| 37 | + with: |
| 38 | + repository: roc-lang/roc |
| 39 | + ref: c080bd1bc565531389f74444d3736d1bfb8e5352 |
| 40 | + path: target/roc-pie |
| 41 | + - uses: actions/cache@v5 |
| 42 | + if: matrix.compiler == 'pie' |
| 43 | + id: compiler-cache |
| 44 | + with: |
| 45 | + path: target/roc-pie/zig-out/bin |
| 46 | + key: roc-pie-${{ runner.os }}-${{ runner.arch }}-c080bd1bc565531389f74444d3736d1bfb8e5352-zig-0.17.1-strip |
| 47 | + - name: Build the pinned PIE compiler |
| 48 | + if: matrix.compiler == 'pie' && steps.compiler-cache.outputs.cache-hit != 'true' |
| 49 | + shell: bash |
| 50 | + working-directory: target/roc-pie |
| 51 | + run: zig build roc -Doptimize=ReleaseFast -Dstrip -j2 |
| 52 | + - name: Select the PIE compiler |
| 53 | + shell: bash |
| 54 | + if: matrix.compiler == 'pie' |
| 55 | + run: echo "ROC=$GITHUB_WORKSPACE/target/roc-pie/zig-out/bin/roc${{ runner.os == 'Windows' && '.exe' || '' }}" >> "$GITHUB_ENV" |
| 56 | + - uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f |
| 57 | + with: |
| 58 | + version: 0.17.0 |
| 59 | + - name: Install the platform Rust toolchain |
| 60 | + shell: bash |
| 61 | + run: | |
| 62 | + version=$(sed -n 's/^channel = "\(.*\)".*/\1/p' rust-toolchain.toml) |
| 63 | + rustup toolchain install "$version" --profile minimal --component llvm-tools-preview |
| 64 | + if [[ "$RUNNER_OS" == "Windows" ]]; then |
| 65 | + rustup component add rust-docs --toolchain "$version" |
| 66 | + fi |
| 67 | + - uses: ./.github/actions/linker-inputs-cache |
| 68 | + if: endsWith(matrix.target, 'musl') || matrix.target == 'x64win' |
| 69 | + with: |
| 70 | + target: ${{ matrix.target }} |
| 71 | + - name: Run native source, build, and execution checks |
| 72 | + run: python scripts/test.py --target ${{ matrix.target }} |
| 73 | + - name: Exercise development backend startup and callbacks |
| 74 | + if: endsWith(matrix.target, 'musl') |
| 75 | + shell: bash |
| 76 | + env: |
| 77 | + TARGET: ${{ matrix.target }} |
| 78 | + run: | |
| 79 | + mkdir -p dist/dev-compat |
| 80 | + compiler="${ROC:-roc}" |
| 81 | + "$compiler" build tests/tcp-server.roc --opt=dev --target="$TARGET" --output=dist/dev-compat/tcp-server |
| 82 | + dist/dev-compat/tcp-server > target/dev-tcp-server.log |
| 83 | + "$compiler" build tests/resource-lifetimes/resource-lifetime.roc --opt=dev --target="$TARGET" --output=dist/dev-compat/resources |
| 84 | + dist/dev-compat/resources |
| 85 | + python3 scripts/check_static_executables.py dist/dev-compat --format ${{ matrix.compiler }} |
| 86 | + - name: Verify executable format |
| 87 | + if: endsWith(matrix.target, 'musl') |
| 88 | + run: python3 scripts/check_static_executables.py dist/example-binaries/${{ matrix.target }} --format ${{ matrix.compiler }} |
0 commit comments