Skip to content

Commit d882125

Browse files
authored
Ensure wasm-latest is correct in CI (#2068)
In the upstream spec repo, the contents of wasm-latest must always be the same as the highest numbered wasm-X.Y spec directory. Add a CI script to enforce this.
1 parent c61fd29 commit d882125

3 files changed

Lines changed: 44 additions & 4 deletions

File tree

.github/workflows/ci-spec.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,25 @@ name: CI for specs
33
on:
44
push:
55
branches: [ main, wasm-3.0 ]
6-
paths: [ .github/**, document/**, spectec/** ]
6+
paths: [ .github/**, document/**, spectec/**, specification/** ]
77

88
pull_request:
99
branches: [ main, wasm-3.0 ]
10-
paths: [ .github/**, document/**, spectec/** ]
10+
paths: [ .github/**, document/**, spectec/**, specification/** ]
1111

1212
# Allows you to run this workflow manually from the Actions tab
1313
workflow_dispatch:
1414

1515
jobs:
16+
ensure-wasm-latest:
17+
if: ${{ github.repository == 'WebAssembly/spec' }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repo
21+
uses: actions/checkout@v4
22+
- name: Diff wasm-latest
23+
run: bash .github/workflows/diff-wasm-latest.sh
24+
1625
build-core-spec:
1726
runs-on: ubuntu-latest
1827
steps:
@@ -145,6 +154,7 @@ jobs:
145154
publish-spec:
146155
runs-on: ubuntu-latest
147156
needs:
157+
- ensure-wasm-latest
148158
- build-core-spec
149159
- build-js-api-spec
150160
- build-web-api-spec
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# Identify the highest versioned directory
4+
HIGHEST_VER=$(ls -d specification/wasm-[0-9]* 2>/dev/null | sort -V | tail -n 1)
5+
6+
if [ -z "$HIGHEST_VER" ]; then
7+
echo "❌ Error: No wasm-X.Y versioned directories found in specification/"
8+
exit 1
9+
fi
10+
11+
LATEST="specification/wasm-latest"
12+
13+
# Check that wasm-latest exists
14+
if [ ! -d "$LATEST" ]; then
15+
echo "❌ Error: $LATEST does not exist."
16+
exit 1
17+
fi
18+
19+
# Diff the highest version with wasm-latest and check that the diff is empty
20+
echo "Checking for differences between $HIGHEST_VER and $LATEST..."
21+
22+
if diff -qr "$HIGHEST_VER" "$LATEST" > /dev/null; then
23+
echo "✅ Success: Contents match. No changes needed."
24+
else
25+
echo "🔍 Differences detected:"
26+
echo "--------------------------------"
27+
diff -r "$HIGHEST_VER" "$LATEST"
28+
echo "--------------------------------"
29+
exit 1
30+
fi

.github/workflows/w3c-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
push:
55
# Disable on forks!
66
branches: [ main ]
7-
paths: [ .github/**, document/** ]
7+
paths: [ .github/**, document/**, specification/** ]
88
pull_request:
9-
paths: [ .github/**, document/** ]
9+
paths: [ .github/**, document/**, specification/** ]
1010

1111
# Allows you to run this workflow manually from the Actions tab, gh CLI tool,
1212
# or REST API. THe w3c-status options correspond to the valid options for

0 commit comments

Comments
 (0)