byte/short/int/long/char silently wrapped or passed out-of-range values through; the JVM range-checks (RT.byteCast family). One checked-cast helper now carries the ranges: a double range-checks ITSELF before truncating ((byte 1.1) is 1, (byte 127.000001) throws), NaN casts to 0, ratios and bigdecs truncate, a non-number is CCE, and the throw carries the JVM message. float range-checks against Float/MAX_VALUE. The unchecked-* casts now genuinely wrap and sign-fold ((unchecked-byte 200) is -56 — the old bit-and lost the sign) with doubles saturating like Java's conversions; unchecked-long/int are host natives. double/float of a bigdec convert instead of crashing. The no-single-float residue stays accepted (SPEC.md). Also fixes #290: a binary built by the SELF-CONTAINED joltc died with 'variable var-deref is not bound' when a namespace loaded at runtime. The in-process build compiled flat.ss against a clean copy-environment, which orphans every top-level define in locations the binary's runtime eval can't see. It now compiles against the default interaction environment (defines land in the real symbol cells, same as the legacy fresh-Chez path) and a generated prologue pre-binds each kernel name the runtime redefines to its kernel value, so the earliest boot reads match the legacy path's primitive references. requiring-resolve is implemented (the issue's dynamic-require pattern), and the release workflow smokes a runtime require in a built binary. Cast namespaces byte/short/int/long/char now fully clean; cts baseline 5805 -> 5857 pass, 67 baselined namespaces. 7 JVM-certified corpus rows.
147 lines
6.2 KiB
YAML
147 lines
6.2 KiB
YAML
name: release
|
|
|
|
# Build the self-contained joltc binary for each platform and attach it to the
|
|
# GitHub Release when a v* tag is pushed. The binary bundles the runtime,
|
|
# compiler, jolt-core + stdlib source, the Chez boots, and a launcher stub, so it
|
|
# runs AND compiles jolt apps with no Chez or cc on the user's machine (jolt-eaj).
|
|
#
|
|
# No Apple notarization, mirroring dirge: macOS users who download the tarball
|
|
# clear Gatekeeper quarantine once (`xattr -d com.apple.quarantine joltc`), or
|
|
# install via a Homebrew tap that de-quarantines on install.
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
permissions:
|
|
contents: write # create/update the GitHub Release and upload assets
|
|
|
|
jobs:
|
|
build:
|
|
name: build ${{ matrix.target }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
target: x86_64-linux
|
|
# No x86_64-macos: GitHub is retiring the macos-13 Intel runner (jobs
|
|
# queue forever). Intel Macs build from source. macos-14 is arm64.
|
|
- os: macos-14
|
|
target: aarch64-macos
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
submodules: recursive # vendor/irregex, used by the Chez regex shim
|
|
|
|
# --- Linux: build Chez from source. The apt chezscheme ships petite+scheme
|
|
# only, with no kernel dev files (libkernel.a, scheme.h), which build-joltc
|
|
# needs to cc-link. Same setup as .github/workflows/tests.yml. ---
|
|
- name: Install build dependencies (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential git liblz4-dev zlib1g-dev libncurses-dev uuid-dev
|
|
|
|
- name: Cache Chez Scheme (Linux)
|
|
if: runner.os == 'Linux'
|
|
id: cache-chez
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: /opt/chez
|
|
key: chez-${{ runner.os }}-v10.4.1-x11off
|
|
|
|
- name: Build Chez Scheme from source (Linux)
|
|
if: runner.os == 'Linux' && steps.cache-chez.outputs.cache-hit != 'true'
|
|
run: |
|
|
git clone --depth 1 --branch v10.4.1 https://github.com/cisco/ChezScheme.git /tmp/chez-src
|
|
cd /tmp/chez-src
|
|
./configure --installprefix=/opt/chez --threads --disable-x11
|
|
make -j"$(nproc)"
|
|
sudo make install
|
|
sudo chown -R "$USER" /opt/chez
|
|
|
|
- name: Put chez on PATH (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
# Installed as `scheme`; the build invokes `chez`. A wrapper that execs
|
|
# scheme keeps argv0 so Chez finds its boot files, and sits next to
|
|
# scheme so build.ss derives the csv dir (libkernel.a/scheme.h) from it.
|
|
printf '#!/bin/sh\nexec /opt/chez/bin/scheme "$@"\n' > /opt/chez/bin/chez
|
|
chmod +x /opt/chez/bin/chez
|
|
echo '/opt/chez/bin' >> "$GITHUB_PATH"
|
|
|
|
# --- macOS: Homebrew chezscheme ships `chez` plus the csv kernel dev files
|
|
# (libkernel.a, scheme.h, *.boot), which is all build-joltc needs. ---
|
|
- name: Install Chez Scheme (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: brew install chezscheme lz4
|
|
|
|
- name: Show Chez version
|
|
run: chez --version
|
|
|
|
# build-joltc compiles in a fresh Chez and cc-links; the checked-in seed is
|
|
# the compiler image, so no selfhost re-mint (that byte-fixpoint is a
|
|
# dev-machine check — see jolt-8479). `make joltc-release`, not `make joltc`.
|
|
- name: Build joltc (release)
|
|
run: make joltc-release
|
|
|
|
# Sanity: the built binary runs (no Chez needed) and self-reports a value.
|
|
- name: Smoke the binary
|
|
run: |
|
|
out="$(./target/release/joltc -e '(reduce + (range 10))')"
|
|
test "$out" = "45" || { echo "joltc -e gave '$out', want 45"; exit 1; }
|
|
|
|
# The binary is a self-contained COMPILER: it must `build` an app with no
|
|
# jolt source on disk. Run from an isolated dir (nothing but the tiny app)
|
|
# so a build that reaches for host/chez/*.ss on the filesystem fails here,
|
|
# not on a user's machine.
|
|
- name: Smoke a self-contained build
|
|
run: |
|
|
joltc="$(pwd)/target/release/joltc"
|
|
work="$(mktemp -d)"
|
|
mkdir -p "$work/app/src/app"
|
|
printf '{:paths ["src"]}\n' > "$work/app/deps.edn"
|
|
printf '(ns app.core)\n(defn -main [& _] (println "built:" (reduce + (range 10))))\n' \
|
|
> "$work/app/src/app/core.clj"
|
|
( cd "$work/app" && "$joltc" build -m app.core -o app )
|
|
out="$("$work/app/app")"
|
|
test "$out" = "built: 45" || { echo "self-contained build ran '$out', want 'built: 45'"; exit 1; }
|
|
|
|
# A built binary must also run the DYNAMIC require path: a namespace not
|
|
# in the static ns graph compiles from the source roots at runtime, so the
|
|
# boot's top-level defines must be visible to the runtime compiler's eval
|
|
# (issue #290: this died with "variable var-deref is not bound").
|
|
- name: Smoke a runtime require in a built binary
|
|
run: |
|
|
joltc="$(pwd)/target/release/joltc"
|
|
work="$(mktemp -d)"
|
|
mkdir -p "$work/app/src/app"
|
|
printf '{:paths ["src"]}\n' > "$work/app/deps.edn"
|
|
printf '(ns app.extra)\n(defn greet [s] (str "Hello, " s "!"))\n' \
|
|
> "$work/app/src/app/extra.clj"
|
|
printf '(ns app.core)\n(defn -main [& _]\n (println ((requiring-resolve (quote app.extra/greet)) "runtime")))\n' \
|
|
> "$work/app/src/app/core.clj"
|
|
( cd "$work/app" && "$joltc" build -m app.core -o app )
|
|
out="$(cd "$work/app" && ./app)"
|
|
test "$out" = "Hello, runtime!" || { echo "runtime require ran '$out', want 'Hello, runtime!'"; exit 1; }
|
|
|
|
- name: Package
|
|
run: |
|
|
ver="${GITHUB_REF_NAME}"
|
|
name="joltc-${ver}-${{ matrix.target }}"
|
|
mkdir -p "dist/${name}"
|
|
cp target/release/joltc "dist/${name}/joltc"
|
|
cp README.md LICENSE "dist/${name}/"
|
|
tar -C dist -czf "dist/${name}.tar.gz" "${name}"
|
|
( cd dist && shasum -a 256 "${name}.tar.gz" > "${name}.tar.gz.sha256" )
|
|
ls -la dist
|
|
|
|
- name: Upload to the GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: |
|
|
dist/*.tar.gz
|
|
dist/*.tar.gz.sha256
|
|
fail_on_unmatched_files: true
|