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*' workflow_dispatch: {} # dry-run the build matrix without tagging 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 shell: bash # 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 shell: bash - os: windows-latest target: x86_64-windows shell: msys2 {0} defaults: run: shell: ${{ matrix.shell }} 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 # --- Windows: MSYS2/MinGW-w64 toolchain + Chez built from source (ta6nt). # The whole job runs in the msys2 shell so cc/xxd/paths behave; the # produced joltc.exe is a plain Windows binary (no MSYS runtime dep). --- - name: Set up MSYS2 (Windows) if: runner.os == 'Windows' uses: msys2/setup-msys2@v2 with: msystem: MINGW64 update: false # inherit the runner PATH so GITHUB_PATH additions (the chez wrapper # dir) are visible inside the msys2 shell path-type: inherit install: >- git make vim unzip zip mingw-w64-x86_64-gcc mingw-w64-x86_64-lz4 mingw-w64-x86_64-zlib - name: Cache Chez Scheme (Windows) if: runner.os == 'Windows' id: cache-chez-win uses: actions/cache@v4 with: path: chez-install key: chez-${{ runner.os }}-v10.4.1-mingw64 - name: Build Chez Scheme from source (Windows) if: runner.os == 'Windows' && steps.cache-chez-win.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 --threads make -j"$(nproc)" # `make install` drives the unix installsh through cmd and dies; the # build tree has everything — assemble the layout by hand. Boot files # sit next to scheme.exe (that's where the Windows kernel looks). inst="$GITHUB_WORKSPACE/chez-install" mkdir -p "$inst/bin" "$inst/csv" cp ta6nt/bin/ta6nt/*.exe "$inst/bin/" cp ta6nt/bin/ta6nt/*.dll "$inst/bin/" 2>/dev/null || true cp ta6nt/boot/ta6nt/petite.boot ta6nt/boot/ta6nt/scheme.boot "$inst/bin/" cp ta6nt/boot/ta6nt/petite.boot ta6nt/boot/ta6nt/scheme.boot "$inst/csv/" cp ta6nt/boot/ta6nt/scheme.h "$inst/csv/" cp ta6nt/boot/ta6nt/equates.h "$inst/csv/" 2>/dev/null || true cp ta6nt/boot/ta6nt/libkernel.a "$inst/csv/" || { echo "libkernel.a not found:"; find ta6nt -name "*.a" -o -name "kernel*"; exit 1; } - name: Put chez on PATH (Windows) if: runner.os == 'Windows' run: | bindir="$GITHUB_WORKSPACE/chez-install/bin" { echo '#!/bin/sh'; echo "exec \"$bindir/scheme.exe\" \"\$@\""; } > "$bindir/chez" chmod +x "$bindir/chez" echo "$bindir" >> "$GITHUB_PATH" echo "JOLT_CHEZ_CSV=$GITHUB_WORKSPACE/chez-install/csv" >> "$GITHUB_ENV" # cc is the build's compiler name; alias it to mingw gcc { echo '#!/bin/sh'; echo 'exec gcc "$@"'; } > "$bindir/cc" chmod +x "$bindir/cc" - 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 README.md LICENSE "dist/${name}/" if [ "${{ runner.os }}" = "Windows" ]; then cp target/release/joltc.exe "dist/${name}/joltc.exe" ( cd dist && zip -r "${name}.zip" "${name}" && sha256sum "${name}.zip" > "${name}.zip.sha256" ) else cp target/release/joltc "dist/${name}/joltc" tar -C dist -czf "dist/${name}.tar.gz" "${name}" ( cd dist && shasum -a 256 "${name}.tar.gz" > "${name}.tar.gz.sha256" ) fi ls -la dist - name: Upload to the GitHub Release if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v2 with: files: | dist/*.tar.gz dist/*.tar.gz.sha256 dist/*.zip dist/*.zip.sha256 fail_on_unmatched_files: false