Skip to content

Commit 3bc21f2

Browse files
committed
fix(ci): use package version for WASM workflow cache keys
Both ONNX Runtime and Yoga Layout build caches were not invalidating when their versions changed. Now both use package.json version field (which matches upstream release versions) for proper cache busting. Changes: - ONNX Runtime: Update package version 1.0.0 → 1.21.1 (matches v1.21.1) - Yoga Layout: Update package version 1.0.0 → 3.1.0 (matches v3.1.0) - Both build scripts read version from package.json and prepend 'v' for git tags - Workflows extract versions from package.json (standard semver, no custom fields) - Cache keys include both file hash and version for proper invalidation
1 parent 17cd284 commit 3bc21f2

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

.github/workflows/build-wasm.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,13 @@ jobs:
5151
- name: Generate yoga build cache key
5252
id: yoga-cache-key
5353
run: |
54-
HASH=$(find packages/yoga-layout -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.mjs" -o -name "CMakeLists.txt" \) | sort | xargs sha256sum | sha256sum | cut -d' ' -f1)
55-
echo "hash=$HASH" >> $GITHUB_OUTPUT
54+
# Extract Yoga version from package.json (package version matches Yoga Layout release).
55+
YOGA_VERSION=$(node -p "require('./packages/yoga-layout/package.json').version")
56+
# Hash includes source files and package.json.
57+
HASH=$(find packages/yoga-layout -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.mjs" -o -name "CMakeLists.txt" -o -name "package.json" \) | sort | xargs sha256sum | sha256sum | cut -d' ' -f1)
58+
FULL_HASH="${HASH}-${YOGA_VERSION}"
59+
echo "hash=$FULL_HASH" >> $GITHUB_OUTPUT
60+
echo "Yoga Layout version: v$YOGA_VERSION"
5661
5762
- name: Restore yoga output cache
5863
id: yoga-cache

packages/yoga-layout/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@socketsecurity/yoga-layout",
3-
"version": "1.0.0",
3+
"version": "3.1.0",
44
"description": "Custom Yoga Layout WASM build optimized for Socket CLI",
55
"type": "module",
66
"private": true,

packages/yoga-layout/scripts/build.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ const CLEAN_BUILD = args.includes('--clean')
5454
const ROOT_DIR = path.join(__dirname, '..')
5555
const BUILD_DIR = path.join(ROOT_DIR, 'build')
5656
const OUTPUT_DIR = path.join(BUILD_DIR, 'wasm')
57-
const YOGA_VERSION = 'v3.1.0'
57+
// Read Yoga version from package.json (matches Yoga Layout release version).
58+
const packageJson = JSON.parse(await fs.readFile(path.join(ROOT_DIR, 'package.json'), 'utf-8'))
59+
const YOGA_VERSION = `v${packageJson.version}`
5860
const YOGA_REPO = 'https://github.com/facebook/yoga.git'
5961
const YOGA_SOURCE_DIR = path.join(BUILD_DIR, 'yoga-source')
6062

0 commit comments

Comments
 (0)