feat: install sccache on latest ubuntu arm

This commit is contained in:
Amin Yahyaabadi 2025-03-16 03:00:57 -07:00
parent 8115710285
commit 29c12dc98c
6 changed files with 26 additions and 13 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,17 +1,18 @@
import { getUbuntuVersion } from "ubuntu-version"
import { isUbuntu } from "../../utils/env/isUbuntu.js"
import type { InstallationInfo } from "../../utils/setup/setupBin.js"
import { testBin } from "../../utils/tests/test-helpers.js"
import { setupSccache } from "../sccache.js"
jest.setTimeout(300000)
describe("setup-sccache", () => {
if (process.platform === "linux" && process.arch === "arm64") {
it("should skip sccache tests on Linux arm64", () => {
expect(true).toBe(true)
})
return
}
it("should setup sccache", async () => {
const ubuntuVersion = isUbuntu() ? await getUbuntuVersion() : undefined
const ubuntuVersionMajor = ubuntuVersion?.[0] ?? 0
if (process.platform === "linux" && process.arch === "arm64" && ubuntuVersionMajor < 24) {
return
}
const installInfo = await setupSccache("", "", process.arch)
await testBin("sccache", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)

View File

@ -1,13 +1,25 @@
import { installAptPack } from "setup-apt"
import { installBrewPack } from "setup-brew"
import { getUbuntuVersion } from "ubuntu-version"
import { isUbuntu } from "../utils/env/isUbuntu.js"
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupSccache(version: string, _setupDir: string, _arch: string) {
export async function setupSccache(version: string, _setupDir: string, _arch: string) {
switch (process.platform) {
case "win32": {
return setupChocoPack("sccache", version)
}
case "linux":
case "linux": {
if (isUbuntu()) {
const ubuntuVersion = await getUbuntuVersion()
if (ubuntuVersion[0] >= 24) {
return installAptPack([{ name: "sccache", version }])
}
}
return installBrewPack("sccache", version)
}
case "darwin": {
return installBrewPack("sccache", version)
}