Skip to content

Commit 69d0568

Browse files
committed
Use sccache and gcc
1 parent 712858a commit 69d0568

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

.github/workflows/scheduled-builds.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ jobs:
2828
uses: mozilla-actions/[email protected]
2929

3030
- name: Run the script
31+
env:
32+
CC: "sccache gcc"
33+
CXX: "sccache g++"
34+
SCCACHE_GHA_ENABLED: "true"
3135
run: cd libnode-distributable && node index.js
3236

3337
- name: A buncha ls

index.js

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import { spawn } from "node:child_process";
55

66
const coreCount = os.cpus().length;
77
const threadCount = coreCount * 2;
8-
const sccacheEnv = { CC: "sccache gcc", CXX: "sccache g++" };
8+
9+
let CC = process.env.CC;
10+
let CXX = process.env.CXX;
11+
if (!CC) CC = "gcc";
12+
if (!CXX) CXX = "g++";
913

1014
const nodejsGithubRepo = "https://github.com/nodejs/node";
1115
const removeTheVCharacter = (str) => str.replace("v", "");
@@ -36,15 +40,11 @@ const isANewerVersion = (oldVer, newVer) => {
3640
return false;
3741
};
3842

39-
const spawnAsync = (program, args, cwd, env) =>
43+
const spawnAsync = (program, args, cwd) =>
4044
new Promise((resolve, reject) => {
4145
console.log([program, ...args].join(" "));
4246

43-
const child = spawn(
44-
program,
45-
args,
46-
cwd ? { cwd, env: { ...process.env, ...env } } : {}
47-
);
47+
const child = spawn(program, args, cwd ? { cwd } : {});
4848

4949
child.stdout.on("data", (chunk) => console.log(chunk.toString()));
5050
child.stderr.on("data", (chunk) => console.warn(chunk.toString()));
@@ -67,16 +67,10 @@ if (!syncFs.existsSync("node")) {
6767
`v${latestNodeVersion}`,
6868
"--depth=1",
6969
],
70-
undefined,
71-
{}
70+
undefined
7271
);
7372
}
7473

75-
await spawnAsync(
76-
"./configure",
77-
[`CC="sccache gcc"`, `CXX="sccache g++"`, "--ninja", "--shared"],
78-
"node",
79-
sccacheEnv
80-
);
74+
await spawnAsync("./configure", ["--ninja", "--shared"], "node");
8175

82-
await spawnAsync("make", [`-j${threadCount}`], "node", sccacheEnv);
76+
await spawnAsync("make", [`-j${threadCount}`], "node");

0 commit comments

Comments
 (0)