Skip to content

Commit 97f368c

Browse files
committed
refactor(ci): simplify workflows with consistent config
- Use Node 22 everywhere (was: lint used 24, build used 22) - Use explicit macos-15 instead of macos-latest - Use test:fast in test-matrix (compatibility check, not bug finding) - Merge download-artifacts and publish into one job in release.yml - Remove redundant artifact re-upload/download and duplicate verification Removes 107 lines of unnecessary complexity.
1 parent 514f6d0 commit 97f368c

2 files changed

Lines changed: 24 additions & 107 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- uses: actions/checkout@v6
3131
- uses: actions/setup-node@v6
3232
with:
33-
node-version: "24"
33+
node-version: "22"
3434
- run: npm install --ignore-scripts
3535
- run: npm run build:ts
3636
- run: npm run lint
@@ -57,7 +57,7 @@ jobs:
5757
- os: macos-15-intel
5858
platform: darwin-x64
5959
arch: x64
60-
- os: macos-latest
60+
- os: macos-15
6161
platform: darwin-arm64
6262
arch: arm64
6363

@@ -194,8 +194,9 @@ jobs:
194194
subject-path: packages/@pproenca/node-webcodecs-${{ matrix.platform }}/bin/node.napi.node
195195

196196
# ============================================================================
197-
# Test across Node versions using prebuilt binaries
198-
# Binary is built with Node 22 (tested in build-native), tested here for 20/24 compatibility
197+
# Test Node version compatibility using prebuilt binaries
198+
# Binary is built and tested with Node 22 in build-native
199+
# Here we verify the same binary works with Node 20/24 (fast compatibility check)
199200
# ============================================================================
200201
test-matrix:
201202
permissions:
@@ -214,8 +215,8 @@ jobs:
214215
- { os: macos-15-intel, platform: darwin-x64, node: "20" }
215216
- { os: macos-15-intel, platform: darwin-x64, node: "24" }
216217
# macOS ARM - Node 20/24
217-
- { os: macos-latest, platform: darwin-arm64, node: "20" }
218-
- { os: macos-latest, platform: darwin-arm64, node: "24" }
218+
- { os: macos-15, platform: darwin-arm64, node: "20" }
219+
- { os: macos-15, platform: darwin-arm64, node: "24" }
219220

220221
steps:
221222
- uses: actions/checkout@v6
@@ -244,5 +245,5 @@ jobs:
244245
- name: Build TypeScript
245246
run: npm run build:ts
246247

247-
- name: Test
248-
run: npm test
248+
- name: Test (fast compatibility check)
249+
run: npm run test:fast

.github/workflows/release.yml

Lines changed: 15 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,28 @@ permissions: {}
1414

1515
jobs:
1616
# ============================================================================
17-
# Download prebuilt artifacts from CI workflow
17+
# Download CI artifacts and publish to npm
1818
# NO building here - artifacts were already built and tested in CI
1919
# ============================================================================
20-
download-artifacts:
21-
name: "Download CI Artifacts"
20+
publish:
21+
name: "Publish"
2222
runs-on: ubuntu-24.04
2323
permissions:
2424
contents: read
2525
actions: read # Required to download artifacts from other workflows
26-
outputs:
27-
artifacts-found: ${{ steps.verify.outputs.found }}
26+
id-token: write # For npm provenance
27+
environment:
28+
name: npm
29+
url: https://www.npmjs.com/package/@pproenca/node-webcodecs
2830
steps:
2931
- uses: actions/checkout@v6
3032

33+
- uses: actions/setup-node@v6
34+
with:
35+
node-version: "22"
36+
registry-url: "https://registry.npmjs.org"
37+
3138
# Download artifacts from the CI workflow run for this commit
32-
# Uses dawidd6/action-download-artifact which supports cross-workflow downloads
3339
- name: Download artifacts from CI
3440
uses: dawidd6/action-download-artifact@0bd50d53a6d7fb5cb921e607957e9cc12b4ce392 # v6
3541
with:
@@ -40,75 +46,13 @@ jobs:
4046
path: platform-artifacts
4147
if_no_artifact_found: fail
4248

43-
- name: Verify all platform artifacts exist
44-
id: verify
45-
run: |
46-
echo "=== Downloaded artifacts ==="
47-
ls -laR platform-artifacts/
48-
49-
# Verify all expected platforms are present
50-
for platform in darwin-arm64 darwin-x64 linux-x64; do
51-
artifact_dir="platform-artifacts/platform-pkg-$platform"
52-
if [ ! -d "$artifact_dir" ]; then
53-
echo "ERROR: Missing artifact directory for $platform"
54-
echo "Did CI complete successfully for commit ${{ github.sha }}?"
55-
exit 1
56-
fi
57-
58-
tarball=$(find "$artifact_dir" -name "*.tar" -type f | head -1)
59-
if [ -z "$tarball" ]; then
60-
echo "ERROR: No tarball found for $platform"
61-
exit 1
62-
fi
63-
64-
echo "OK: Found $tarball"
65-
done
66-
67-
echo "found=true" >> $GITHUB_OUTPUT
68-
echo "All platform artifacts verified!"
69-
70-
# Re-upload artifacts so they're available to subsequent jobs in this workflow
71-
- name: Upload artifacts for publish job
72-
uses: actions/upload-artifact@v6
73-
with:
74-
name: all-platform-artifacts
75-
path: platform-artifacts/
76-
retention-days: 1
77-
78-
# ============================================================================
79-
# Publish platform-specific packages first, then main package
80-
# ============================================================================
81-
publish:
82-
name: "Publish"
83-
needs: [download-artifacts]
84-
runs-on: ubuntu-24.04
85-
permissions:
86-
id-token: write # For npm provenance
87-
contents: read
88-
environment:
89-
name: npm
90-
url: https://www.npmjs.com/package/@pproenca/node-webcodecs
91-
steps:
92-
- uses: actions/checkout@v6
93-
94-
- uses: actions/setup-node@v6
95-
with:
96-
node-version: "22"
97-
registry-url: "https://registry.npmjs.org"
98-
9949
- name: Install dependencies
10050
run: npm install --ignore-scripts
10151

10252
- name: Build TypeScript
10353
run: npm run build:ts
10454

105-
- name: Download platform package artifacts
106-
uses: actions/download-artifact@v6
107-
with:
108-
name: all-platform-artifacts
109-
path: platform-artifacts
110-
111-
- name: Extract platform packages
55+
- name: Extract and verify platform packages
11256
run: |
11357
mkdir -p packages
11458
@@ -120,14 +64,13 @@ jobs:
12064
platform=$(basename "$artifact_dir" | sed 's/platform-pkg-//')
12165
echo "Processing platform: $platform"
12266
123-
# Find and extract the tarball
12467
tarball=$(find "$artifact_dir" -name "*.tar" -type f | head -1)
12568
if [ -n "$tarball" ]; then
12669
echo "Extracting $tarball"
12770
tar -xvf "$tarball" -C packages/
12871
else
12972
echo "Error: No tarball found in $artifact_dir"
130-
ls -la "$artifact_dir"
73+
echo "Did CI complete successfully for commit ${{ github.sha }}?"
13174
exit 1
13275
fi
13376
done
@@ -140,28 +83,21 @@ jobs:
14083
pkg_dir="packages/@pproenca/node-webcodecs-$platform"
14184
if [ ! -f "$pkg_dir/bin/node.napi.node" ]; then
14285
echo "Error: Missing binary for $platform"
143-
ls -la "$pkg_dir/" 2>/dev/null || echo "Directory doesn't exist"
144-
exit 1
145-
fi
146-
if [ ! -f "$pkg_dir/package.json" ]; then
147-
echo "Error: Missing package.json for $platform"
14886
exit 1
14987
fi
15088
echo "OK: $pkg_dir"
15189
done
15290
15391
# OIDC Trusted Publishing - no NPM_TOKEN needed
154-
# Configure trusted publisher at npmjs.com package settings
15592
- name: Publish platform packages
15693
run: |
157-
# Platform packages MUST be published first (they are dependencies)
15894
for platform in darwin-arm64 darwin-x64 linux-x64; do
15995
pkg_dir="packages/@pproenca/node-webcodecs-$platform"
16096
echo "Publishing $pkg_dir..."
16197
(cd "$pkg_dir" && npm publish --provenance --access public)
16298
done
16399
164-
# Wait for npm registry propagation before publishing main package
100+
# Wait for npm registry propagation
165101
echo "Waiting for npm registry propagation..."
166102
sleep 15
167103
@@ -208,10 +144,6 @@ jobs:
208144
# Install main package - should automatically install correct platform package
209145
npm install @pproenca/node-webcodecs@${{ steps.version.outputs.version }}
210146
211-
# Verify only one platform package was installed (optionalDependencies pattern)
212-
echo "=== Installed packages ==="
213-
ls -la node_modules/@pproenca/ || echo "No @pproenca packages visible"
214-
215147
# Verify the binding loads correctly
216148
node -e "
217149
const wc = require('@pproenca/node-webcodecs');
@@ -235,19 +167,3 @@ jobs:
235167
236168
console.log('Smoke Test Passed!');
237169
"
238-
239-
- name: Verify platform package
240-
run: |
241-
cd smoke-test
242-
243-
# Check that the correct platform package was installed
244-
PLATFORM="${{ matrix.platform }}"
245-
PKG_PATH="node_modules/@pproenca/node-webcodecs-$PLATFORM"
246-
247-
if [ -d "$PKG_PATH" ]; then
248-
echo "Platform package installed: $PKG_PATH"
249-
ls -la "$PKG_PATH/bin/"
250-
else
251-
echo "Warning: Platform package not visible at $PKG_PATH"
252-
echo "This may be expected if npm hoists differently"
253-
fi

0 commit comments

Comments
 (0)