-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GHA docker build caching support
- Loading branch information
Showing
4 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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,26 @@ | ||
const { spawn } = require("child_process"); | ||
|
||
if (typeof require !== "undefined" && require.main === module) { | ||
const extraArgs = process.argv.slice(2); | ||
if (extraArgs.length > 0) { | ||
console.log("Extra arguments:", extraArgs); | ||
} | ||
if (process.env["GITHUB_TOKEN"]) { | ||
console.log("GITHUB_TOKEN is set, assuming CI environment"); | ||
extraArgs.push("--cache-to=type=gha,mode=max", "--cache-from=type=gha"); | ||
} | ||
const ret = spawn("docker", [ | ||
"buildx", | ||
"build", | ||
"--progress=plain", | ||
"--build-arg=BRANCH=binutils-2_41-branch", | ||
`--output=${process.cwd()}/build`, | ||
...extraArgs, | ||
`${process.cwd()}/build`, | ||
]); | ||
ret.stdout.pipe(process.stdout); | ||
ret.stderr.pipe(process.stderr); | ||
ret.on("exit", (code) => { | ||
process.exit(code ?? 0); | ||
}); | ||
} |
This file contains 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 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