update npm versioning, build.sh and delete tcl.ref and fix to latest stable
This commit is contained in:
parent
8e70cbffc8
commit
a7cb1f9a6e
|
|
@ -5,7 +5,7 @@ name: CI-wasm
|
||||||
# when a release tag of the form v<x.y.z>... is pushed — that gate is the
|
# when a release tag of the form v<x.y.z>... is pushed — that gate is the
|
||||||
# manual release trigger:
|
# manual release trigger:
|
||||||
#
|
#
|
||||||
# # bump magic/VERSION and/or npm/tcl.ref, commit, push to default branch
|
# # bump magic/VERSION, commit, push to default branch
|
||||||
# git tag v8.3.638
|
# git tag v8.3.638
|
||||||
# git push origin v8.3.638
|
# git push origin v8.3.638
|
||||||
#
|
#
|
||||||
|
|
@ -21,6 +21,14 @@ on:
|
||||||
description: 'emsdk version to build with (default: latest; pin a version number to bisect)'
|
description: 'emsdk version to build with (default: latest; pin a version number to bisect)'
|
||||||
type: string
|
type: string
|
||||||
default: 'latest'
|
default: 'latest'
|
||||||
|
tcl_ref:
|
||||||
|
description: 'TCL ref to build against (default: auto-resolve latest stable tag). Use a tag like core-9-0-3, a branch, or a commit SHA to bisect a regression.'
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
|
tcl_repo_url:
|
||||||
|
description: 'TCL repository URL (default: https://github.com/tcltk/tcl.git)'
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
dry_run:
|
dry_run:
|
||||||
description: 'Dry run: pack only, do not publish even on tag pushes'
|
description: 'Dry run: pack only, do not publish even on tag pushes'
|
||||||
type: boolean
|
type: boolean
|
||||||
|
|
@ -73,23 +81,56 @@ jobs:
|
||||||
echo "===== emcc -dM -E - ====="; echo | emcc -dM -E - | sort
|
echo "===== emcc -dM -E - ====="; echo | emcc -dM -E - | sort
|
||||||
echo "===== em++ -dM -E - ====="; echo | em++ -dM -E - | sort
|
echo "===== em++ -dM -E - ====="; echo | em++ -dM -E - | sort
|
||||||
|
|
||||||
# Clone tcltk/tcl into a sibling directory at the pinned ref from
|
# Determine which TCL ref to build against.
|
||||||
# npm/tcl.ref. npm/build.sh would do this on its own, but doing it as
|
# Priority: workflow_dispatch input > auto-resolved latest stable tag.
|
||||||
# an explicit step makes the resolved SHA visible at the top of the
|
# TCL stable releases follow the core-<major>-<even_minor>-<patch>
|
||||||
# job log and keeps the build step's output focused on the C build.
|
# naming convention; core-9-0-x is the current stable series.
|
||||||
# The TCL source tree is treated as read-only — the actual WASM build
|
# Falls back to main only if no release tags are found at all.
|
||||||
# runs inside magic (toolchains/emscripten/build-tcl-wasm.sh).
|
- name: Resolve TCL ref
|
||||||
- name: Pin and clone tcltk/tcl
|
id: resolve-tcl
|
||||||
|
env:
|
||||||
|
TCL_REPO_URL: ${{ github.event.inputs.tcl_repo_url || 'https://github.com/tcltk/tcl.git' }}
|
||||||
|
TCL_REF_INPUT: ${{ github.event.inputs.tcl_ref || '' }}
|
||||||
|
run: |
|
||||||
|
if [ -n "$TCL_REF_INPUT" ]; then
|
||||||
|
TCL_REF="$TCL_REF_INPUT"
|
||||||
|
echo "Using workflow_dispatch TCL_REF: $TCL_REF"
|
||||||
|
else
|
||||||
|
TCL_REF=$(git ls-remote --tags --sort=-version:refname "$TCL_REPO_URL" \
|
||||||
|
'refs/tags/core-9-0-*' \
|
||||||
|
| grep -v '\^{}' \
|
||||||
|
| head -1 \
|
||||||
|
| awk '{print $2}' \
|
||||||
|
| sed 's|refs/tags/||')
|
||||||
|
if [ -z "$TCL_REF" ]; then
|
||||||
|
TCL_REF=main
|
||||||
|
echo "Warning: no stable core-9-0-x tag found, falling back to main"
|
||||||
|
else
|
||||||
|
echo "Auto-resolved latest stable TCL tag: $TCL_REF"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "tcl_ref=$TCL_REF" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "tcl_repo_url=$TCL_REPO_URL" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
# Clone tcltk/tcl into a sibling directory at the resolved ref.
|
||||||
|
# Done as an explicit step so the exact commit is visible in the job
|
||||||
|
# log. The source tree is read-only — the WASM build runs inside magic.
|
||||||
|
- name: Clone tcltk/tcl
|
||||||
|
env:
|
||||||
|
TCL_REPO_URL: ${{ steps.resolve-tcl.outputs.tcl_repo_url }}
|
||||||
|
TCL_REF: ${{ steps.resolve-tcl.outputs.tcl_ref }}
|
||||||
run: |
|
run: |
|
||||||
. npm/tcl.ref
|
|
||||||
: "${TCL_REPO_URL:=https://github.com/tcltk/tcl.git}"
|
|
||||||
: "${TCL_REF:=main}"
|
|
||||||
echo "Pinned TCL: $TCL_REF ($TCL_REPO_URL)"
|
|
||||||
# autocrlf=false: ubuntu-latest is already LF, but make it explicit.
|
# autocrlf=false: ubuntu-latest is already LF, but make it explicit.
|
||||||
git -c core.autocrlf=false clone "$TCL_REPO_URL" ../tcl
|
git -c core.autocrlf=false clone "$TCL_REPO_URL" ../tcl
|
||||||
( cd ../tcl && git checkout --detach "$TCL_REF" )
|
cd ../tcl
|
||||||
|
git checkout --detach "$TCL_REF"
|
||||||
|
echo "=== TCL commit ==="
|
||||||
|
git log -n1 --format="commit %H%nauthor %an <%ae>%ndate %ci%nref %D%n%n %s"
|
||||||
|
|
||||||
- name: Build WASM — both variants (tcl + notcl)
|
- name: Build WASM — both variants (tcl + notcl)
|
||||||
|
env:
|
||||||
|
TCL_REF: ${{ steps.resolve-tcl.outputs.tcl_ref }}
|
||||||
|
TCL_REPO_URL: ${{ steps.resolve-tcl.outputs.tcl_repo_url }}
|
||||||
run: |
|
run: |
|
||||||
source ./emsdk/emsdk_env.sh
|
source ./emsdk/emsdk_env.sh
|
||||||
bash npm/build.sh --variant=both
|
bash npm/build.sh --variant=both
|
||||||
|
|
@ -132,13 +173,16 @@ jobs:
|
||||||
echo "version=${tag#v}" >> "$GITHUB_OUTPUT"
|
echo "version=${tag#v}" >> "$GITHUB_OUTPUT"
|
||||||
echo "Tag release: $tag → npm version ${tag#v}"
|
echo "Tag release: $tag → npm version ${tag#v}"
|
||||||
else
|
else
|
||||||
# For non-tag CI runs, use a dev-suffixed version so the packed
|
# For non-tag CI runs, embed date + git hash as build metadata
|
||||||
# tarball is still consumable for local inspection / artifact upload.
|
# (semver +METADATA) so the snapshot sorts as 8.3.799+date.gitHASH.
|
||||||
|
# Build metadata is ignored by npm for version comparison — the
|
||||||
|
# snapshot is treated as equivalent to 8.3.799 for range matching,
|
||||||
|
# which is correct: it is that release built from a specific commit.
|
||||||
base=$(cat VERSION)
|
base=$(cat VERSION)
|
||||||
date=$(git show -s --format=%cs | tr -d '-')
|
date=$(git show -s --format=%cs | tr -d '-')
|
||||||
hash=$(git show -s --format=%h)
|
hash=$(git show -s --format=%h)
|
||||||
echo "publish=false" >> "$GITHUB_OUTPUT"
|
echo "publish=false" >> "$GITHUB_OUTPUT"
|
||||||
echo "version=${base}-${date}.${hash}" >> "$GITHUB_OUTPUT"
|
echo "version=${base}+${date}.git${hash}" >> "$GITHUB_OUTPUT"
|
||||||
echo "Non-tag build: will not publish."
|
echo "Non-tag build: will not publish."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -168,3 +212,37 @@ jobs:
|
||||||
run: cd npm && npm publish
|
run: cd npm && npm publish
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
# Write a Markdown summary visible next to the artifacts on the Actions
|
||||||
|
# page. Captures the exact versions used so a future regression can be
|
||||||
|
# bisected without scrolling through raw logs.
|
||||||
|
- name: Build summary
|
||||||
|
if: always()
|
||||||
|
env:
|
||||||
|
TCL_REF: ${{ steps.resolve-tcl.outputs.tcl_ref }}
|
||||||
|
TCL_REPO_URL: ${{ steps.resolve-tcl.outputs.tcl_repo_url }}
|
||||||
|
run: |
|
||||||
|
source ./emsdk/emsdk_env.sh 2>/dev/null || true
|
||||||
|
EMCC_VER=$(emcc --version 2>/dev/null | head -1 || echo "unavailable")
|
||||||
|
GCC_VER=$(gcc --version 2>/dev/null | head -1 || echo "unavailable")
|
||||||
|
NODE_VER=$(node --version 2>/dev/null || echo "unavailable")
|
||||||
|
MAGIC_VER=$(cat VERSION 2>/dev/null || echo "unavailable")
|
||||||
|
if [ -d ../tcl/.git ]; then
|
||||||
|
TCL_SHA=$(cd ../tcl && git rev-parse HEAD)
|
||||||
|
TCL_DATE=$(cd ../tcl && git log -1 --format="%ci")
|
||||||
|
TCL_SUBJECT=$(cd ../tcl && git log -1 --format="%s")
|
||||||
|
else
|
||||||
|
TCL_SHA="(not cloned)"; TCL_DATE=""; TCL_SUBJECT=""
|
||||||
|
fi
|
||||||
|
printf '## Build info\n\n' >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
printf '| Component | Details |\n' >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
printf '|-----------|----------|\n' >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
printf '| Magic | `%s` |\n' "$MAGIC_VER" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
printf '| Emscripten | %s |\n' "$EMCC_VER" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
printf '| GCC | %s |\n' "$GCC_VER" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
printf '| Node.js | %s |\n' "$NODE_VER" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
printf '| TCL repo | %s |\n' "$TCL_REPO_URL" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
printf '| TCL ref | `%s` |\n' "$TCL_REF" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
printf '| TCL commit | `%s` |\n' "$TCL_SHA" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
printf '| TCL date | %s |\n' "$TCL_DATE" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
printf '| TCL subject | %s |\n' "$TCL_SUBJECT" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
|
|
||||||
22
npm/build.sh
22
npm/build.sh
|
|
@ -94,26 +94,20 @@ sed_strip_cr() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $OPT_RELEASE -eq 1 ]; then
|
if [ $OPT_RELEASE -eq 1 ]; then
|
||||||
EXTRA_CFLAGS=" -O2"
|
EXTRA_CFLAGS="-O2"
|
||||||
else
|
else
|
||||||
EXTRA_CFLAGS=" -g"
|
EXTRA_CFLAGS="-g"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- TCL fork: locate, pin, prebuild (TCL variant only) ---------------------
|
# --- TCL fork: locate and prebuild (TCL variant only) -----------------------
|
||||||
# Reads npm/tcl.ref to get the upstream URL + commit SHA. If the TCL source
|
# Uses TCL_REPO_URL and TCL_REF from the environment (both have defaults).
|
||||||
# tree does not exist yet, clone it (with autocrlf=false to keep configure
|
# If the TCL source tree does not exist yet, clones it. If it does exist,
|
||||||
# parseable on Windows hosts). If it does exist, just check out the pinned
|
# checks out the requested ref — no auto-fetch, so builds are reproducible.
|
||||||
# ref — no auto-fetch, so releases stay reproducible.
|
|
||||||
#
|
#
|
||||||
# The TCL source tree is treated as read-only. The actual WASM build runs in
|
# The TCL source tree is treated as read-only. The actual WASM build runs in
|
||||||
# $TCL_BUILD_DIR (inside magic), driven by
|
# $TCL_BUILD_DIR (inside magic), driven by
|
||||||
# toolchains/emscripten/build-tcl-wasm.sh.
|
# toolchains/emscripten/build-tcl-wasm.sh.
|
||||||
ensure_tcl_built() {
|
ensure_tcl_built() {
|
||||||
local TCL_REF_FILE="$SCRIPT_DIR/tcl.ref"
|
|
||||||
if [ -f "$TCL_REF_FILE" ]; then
|
|
||||||
# shellcheck source=/dev/null
|
|
||||||
. "$TCL_REF_FILE"
|
|
||||||
fi
|
|
||||||
: "${TCL_REPO_URL:=https://github.com/tcltk/tcl.git}"
|
: "${TCL_REPO_URL:=https://github.com/tcltk/tcl.git}"
|
||||||
: "${TCL_REF:=main}"
|
: "${TCL_REF:=main}"
|
||||||
|
|
||||||
|
|
@ -167,7 +161,7 @@ build_variant() {
|
||||||
|
|
||||||
if [ "$variant" = "tcl" ]; then
|
if [ "$variant" = "tcl" ]; then
|
||||||
ensure_tcl_built
|
ensure_tcl_built
|
||||||
CFLAGS="--std=c17 -D_DEFAULT_SOURCE=1 -DEMSCRIPTEN=1${EXTRA_CFLAGS}" \
|
CFLAGS="--std=c17 -D_DEFAULT_SOURCE=1 -DEMSCRIPTEN=1 ${EXTRA_CFLAGS}" \
|
||||||
emconfigure ./configure \
|
emconfigure ./configure \
|
||||||
--without-cairo --without-opengl --without-x --without-tk \
|
--without-cairo --without-opengl --without-x --without-tk \
|
||||||
--with-tcl="$TCL_WASM_PREFIX/lib" \
|
--with-tcl="$TCL_WASM_PREFIX/lib" \
|
||||||
|
|
@ -177,7 +171,7 @@ build_variant() {
|
||||||
--host=asmjs-unknown-emscripten \
|
--host=asmjs-unknown-emscripten \
|
||||||
--target=asmjs-unknown-emscripten
|
--target=asmjs-unknown-emscripten
|
||||||
else
|
else
|
||||||
CFLAGS="--std=c17 -D_DEFAULT_SOURCE=1 -DEMSCRIPTEN=1${EXTRA_CFLAGS}" \
|
CFLAGS="--std=c17 -D_DEFAULT_SOURCE=1 -DEMSCRIPTEN=1 ${EXTRA_CFLAGS}" \
|
||||||
emconfigure ./configure \
|
emconfigure ./configure \
|
||||||
--without-cairo --without-opengl --without-x \
|
--without-cairo --without-opengl --without-x \
|
||||||
--without-tk --without-tcl \
|
--without-tk --without-tcl \
|
||||||
|
|
|
||||||
12
npm/tcl.ref
12
npm/tcl.ref
|
|
@ -1,12 +0,0 @@
|
||||||
# Pin for the TCL fork that the WASM build links against.
|
|
||||||
#
|
|
||||||
# Format: shell-style "VAR=VALUE" lines (no spaces around =).
|
|
||||||
# Lines starting with # or blank lines are ignored.
|
|
||||||
#
|
|
||||||
# To take a newer TCL release into magic-wasm:
|
|
||||||
# 1. Update TCL_REF below to the desired commit SHA (or tag/branch).
|
|
||||||
# 2. Bump magic/VERSION as usual.
|
|
||||||
# 3. Commit + push. CI rebuilds and republishes.
|
|
||||||
|
|
||||||
TCL_REPO_URL=https://github.com/tcltk/tcl.git
|
|
||||||
TCL_REF=84b23291b0dd811d642abef4ec7a55473c3eccb3
|
|
||||||
Loading…
Reference in New Issue