diff --git a/README.md b/README.md index f3d85b19..1aa1b67b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/action.yml b/action.yml index db8c4ce3..3ae8202b 100644 --- a/action.yml +++ b/action.yml @@ -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: diff --git a/src/main.ts b/src/main.ts index 86396bde..cffd2a63 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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 { await setupConan(conanVersion) } + // setup meson + const mesonVersion = maybeGetInput("meson") + if (mesonVersion !== undefined) { + await setupMeson(mesonVersion) + } + // setup llvm const llvmVersion = maybeGetInput("llvm") if (llvmVersion !== undefined) { diff --git a/src/meson/__tests__/meson.test.ts b/src/meson/__tests__/meson.test.ts new file mode 100644 index 00000000..d3ca9061 --- /dev/null +++ b/src/meson/__tests__/meson.test.ts @@ -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) + }) +}) diff --git a/src/meson/meson.ts b/src/meson/meson.ts new file mode 100644 index 00000000..d4eda9d7 --- /dev/null +++ b/src/meson/meson.ts @@ -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() + } + } +}