mirror of https://github.com/aminya/setup-cpp
feat: add conan installation
This commit is contained in:
parent
4927f3a272
commit
0c07dec72e
|
@ -16,9 +16,9 @@ The package will be usable from any environment (locally, GitHub Actions, etc).
|
|||
- [x] setup cmake
|
||||
- [x] setup ninja
|
||||
- [x] setup llvm
|
||||
- [x] setup conan
|
||||
- [ ] setup gcc/mingw
|
||||
- [ ] setup msvc
|
||||
- [ ] setup conan
|
||||
- [ ] setup meson
|
||||
- [ ] setup vcpkg
|
||||
- [ ] setup gcovr
|
||||
|
|
|
@ -16,7 +16,10 @@ inputs:
|
|||
ninja:
|
||||
description: "The ninja version to install."
|
||||
default: "1.10.2"
|
||||
required: true
|
||||
required: false
|
||||
conan:
|
||||
description: "The concan version to install."
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: "node12"
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import { setupConan } from "../conan"
|
||||
import { spawnSync as spawn } from "child_process"
|
||||
|
||||
jest.setTimeout(100000)
|
||||
|
||||
describe("setup-conan", () => {
|
||||
it("should setup conan", async () => {
|
||||
await setupConan("1.40.1")
|
||||
|
||||
const { status } = spawn("conan", ["--version"], {
|
||||
encoding: "utf8",
|
||||
})
|
||||
expect(status).toBe(0)
|
||||
})
|
||||
})
|
|
@ -0,0 +1,15 @@
|
|||
import { setupPip } from "../utils/setup/setupPip"
|
||||
import { addPath, startGroup, endGroup } from "@actions/core"
|
||||
|
||||
export async function setupConan(version?: string) {
|
||||
await setupPip("conan", version)
|
||||
|
||||
if (process.platform === "linux") {
|
||||
try {
|
||||
startGroup(`Add /home/runner/.local/bin to PATH`)
|
||||
addPath("/home/runner/.local/bin/")
|
||||
} finally {
|
||||
endGroup()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import * as core from "@actions/core"
|
||||
import { setupCmake } from "./cmake/cmake"
|
||||
import { setupConan } from "./conan/conan"
|
||||
import { setupLLVM } from "./llvm/llvm"
|
||||
import { setupNinja } from "./ninja/ninja"
|
||||
|
||||
|
@ -26,6 +27,12 @@ export async function main(): Promise<number> {
|
|||
await setupNinja(ninjaVersion, setupCppDir)
|
||||
}
|
||||
|
||||
// setup conan
|
||||
const conanVersion = maybeGetInput("conan")
|
||||
if (conanVersion !== undefined) {
|
||||
await setupConan(conanVersion)
|
||||
}
|
||||
|
||||
// setup llvm
|
||||
const llvmVersion = maybeGetInput("llvm")
|
||||
if (llvmVersion !== undefined) {
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import { exec } from "@actions/exec"
|
||||
|
||||
/** A function that installs a package using pip */
|
||||
export async function setupPip(name: string, version?: string) {
|
||||
// pip3 install conan --upgrade
|
||||
|
||||
const exit = await exec("pip", ["install", "--user", version !== undefined ? `${name}==${version}` : name])
|
||||
if (exit !== 0) {
|
||||
throw new Error(`Failed to install ${name} ${version}`)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue