fix: return installation directory for pip packages

This commit is contained in:
Amin Yahyaabadi 2021-09-16 11:14:08 -05:00
parent 8e56d264af
commit bf63dd58d3
6 changed files with 22 additions and 13 deletions

View File

@ -1,11 +1,12 @@
import { setupConan } from "../conan" import { setupConan } from "../conan"
import { testBin } from "../../utils/tests/test-helpers" import { testBin } from "../../utils/tests/test-helpers"
import { InstallationInfo } from "../../utils/setup/setupBin"
jest.setTimeout(200000) jest.setTimeout(200000)
describe("setup-conan", () => { describe("setup-conan", () => {
it("should setup conan", async () => { it("should setup conan", async () => {
await setupConan("1.40.1", "", "") const installInfo = await setupConan("", "", "")
await testBin("conan") await testBin("conan", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
}) })
}) })

View File

@ -1,6 +1,6 @@
import { setupPipPack } from "../utils/setup/setupPipPack" import { setupPipPack } from "../utils/setup/setupPipPack"
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupConan(version: string | undefined, _setupCppDir: string, _arch: string) { export function setupConan(version: string | undefined, _setupCppDir: string, _arch: string) {
await setupPipPack("conan", version) return setupPipPack("conan", version)
} }

View File

@ -1,11 +1,11 @@
import { setupGcovr } from "../gcovr" import { setupGcovr } from "../gcovr"
import { testBin } from "../../utils/tests/test-helpers" import { testBin } from "../../utils/tests/test-helpers"
import { InstallationInfo } from "../../utils/setup/setupBin"
jest.setTimeout(200000) jest.setTimeout(200000)
describe("setup-gcovr", () => { describe("setup-gcovr", () => {
it("should setup gcovr", async () => { it("should setup gcovr", async () => {
await setupGcovr("5.0", "", "") const installInfo = await setupGcovr("", "", "")
await testBin("gcovr", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
await testBin("gcovr")
}) })
}) })

View File

@ -1,10 +1,12 @@
import { setupMeson } from "../meson" import { setupMeson } from "../meson"
import { testBin } from "../../utils/tests/test-helpers" import { testBin } from "../../utils/tests/test-helpers"
import { InstallationInfo } from "../../utils/setup/setupBin"
jest.setTimeout(200000) jest.setTimeout(200000)
describe("setup-meson", () => { describe("setup-meson", () => {
it("should setup meson", async () => { it("should setup meson", async () => {
await setupMeson("0.59.1", "", "") const installInfo = await setupMeson("", "", "")
await testBin("meson")
await testBin("meson", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
}) })
}) })

View File

@ -1,6 +1,6 @@
import { setupPipPack } from "../utils/setup/setupPipPack" import { setupPipPack } from "../utils/setup/setupPipPack"
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupMeson(version: string | undefined, _setupCppDir: string, _arch: string) { export function setupMeson(version: string | undefined, _setupCppDir: string, _arch: string) {
await setupPipPack("meson", version) return setupPipPack("meson", version)
} }

View File

@ -26,12 +26,18 @@ export async function setupPipPack(name: string, version?: string) {
throw new Error(`Failed to install ${name} ${version}`) throw new Error(`Failed to install ${name} ${version}`)
} }
let binDir: string | undefined
if (process.platform === "linux") { if (process.platform === "linux") {
try { try {
startGroup(`Add /home/runner/.local/bin to PATH`) binDir = "/home/runner/.local/bin/"
addPath("/home/runner/.local/bin/") startGroup(`${binDir} to PATH`)
addPath(binDir)
} finally { } finally {
endGroup() endGroup()
} }
} else if (process.platform === "darwin") {
binDir = "/usr/local/bin/"
} }
return binDir
} }