Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/release-deterministic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Release Deterministic Binding

on:
push:
tags:
- 'v*-deterministic'

permissions:
contents: write

jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build binding in Docker
run: |
docker run --rm \
-e CARGO_INCREMENTAL=0 \
-e CI=1 \
-v ${{ github.workspace }}:/rspack \
-w /rspack \
ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian \
bash -c '
set -ex
rustup target add x86_64-unknown-linux-gnu
npm install -g corepack@0.31.0 --force
corepack enable
mkdir -p .cargo
touch .cargo/config.toml
echo "" >> .cargo/config.toml
echo "trim-paths = true" >> .cargo/config.toml
pnpm install --frozen-lockfile
cargo codegen
RUST_TARGET=x86_64-unknown-linux-gnu pnpm build:binding:release
'
sudo chown -R $USER:$USER .

- name: Verify glibc compatibility
run: |
objdump -T crates/node_binding/rspack.linux-x64-gnu.node \
| grep GLIBC_ | sed 's/.*GLIBC_/GLIBC_/' | sort -uV | tail -5
MAX_GLIBC=$(objdump -T crates/node_binding/rspack.linux-x64-gnu.node \
| grep -oP 'GLIBC_\d+\.\d+' | sort -t. -k1,1n -k2,2n | tail -1)
echo "Max GLIBC requirement: $MAX_GLIBC"
if [[ "$MAX_GLIBC" > "GLIBC_2.17" ]]; then
echo "ERROR: Max GLIBC $MAX_GLIBC exceeds 2.17 — binary may not work on RBE workers"
exit 1
fi

- name: Package tarball
run: |
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#v}" # strip leading 'v'
mkdir -p package
cp crates/node_binding/rspack.linux-x64-gnu.node package/
cat > package/package.json << EOF
{
"name": "@rspack/binding-linux-x64-gnu",
"version": "${VERSION%-deterministic}",
"os": ["linux"],
"cpu": ["x64"],
"main": "rspack.linux-x64-gnu.node",
"files": ["rspack.linux-x64-gnu.node"],
"license": "MIT",
"description": "Patched rspack binding with deterministic contenthash fixes"
}
EOF
sed -i 's/^ //' package/package.json
cat package/package.json
tar czf rspack-binding-linux-x64-gnu-deterministic.tgz package/

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: rspack-binding-linux-x64-gnu-deterministic.tgz
body: |
Patched `@rspack/binding-linux-x64-gnu` with deterministic contenthash fixes for RBE builds.

Built with upstream's Docker image (`ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian`) and `release` profile (fat LTO, strip, codegen-units=1).

See the `v1.7.5-deterministic` branch for the source diff against upstream v1.7.5.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading