feat: add meson installation

This commit is contained in:
Amin Yahyaabadi 2021-09-14 12:09:58 -05:00
parent 0c07dec72e
commit 5f6e3a7053
5 changed files with 43 additions and 3 deletions

View File

@ -17,9 +17,9 @@ The package will be usable from any environment (locally, GitHub Actions, etc).
- [x] setup ninja
- [x] setup llvm
- [x] setup conan
- [ ] setup gcc/mingw
- [x] setup meson
- [ ] setup msvc
- [ ] setup meson
- [ ] setup gcc/mingw
- [ ] setup vcpkg
- [ ] setup gcovr
- [ ] setup OpenCppCoverage

View File

@ -18,7 +18,10 @@ inputs:
default: "1.10.2"
required: false
conan:
description: "The concan version to install."
description: "The conan version to install."
required: false
meson:
description: "The meson version to install."
required: false
runs:

View File

@ -2,6 +2,7 @@ import * as core from "@actions/core"
import { setupCmake } from "./cmake/cmake"
import { setupConan } from "./conan/conan"
import { setupLLVM } from "./llvm/llvm"
import { setupMeson } from "./meson/meson"
import { setupNinja } from "./ninja/ninja"
function maybeGetInput(key: string) {
@ -33,6 +34,12 @@ export async function main(): Promise<number> {
await setupConan(conanVersion)
}
// setup meson
const mesonVersion = maybeGetInput("meson")
if (mesonVersion !== undefined) {
await setupMeson(mesonVersion)
}
// setup llvm
const llvmVersion = maybeGetInput("llvm")
if (llvmVersion !== undefined) {

View File

@ -0,0 +1,15 @@
import { setupMeson } from "../meson"
import { spawnSync as spawn } from "child_process"
jest.setTimeout(100000)
describe("setup-meson", () => {
it("should setup meson", async () => {
await setupMeson("0.59.1")
const { status } = spawn("meson", ["--version"], {
encoding: "utf8",
})
expect(status).toBe(0)
})
})

15
src/meson/meson.ts Normal file
View File

@ -0,0 +1,15 @@
import { setupPip } from "../utils/setup/setupPip"
import { addPath, startGroup, endGroup } from "@actions/core"
export async function setupMeson(version?: string) {
await setupPip("meson", version)
if (process.platform === "linux") {
try {
startGroup(`Add /home/runner/.local/bin to PATH`)
addPath("/home/runner/.local/bin/")
} finally {
endGroup()
}
}
}