-
Notifications
You must be signed in to change notification settings - Fork 7
Add blockmap generation to CI and implement blockmap-based incremental updater #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
abaf1b1
Add blockmap generation to release workflow
Nat3z 17febc8
Harden blockmap patching and cache blockmaps for full downloads
Nat3z 91adb30
Sort release feed newest-first before patch path planning
Nat3z 6cf52d5
fix: fixed build-release blockmaps
Nat3z 3f30643
fix: fixed a bunch of blockmap resolution stuff
Nat3z 7449cd3
Remove blockmap generation step from build workflow
Nat3z 5ad49aa
fix: fixed blockmap not uploading
Nat3z fd7b891
Add CI blockmap generation
Nat3z 3889308
Add blockmap download handling
Nat3z File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { existsSync } from 'node:fs'; | ||
| import path from 'node:path'; | ||
| import { createRequire } from 'node:module'; | ||
| import { spawn } from 'node:child_process'; | ||
|
|
||
| const require = createRequire(import.meta.url); | ||
|
|
||
| function resolveAppBuilderPath() { | ||
| const searchPaths = [ | ||
| process.cwd(), | ||
| path.join(process.cwd(), 'node_modules'), | ||
| path.join(process.cwd(), 'application'), | ||
| path.join(process.cwd(), 'application', 'node_modules'), | ||
| path.join(process.cwd(), 'updater'), | ||
| path.join(process.cwd(), 'updater', 'node_modules'), | ||
| ]; | ||
|
|
||
| for (const searchPath of searchPaths) { | ||
| try { | ||
| const modulePath = require.resolve('app-builder-bin', { | ||
| paths: [searchPath], | ||
| }); | ||
| return require(modulePath).appBuilderPath; | ||
| } catch { | ||
| // Try the next candidate path. | ||
| } | ||
| } | ||
|
|
||
| throw new Error( | ||
| 'Unable to resolve app-builder-bin. Ensure dependencies are installed before generating blockmaps.' | ||
| ); | ||
| } | ||
|
|
||
| const appBuilderPath = resolveAppBuilderPath(); | ||
|
|
||
| function runAppBuilder(args) { | ||
| return new Promise((resolve, reject) => { | ||
| const child = spawn(appBuilderPath, args, { stdio: 'inherit' }); | ||
| child.on('exit', (code) => { | ||
| if (code === 0) { | ||
| resolve(); | ||
| return; | ||
| } | ||
| reject(new Error(`app-builder exited with code ${code}`)); | ||
| }); | ||
| child.on('error', reject); | ||
| }); | ||
| } | ||
|
|
||
| async function main() { | ||
| const args = process.argv.slice(2); | ||
| if (args.length === 0) { | ||
| console.error('Usage: bun run .github/workflows/js/generate-blockmaps.mjs <file> [file...]'); | ||
| process.exit(1); | ||
| } | ||
|
|
||
| for (const artifact of args) { | ||
| const artifactPath = path.resolve(artifact); | ||
| const blockmapPath = `${artifactPath}.blockmap`; | ||
|
|
||
| if (!existsSync(artifactPath)) { | ||
| console.error(`Artifact not found: ${artifactPath}`); | ||
| process.exit(1); | ||
| } | ||
|
|
||
| console.log(`Generating blockmap: ${blockmapPath}`); | ||
| await runAppBuilder(['blockmap', '--input', artifactPath, '--output', blockmapPath]); | ||
| } | ||
| } | ||
|
|
||
| await main(); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.