Skip to content

Commit cb7d304

Browse files
aepfliclaude
andauthored
ci: distribute WASM binary to all language packages on release (#111)
## Summary - Extends release workflow to copy WASM binary to all language package directories (go, dotnet, js, python) instead of just go/ - Removes Rust toolchain from `build-java` job — uses the committed WASM binary instead of building its own, eliminating divergence risk - Extends WASM staleness check to verify language directory copies match the root binary Closes #83 ## Test plan - [ ] Verify release workflow YAML is valid and paths are correct - [ ] Confirm `build-java` works with `-Dexec.skip=true` and pre-placed WASM - [ ] Check staleness workflow detects mismatched copies - [ ] Local dev workflow unaffected (each language's Makefile still works independently) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9770d4f commit cb7d304

2 files changed

Lines changed: 57 additions & 27 deletions

File tree

.github/workflows/release.yml

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,30 @@ jobs:
7878
echo "WASM file size: $SIZE bytes ($(echo "scale=2; $SIZE / 1024" | bc) KB)"
7979
sha256sum flagd_evaluator.wasm
8080
81-
- name: Copy WASM to go/ for release tag
81+
- name: Copy WASM to language packages
8282
run: |
83-
if [ -d go ]; then
84-
cp flagd_evaluator.wasm go/flagd_evaluator.wasm
85-
echo "Copied WASM to go/ for go:embed"
86-
fi
83+
for dest in \
84+
go/flagd_evaluator.wasm \
85+
dotnet/src/FlagdEvaluator/flagd_evaluator.wasm \
86+
js/flagd_evaluator.wasm \
87+
python/flagd_evaluator_wasm/flagd_evaluator.wasm; do
88+
dir=$(dirname "$dest")
89+
if [ -d "$dir" ]; then
90+
cp flagd_evaluator.wasm "$dest"
91+
echo "Copied to $dest"
92+
fi
93+
done
8794
8895
- name: Commit WASM binary
8996
run: |
9097
git config user.name "github-actions[bot]"
9198
git config user.email "github-actions[bot]@users.noreply.github.com"
9299
git add flagd_evaluator.wasm
93-
if [ -d go ]; then
94-
git add -f go/flagd_evaluator.wasm
95-
fi
100+
git add -f \
101+
go/flagd_evaluator.wasm \
102+
dotnet/src/FlagdEvaluator/flagd_evaluator.wasm \
103+
js/flagd_evaluator.wasm \
104+
python/flagd_evaluator_wasm/flagd_evaluator.wasm 2>/dev/null || true
96105
if git diff --cached --quiet; then
97106
echo "WASM binary is already up to date"
98107
else
@@ -115,29 +124,16 @@ jobs:
115124
distribution: 'temurin'
116125
cache: 'maven'
117126

118-
- name: Install Rust
119-
uses: dtolnay/rust-toolchain@stable
120-
with:
121-
targets: wasm32-unknown-unknown
122-
123-
- name: Cache cargo
124-
uses: actions/cache@v4
125-
with:
126-
path: |
127-
~/.cargo/bin/
128-
~/.cargo/registry/index/
129-
~/.cargo/registry/cache/
130-
~/.cargo/git/db/
131-
target/
132-
key: ${{ runner.os }}-cargo-java-release-${{ hashFiles('**/Cargo.lock') }}
133-
restore-keys: |
134-
${{ runner.os }}-cargo-java-release-
127+
- name: Place WASM for Maven
128+
run: |
129+
mkdir -p target/wasm32-unknown-unknown/release
130+
cp flagd_evaluator.wasm target/wasm32-unknown-unknown/release/
135131
136132
- name: Make Maven wrapper executable
137133
run: chmod +x java/mvnw
138134

139-
- name: Build with Maven
140-
run: cd java && ./mvnw clean package
135+
- name: Build with Maven (skip WASM build)
136+
run: cd java && ./mvnw clean package -Dexec.skip=true
141137

142138
- name: Generate checksums
143139
run: |

.github/workflows/wasm-staleness.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,37 @@ jobs:
6161
else
6262
echo "WASM binary is up to date."
6363
fi
64+
65+
- name: Check language directory copies match root
66+
run: |
67+
if [ ! -f flagd_evaluator.wasm ]; then
68+
echo "No root WASM binary to compare against, skipping."
69+
exit 0
70+
fi
71+
72+
ROOT_HASH=$(sha256sum flagd_evaluator.wasm | awk '{print $1}')
73+
MISMATCH=0
74+
75+
for copy in \
76+
go/flagd_evaluator.wasm \
77+
dotnet/src/FlagdEvaluator/flagd_evaluator.wasm \
78+
js/flagd_evaluator.wasm \
79+
python/flagd_evaluator_wasm/flagd_evaluator.wasm; do
80+
if [ -f "$copy" ]; then
81+
COPY_HASH=$(sha256sum "$copy" | awk '{print $1}')
82+
if [ "$ROOT_HASH" != "$COPY_HASH" ]; then
83+
echo "::warning::$copy does not match root flagd_evaluator.wasm"
84+
echo " Root: $ROOT_HASH"
85+
echo " Copy: $COPY_HASH"
86+
MISMATCH=1
87+
else
88+
echo "$copy matches root binary."
89+
fi
90+
fi
91+
done
92+
93+
if [ "$MISMATCH" -eq 1 ]; then
94+
echo ""
95+
echo "::warning::Some language directory WASM copies are out of sync with the root binary."
96+
echo "::warning::The release-please workflow will update all copies on the release PR."
97+
fi

0 commit comments

Comments
 (0)