Skip to content

Commit d005ada

Browse files
committed
Use CCache
1 parent 381cd01 commit d005ada

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

.github/workflows/scheduled-builds.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,42 @@ jobs:
1212
container:
1313
image: ubuntu:devel
1414
steps:
15+
- name: Restore CCache
16+
uses: actions/cache@v4
17+
with:
18+
path: .ccache
19+
key: ${{ runner.os }}:libnode:ccache:${{ github.run_number }}
20+
restore-keys: |
21+
${{ runner.os }}:libnode:ccache:
22+
1523
- name: Update system
1624
run: apt-get update && apt-get --yes upgrade
1725

1826
- name: Install Nodejs 21 repo
1927
run: apt-get install --yes ca-certificates curl gnupg && curl -sL https://deb.nodesource.com/setup_21.x | bash - && apt-get update
2028

2129
- name: Install building tools
22-
run: apt-get install --yes git python3 python3-pip gcc g++ make ninja-build nodejs
30+
run: apt-get install --yes git python3 python3-pip gcc g++ make ninja-build nodejs ccache
31+
32+
- name: Setup CCache
33+
run: |
34+
sudo update-ccache-symlinks
35+
echo "/usr/lib/ccache" >> "$GITHUB_PATH"
36+
37+
ccacheDir="${GITHUB_WORKSPACE}/.ccache"
38+
test -d "$ccacheDir" || mkdir "$ccacheDir"
39+
40+
echo "CCACHE_DIR=$ccacheDir" >> "$GITHUB_ENV"
2341
2442
- name: Clone the repo
2543
run: git clone https://github.com/devraymondsh/libnode-distributable
2644

2745
- name: Run the script
2846
run: cd libnode-distributable && node index.js
2947

48+
- name: Show CCache Status
49+
shell: bash
50+
run: ccache -s
51+
3052
- name: A buncha ls
3153
run: ls . ; ls .. ; ls out/Debug ; ls ../out/Debug

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ if (!syncFs.existsSync("node")) {
6666
);
6767
}
6868

69-
await spawnAsync("./configure", ["--ninja", "--shared", "--debug"], "node");
69+
await spawnAsync(
70+
"./configure",
71+
["--ninja", "--shared", "--debug", "CC='ccache gcc'", "CXX='ccache g++'"],
72+
"node"
73+
);
7074

7175
await spawnAsync("make", [`-j${threadCount}`], "node");

0 commit comments

Comments
 (0)