Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

ci(release): native per-platform build matrix for tree-sitter 0.25 (#259)

Joseph Mikhail8c61249872a0
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 3da0655f..3641af55 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -4,10 +4,17 @@ name: Release
# Triggered by pushing a version tag: git tag v0.3.0 && git push origin v0.3.0
#
# What it does (in order):
-# 1. Builds the TypeScript CLI
-# 2. Packages CLI tarballs for linux, macOS (amd64+arm64), Windows
+# 1. Builds System Compass once (platform-independent static bundle)
+# 2. Builds + packages a CLI tarball PER PLATFORM on a NATIVE runner, so each
+# tarball's node_modules contains binaries compiled for that platform/arch
# 3. Creates a GitHub Release with all assets + install instructions
-# 4. Updates the Homebrew formula with the new SHA and commits it
+# 4. Updates the Homebrew formula with the new SHA and opens a PR
+#
+# Why native per-platform builds:
+# node-tree-sitter 0.25 ships NO prebuilds and is compiled from source at
+# `npm ci`. Packaging all platforms from one amd64 runner would copy a single
+# linux-x64 core binary into every tarball, breaking the CLI on macOS, Windows
+# and linux-arm64. Each platform must build its own native binding.
#
# Note: The Scala backend (memory-layer) is built and released separately
# from the private ix-memory-layer repo. Docker images are pushed to
@@ -23,25 +30,82 @@ on:
tag:
description: "Tag to release (e.g. v0.4.9)"
required: true
+ dry_run:
+ description: "Build + package on all platforms only; skip publishing the release and the Homebrew PR"
+ type: boolean
+ default: false
permissions:
contents: write
pull-requests: write
jobs:
- build-and-release:
+ # ── 1. Build System Compass once (platform-independent) ───────────────────
+ compass:
runs-on: ubuntu-latest
- env:
- # node-tree-sitter 0.25 is compiled from source; node 24's V8 headers need C++20.
- CXXFLAGS: "-std=c++20"
- CXX: "g++ -std=c++20"
+ steps:
+ - name: Set up Node.js
+ uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
+ with:
+ node-version: "22.14"
+
+ - name: Build System Compass
+ continue-on-error: true
+ env:
+ COMPASS_TOKEN: ${{ secrets.COMPASS_TOKEN }}
+ run: |
+ mkdir -p compass-dist
+ if [ -z "$COMPASS_TOKEN" ]; then
+ echo "COMPASS_TOKEN not set — skipping compass build (tarballs ship without compass)"
+ exit 0
+ fi
+ git clone https://x-access-token:${COMPASS_TOKEN}@github.com/ix-infrastructure/system-compass.git
+ cd system-compass
+ npm ci --legacy-peer-deps
+ npm run build
+ if [ ! -f dist/index.html ]; then
+ echo "::error::Compass build did not produce dist/index.html"
+ exit 1
+ fi
+ cp -r dist/* "$GITHUB_WORKSPACE/compass-dist/"
+ - name: Upload compass bundle
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
+ with:
+ name: compass-dist
+ path: compass-dist
+ include-hidden-files: true
+ retention-days: 1
+
+ # ── 2. Build + package one tarball per platform on a native runner ────────
+ build:
+ name: Package (${{ matrix.target }})
+ needs: compass
+ runs-on: ${{ matrix.runner }}
+ strategy:
+ fail-fast: false
+ matrix:
+ # Intel macOS (darwin-amd64 / macos-13) is intentionally omitted: those
+ # runners are being retired and queue indefinitely, which would stall the
+ # release job (it waits on every build leg). Apple-Silicon macOS covers
+ # current Macs. Re-add a `darwin-amd64` entry if/when macos-13 is reliable.
+ include:
+ - target: linux-amd64
+ runner: ubuntu-latest
+ - target: linux-arm64
+ runner: ubuntu-24.04-arm
+ - target: darwin-arm64
+ runner: macos-14
+ - target: windows-amd64
+ runner: windows-latest
+ defaults:
+ run:
+ shell: bash
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from tag
id: version
@@ -49,7 +113,6 @@ jobs:
TAG="${{ github.event.inputs.tag || github.ref_name }}"
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
- # ── 1. Build CLI ────────────────────────────────────────────────────
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
@@ -57,7 +120,10 @@ jobs:
cache: "npm"
cache-dependency-path: ix-cli/package-lock.json
- - name: Build core-ingestion
+ # node-tree-sitter 0.25's binding.gyp self-specifies C++17 on every
+ # platform; node 22's V8 headers compile that cleanly with no override.
+ # (The C++20 flag in ci.yml exists only because CI runs node 24.)
+ - name: Build core-ingestion (native compile)
working-directory: core-ingestion
run: npm ci --silent
@@ -68,106 +134,87 @@ jobs:
npm run build
npm version "${{ steps.version.outputs.version }}" --no-git-tag-version --allow-same-version
- # ── 1b. Build System Compass (optional — needs COMPASS_TOKEN secret) ─
- - name: Build System Compass
+ # Compass is best-effort (only built when COMPASS_TOKEN is set); never let a
+ # missing/empty compass artifact block a platform build.
+ - name: Download compass bundle
continue-on-error: true
- env:
- COMPASS_TOKEN: ${{ secrets.COMPASS_TOKEN }}
- run: |
- if [ -z "$COMPASS_TOKEN" ]; then
- echo "COMPASS_TOKEN not set — skipping compass build"
- exit 0
- fi
- git clone https://x-access-token:${COMPASS_TOKEN}@github.com/ix-infrastructure/system-compass.git
- cd system-compass
- npm ci --legacy-peer-deps
- npm run build
- # Verify the build produced output
- if [ ! -f dist/index.html ]; then
- echo "::error::Compass build did not produce dist/index.html"
- exit 1
- fi
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
+ with:
+ name: compass-dist
+ path: compass-dist
- # ── 2. Package CLI tarballs ─────────────────────────────────────────
- - name: Package CLI (linux-amd64)
+ - name: Package CLI (${{ matrix.target }})
run: |
- STAGING="ix-${{ steps.version.outputs.version }}-linux-amd64"
+ VERSION="${{ steps.version.outputs.version }}"
+ STAGING="ix-${VERSION}-${{ matrix.target }}"
+ # Compute the checksum with node (always present on every runner);
+ # `shasum` is missing from the bash shell on GitHub's Windows image.
+ sha256file() {
+ node -e "const c=require('crypto'),f=require('fs'),p=process.argv[1];process.stdout.write(c.createHash('sha256').update(f.readFileSync(p)).digest('hex')+' '+p+'\n')" "$1"
+ }
mkdir -p "$STAGING/cli" "$STAGING/core-ingestion" "$STAGING/compass"
cp -rL ix-cli/dist ix-cli/node_modules ix-cli/package.json "$STAGING/cli/"
cp -rL core-ingestion/dist core-ingestion/node_modules core-ingestion/package.json "$STAGING/core-ingestion/"
- [ -d system-compass/dist ] && cp -r system-compass/dist/* "$STAGING/compass/" || true
- cat > "$STAGING/ix" <<'WRAPPER'
- #!/bin/sh
- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
- exec node "$SCRIPT_DIR/cli/dist/cli/main.js" "$@"
+ if [ -f compass-dist/index.html ]; then
+ cp -r compass-dist/* "$STAGING/compass/"
+ fi
+ if [ "${{ runner.os }}" = "Windows" ]; then
+ cat > "$STAGING/ix.cmd" <<'WRAPPER'
+ @echo off
+ node "%~dp0cli\dist\cli\main.js" %*
WRAPPER
- chmod +x "$STAGING/ix"
- tar -czf "$STAGING.tar.gz" "$STAGING"
- shasum -a 256 "$STAGING.tar.gz" > "$STAGING.tar.gz.sha256"
-
- - name: Package CLI (linux-arm64)
- run: |
- STAGING="ix-${{ steps.version.outputs.version }}-linux-arm64"
- mkdir -p "$STAGING/cli" "$STAGING/core-ingestion" "$STAGING/compass"
- cp -rL ix-cli/dist ix-cli/node_modules ix-cli/package.json "$STAGING/cli/"
- cp -rL core-ingestion/dist core-ingestion/node_modules core-ingestion/package.json "$STAGING/core-ingestion/"
- [ -d system-compass/dist ] && cp -r system-compass/dist/* "$STAGING/compass/" || true
- cat > "$STAGING/ix" <<'WRAPPER'
+ 7z a -tzip "$STAGING.zip" "$STAGING" >/dev/null
+ sha256file "$STAGING.zip" > "$STAGING.zip.sha256"
+ else
+ cat > "$STAGING/ix" <<'WRAPPER'
#!/bin/sh
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
exec node "$SCRIPT_DIR/cli/dist/cli/main.js" "$@"
WRAPPER
- chmod +x "$STAGING/ix"
- tar -czf "$STAGING.tar.gz" "$STAGING"
- shasum -a 256 "$STAGING.tar.gz" > "$STAGING.tar.gz.sha256"
+ chmod +x "$STAGING/ix"
+ tar -czf "$STAGING.tar.gz" "$STAGING"
+ sha256file "$STAGING.tar.gz" > "$STAGING.tar.gz.sha256"
+ fi
- - name: Package CLI (darwin-amd64)
- run: |
- STAGING="ix-${{ steps.version.outputs.version }}-darwin-amd64"
- mkdir -p "$STAGING/cli" "$STAGING/core-ingestion" "$STAGING/compass"
- cp -rL ix-cli/dist ix-cli/node_modules ix-cli/package.json "$STAGING/cli/"
- cp -rL core-ingestion/dist core-ingestion/node_modules core-ingestion/package.json "$STAGING/core-ingestion/"
- [ -d system-compass/dist ] && cp -r system-compass/dist/* "$STAGING/compass/" || true
- cat > "$STAGING/ix" <<'WRAPPER'
- #!/bin/sh
- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
- exec node "$SCRIPT_DIR/cli/dist/cli/main.js" "$@"
- WRAPPER
- chmod +x "$STAGING/ix"
- tar -czf "$STAGING.tar.gz" "$STAGING"
- shasum -a 256 "$STAGING.tar.gz" > "$STAGING.tar.gz.sha256"
+ - name: Upload tarball
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
+ with:
+ name: ix-${{ matrix.target }}
+ path: |
+ ix-*-${{ matrix.target }}.tar.gz
+ ix-*-${{ matrix.target }}.tar.gz.sha256
+ ix-*-${{ matrix.target }}.zip
+ ix-*-${{ matrix.target }}.zip.sha256
+ if-no-files-found: error
+ retention-days: 1
- - name: Package CLI (darwin-arm64)
- run: |
- STAGING="ix-${{ steps.version.outputs.version }}-darwin-arm64"
- mkdir -p "$STAGING/cli" "$STAGING/core-ingestion" "$STAGING/compass"
- cp -rL ix-cli/dist ix-cli/node_modules ix-cli/package.json "$STAGING/cli/"
- cp -rL core-ingestion/dist core-ingestion/node_modules core-ingestion/package.json "$STAGING/core-ingestion/"
- [ -d system-compass/dist ] && cp -r system-compass/dist/* "$STAGING/compass/" || true
- cat > "$STAGING/ix" <<'WRAPPER'
- #!/bin/sh
- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
- exec node "$SCRIPT_DIR/cli/dist/cli/main.js" "$@"
- WRAPPER
- chmod +x "$STAGING/ix"
- tar -czf "$STAGING.tar.gz" "$STAGING"
- shasum -a 256 "$STAGING.tar.gz" > "$STAGING.tar.gz.sha256"
+ # ── 3 + 4. Collect artifacts, create the Release, update Homebrew ─────────
+ # Skipped entirely on a dry run: the build matrix above still validates every
+ # platform's native compile + packaging, but nothing is published.
+ release:
+ needs: build
+ if: ${{ !inputs.dry_run }}
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ with:
+ fetch-depth: 0
+ token: ${{ secrets.GITHUB_TOKEN }}
- - name: Package CLI (windows-amd64)
+ - name: Extract version from tag
+ id: version
run: |
- STAGING="ix-${{ steps.version.outputs.version }}-windows-amd64"
- mkdir -p "$STAGING/cli" "$STAGING/core-ingestion" "$STAGING/compass"
- cp -rL ix-cli/dist ix-cli/node_modules ix-cli/package.json "$STAGING/cli/"
- cp -rL core-ingestion/dist core-ingestion/node_modules core-ingestion/package.json "$STAGING/core-ingestion/"
- [ -d system-compass/dist ] && cp -r system-compass/dist/* "$STAGING/compass/" || true
- cat > "$STAGING/ix.cmd" <<'WRAPPER'
- @echo off
- node "%~dp0cli\dist\cli\main.js" %*
- WRAPPER
- zip -r "$STAGING.zip" "$STAGING"
- shasum -a 256 "$STAGING.zip" > "$STAGING.zip.sha256"
+ TAG="${{ github.event.inputs.tag || github.ref_name }}"
+ echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
+
+ - name: Download all platform tarballs
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
+ with:
+ path: _artifacts
+ pattern: ix-*
+ merge-multiple: true
- # ── 3. Create GitHub Release ────────────────────────────────────────
- name: Create Release
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
with:
@@ -195,18 +242,11 @@ jobs:
docker pull ghcr.io/ix-infrastructure/ix-memory-layer:latest
```
files: |
- ix-${{ steps.version.outputs.version }}-linux-amd64.tar.gz
- ix-${{ steps.version.outputs.version }}-linux-amd64.tar.gz.sha256
- ix-${{ steps.version.outputs.version }}-linux-arm64.tar.gz
- ix-${{ steps.version.outputs.version }}-linux-arm64.tar.gz.sha256
- ix-${{ steps.version.outputs.version }}-darwin-amd64.tar.gz
- ix-${{ steps.version.outputs.version }}-darwin-amd64.tar.gz.sha256
- ix-${{ steps.version.outputs.version }}-darwin-arm64.tar.gz
- ix-${{ steps.version.outputs.version }}-darwin-arm64.tar.gz.sha256
- ix-${{ steps.version.outputs.version }}-windows-amd64.zip
- ix-${{ steps.version.outputs.version }}-windows-amd64.zip.sha256
-
- # ── 4. Update Homebrew formula via PR ──────────────────────────────
+ _artifacts/*.tar.gz
+ _artifacts/*.tar.gz.sha256
+ _artifacts/*.zip
+ _artifacts/*.zip.sha256
+
- name: Update Homebrew formula
continue-on-error: true
env: