Skip to content

Commit f47291a

Browse files
greggmanclaude
andcommitted
restructure dist into per platform-arch folders
Each build now lives in dist/<platform>-<arch>/dawn.node so it can sit next to its own runtime deps. d3dcompiler_47.dll moves into dist/win32-x64/ where it belongs, which is what makes room for a win32-arm64 build to carry its own ARM64 copy instead of colliding on the filename. Artifacts are now named for the platform-arch alone, so the package job drops merge-multiple and lets download-artifact reassemble the layout. Release assets are staged with their prefix restored, since that namespace is flat and four files named dawn.node would collide. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 422e920 commit f47291a

6 files changed

Lines changed: 24 additions & 10 deletions

File tree

.github/workflows/build.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,27 @@ jobs:
110110
run: |
111111
npm test
112112
113+
# Named for the platform-arch alone so the package job can download
114+
# artifacts straight into dist/<platform-arch>/ without merging.
113115
- name: Upload Artifact ⬆️
114116
uses: actions/upload-artifact@v4
115117
with:
116-
path: ./dist/*.dawn.node
117-
name: ${{ matrix.config.artifact }}.dawn.node
118+
path: ./dist/${{ matrix.config.artifact }}/dawn.node
119+
name: ${{ matrix.config.artifact }}
118120
overwrite: true
119121

122+
# Release assets are a flat namespace, so give each one back its
123+
# platform-arch prefix rather than uploading four files named dawn.node.
124+
- name: Stage release asset
125+
if: startsWith(github.ref, 'refs/tags/')
126+
shell: bash
127+
run: cp dist/${{ matrix.config.artifact }}/dawn.node ${{ matrix.config.artifact }}.dawn.node
128+
120129
- name: Release
121130
uses: softprops/action-gh-release@v2
122131
if: startsWith(github.ref, 'refs/tags/')
123132
with:
124-
files: dist/*.dawn.node
133+
files: ${{ matrix.config.artifact }}.dawn.node
125134

126135
package:
127136
needs: build
@@ -149,11 +158,12 @@ jobs:
149158
echo github.ref: ${{ github.ref }}
150159
echo github.ref_type: ${{ github.ref_type }}
151160
161+
# No merge-multiple: each artifact lands in dist/<its name>/, which is
162+
# exactly the per-platform-arch layout index.js resolves against.
152163
- name: Download artifacts
153164
uses: actions/download-artifact@v4
154165
with:
155166
path: dist
156-
merge-multiple: true
157167

158168
- name: Build and Publish
159169
shell: bash

build/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async function createProject() {
7777

7878
async function copyResult(filepath, target) {
7979
const srcFilename = path.join(...[filepath, ...addElemIf(isWin, kConfig), 'dawn.node']);
80-
const dstFilename = path.join('dist', `${target}.dawn.node`);
80+
const dstFilename = path.join('dist', target, 'dawn.node');
8181
fs.mkdirSync(path.dirname(dstFilename), {recursive: true});
8282
fs.copyFileSync(srcFilename, dstFilename);
8383
return dstFilename;

build/download-run-artifacts.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ const data = await github.getRunArtifacts({
108108
});
109109
const filenames = await Promise.all(
110110
data.artifacts
111-
.filter(({name}) => name?.endsWith('.node'))
112-
.map(({id}) => {
111+
// Artifacts are named for the platform-arch they were built for, and each
112+
// unpacks into the dist directory of that same name.
113+
.filter(({name}) => /^(darwin|linux|win32)-/.test(name ?? ''))
114+
.map(({id, name}) => {
113115
const url = `https://github.com/${owner}/${repo}/actions/runs/${args.run_id}/artifacts/${id}`;
114-
return downloadFileFromZip(url, 'dist');
116+
return downloadFileFromZip(url, path.join('dist', name));
115117
})
116118
);

build/postinstall.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const debug = DEBUG('postinstall');
1010

1111
async function main() {
1212
if (isMac) {
13-
const dawnNode = 'dist/darwin-universal.dawn.node';
13+
const dawnNode = 'dist/darwin-universal/dawn.node';
1414
const attribute = 'com.apple.quarantine'
1515
if (!exists(dawnNode)) {
1616
debug(`${dawnNode} does not exist`);

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export const isMac = process.platform === 'darwin';
66

77
const __dirname = dirname(fileURLToPath(import.meta.url));
88
const arch = isMac ? 'universal' : process.arch;
9-
const dawnNodePath = join(__dirname, 'dist', `${process.platform}-${arch}.dawn.node`);
9+
// One directory per platform-arch so each build can sit next to its own
10+
// runtime deps (win32 needs its matching d3dcompiler_47.dll beside it).
11+
const dawnNodePath = join(__dirname, 'dist', `${process.platform}-${arch}`, 'dawn.node');
1012
const { create, globals } = require(dawnNodePath);
1113
export { create, globals }

0 commit comments

Comments
 (0)