Skip to content

Commit d11e5d7

Browse files
authored
Merge pull request #373 from aminya/linux-arm-ci
feat: install sccache on latest ubuntu arm
2 parents a63071e + 29c12dc commit d11e5d7

File tree

6 files changed

+26
-13
lines changed

6 files changed

+26
-13
lines changed

dist/legacy/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/modern/setup-cpp.mjs.map

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/sccache/__tests__/sccache.test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1+
import { getUbuntuVersion } from "ubuntu-version"
2+
import { isUbuntu } from "../../utils/env/isUbuntu.js"
13
import type { InstallationInfo } from "../../utils/setup/setupBin.js"
24
import { testBin } from "../../utils/tests/test-helpers.js"
35
import { setupSccache } from "../sccache.js"
46

57
jest.setTimeout(300000)
68
describe("setup-sccache", () => {
7-
if (process.platform === "linux" && process.arch === "arm64") {
8-
it("should skip sccache tests on Linux arm64", () => {
9-
expect(true).toBe(true)
10-
})
11-
return
12-
}
13-
149
it("should setup sccache", async () => {
10+
const ubuntuVersion = isUbuntu() ? await getUbuntuVersion() : undefined
11+
const ubuntuVersionMajor = ubuntuVersion?.[0] ?? 0
12+
if (process.platform === "linux" && process.arch === "arm64" && ubuntuVersionMajor < 24) {
13+
return
14+
}
15+
1516
const installInfo = await setupSccache("", "", process.arch)
1617

1718
await testBin("sccache", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)

src/sccache/sccache.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
1+
import { installAptPack } from "setup-apt"
12
import { installBrewPack } from "setup-brew"
3+
import { getUbuntuVersion } from "ubuntu-version"
4+
import { isUbuntu } from "../utils/env/isUbuntu.js"
25
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
36

47
// eslint-disable-next-line @typescript-eslint/no-unused-vars
5-
export function setupSccache(version: string, _setupDir: string, _arch: string) {
8+
export async function setupSccache(version: string, _setupDir: string, _arch: string) {
69
switch (process.platform) {
710
case "win32": {
811
return setupChocoPack("sccache", version)
912
}
10-
case "linux":
13+
case "linux": {
14+
if (isUbuntu()) {
15+
const ubuntuVersion = await getUbuntuVersion()
16+
if (ubuntuVersion[0] >= 24) {
17+
return installAptPack([{ name: "sccache", version }])
18+
}
19+
}
20+
21+
return installBrewPack("sccache", version)
22+
}
1123
case "darwin": {
1224
return installBrewPack("sccache", version)
1325
}

0 commit comments

Comments
 (0)