datahaven/.github/workflows/task-check-metadata.yml
Ahmad Kaouk dd7b72ca29
chore: pin Bun version and migrate to bun.lock (#290)
## Summary

Pins Bun version to 1.3.2 and migrates workflows to use text-based
`bun.lock` instead of binary `bun.lockb`. This fixes CI failures caused
by Bun version mismatches between local development and GitHub Actions.

## Changes

- Created `test/.bun-version` to pin Bun to v1.3.2
- Updated all workflows to use `bun-version-file: test/.bun-version`
- Migrated workflow cache keys from `bun.lockb` to `bun.lock`
- Removed deprecated `test/bun.lockb` binary lockfile

## Why?

**Version Consistency:**
- Local environments and CI were using different Bun versions
- Different versions generate different lockfile formats → CI failures

**Lockfile Migration:**
- Bun v1.2+ uses text-based `bun.lock` as default
- Binary `bun.lockb` is still supported but deprioritized
- Text format provides better git diffs and merge conflict resolution

## Affected Workflows

- `.github/workflows/task-check-metadata.yml`
- `.github/workflows/task-e2e.yml`
- `.github/workflows/task-moonwall-tests.yml`
- `.github/workflows/task-ts-build.yml`
- `.github/workflows/task-ts-lint.yml`

## After Merge

Developers should upgrade their local Bun:
```bash
bun upgrade --stable  # Should install v1.3.2
bun --version         # Verify version
bun install           # Regenerate lockfile if needed
```

---------

Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2025-11-10 22:37:39 +01:00

96 lines
3.2 KiB
YAML

name: "Task: Check Metadata Freshness"
on:
workflow_dispatch:
inputs:
binary-hash:
description: "Hash of the binary artifact to use"
required: true
type: string
workflow_call:
inputs:
binary-hash:
description: "Hash of the binary artifact to use"
required: true
type: string
defaults:
run:
shell: bash
env:
RUST_BACKTRACE: "1"
jobs:
check-metadata:
name: Check metadata freshness
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: test/.bun-version
- name: Install dependencies
working-directory: test
run: bun install --frozen-lockfile
- name: Download WASM artifact
uses: actions/download-artifact@v4
with:
name: datahaven-wasm-${{ inputs.binary-hash }}
path: ./operator/target/release/wbuild/datahaven-stagenet-runtime
- name: Verify WASM download to target directory
run: |
echo "Target directory contents:"
find ./operator/target/release/wbuild/datahaven-stagenet-runtime -type f | head -20
# The WASM should be at this path in the artifact
WASM_PATH="./operator/target/release/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.wasm"
if [ ! -f "$WASM_PATH" ]; then
echo "Error: WASM file not found at expected path: $WASM_PATH"
echo "Looking for WASM files in target directory:"
find ./operator/target/release/wbuild/datahaven-stagenet-runtime -name "*.wasm" -type f
exit 1
fi
echo "Found WASM at: $WASM_PATH"
echo "WASM size: $(du -h $WASM_PATH | cut -f1)"
- name: Generate metadata from WASM
working-directory: test
run: |
echo "Generating metadata from WASM..."
bun x papi add --wasm "../operator/target/release/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.wasm" datahaven
- name: Check for metadata changes
run: |
# Check if the metadata file has changed
if git diff --exit-code test/.papi/metadata/datahaven.scale; then
echo "✅ Metadata is up to date!"
else
echo "❌ Metadata file has changed!"
echo ""
echo "The runtime metadata is out of date. Please run the following command and commit the changes:"
echo ""
echo " cd test && bun generate:types:fast"
echo ""
echo "This ensures that TypeScript types match the current runtime."
echo ""
echo "Diff of changes:"
git diff test/.papi/metadata/datahaven.scale | head -50
exit 1
fi
- name: Check for other papi changes
run: |
# Also check if polkadot-api.json changed (shouldn't happen, but good to verify)
if git diff --exit-code test/.papi/polkadot-api.json; then
echo "✅ polkadot-api.json is unchanged"
else
echo "⚠️ polkadot-api.json has changed - this is unexpected"
git diff test/.papi/polkadot-api.json
fi