mirror of https://github.com/aminya/setup-cpp
Merge pull request #192 from aminya/windows [skip ci]
This commit is contained in:
commit
3ef62e765f
|
@ -193,6 +193,8 @@ jobs:
|
||||||
- name: Tests
|
- name: Tests
|
||||||
run: |
|
run: |
|
||||||
pnpm run test
|
pnpm run test
|
||||||
|
env:
|
||||||
|
RUNNER_OS_NAME: ${{ matrix.os }}
|
||||||
|
|
||||||
- name: Setup Node 12
|
- name: Setup Node 12
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
|
|
|
@ -1,70 +1,39 @@
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { setupMSVC } from "../msvc"
|
import { setupMSVC } from "../msvc"
|
||||||
|
import { runnerWindowsVersion } from "../../utils/tests/test-helpers"
|
||||||
|
import { warning } from "ci-log"
|
||||||
|
|
||||||
jest.setTimeout(300000)
|
jest.setTimeout(300000)
|
||||||
describe("setup-msvc", () => {
|
describe("setup-msvc", () => {
|
||||||
|
const isWindows = process.platform === "win32"
|
||||||
|
|
||||||
it("should setup the pre-installed msvc", async () => {
|
it("should setup the pre-installed msvc", async () => {
|
||||||
try {
|
try {
|
||||||
if (process.platform !== "win32") {
|
if (!isWindows) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await setupMSVC("", "", process.arch)
|
await setupMSVC("", "", process.arch)
|
||||||
console.log(which.sync("cl"))
|
console.log(which.sync("cl"))
|
||||||
} catch (e) {
|
} catch (err) {
|
||||||
// TODO
|
if ("toString" in (err as any)) {
|
||||||
console.error(e)
|
warning((err as any).toString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should setup msvc 2022", async () => {
|
for (const version of [2022, 2019, 2017, 2015]) {
|
||||||
try {
|
it(`should setup msvc ${version}`, async () => {
|
||||||
if (process.platform !== "win32") {
|
if (!isWindows || (runnerWindowsVersion() !== undefined && runnerWindowsVersion()! > version)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await setupMSVC("2022", "", process.arch)
|
try {
|
||||||
console.log(which.sync("cl"))
|
await setupMSVC(`${version}`, "", process.arch)
|
||||||
} catch (e) {
|
console.log(which.sync("cl"))
|
||||||
// TODO
|
} catch (err) {
|
||||||
console.error(e)
|
if ("toString" in (err as any)) {
|
||||||
}
|
warning((err as any).toString())
|
||||||
})
|
}
|
||||||
|
|
||||||
it("should setup msvc 2019", async () => {
|
|
||||||
try {
|
|
||||||
if (process.platform !== "win32") {
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
await setupMSVC("2019", "", process.arch)
|
})
|
||||||
console.log(which.sync("cl"))
|
}
|
||||||
} catch (e) {
|
|
||||||
// TODO
|
|
||||||
console.error(e)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
it("should setup msvc 2017", async () => {
|
|
||||||
try {
|
|
||||||
if (process.platform !== "win32") {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
await setupMSVC("2017", "", process.arch)
|
|
||||||
console.log(which.sync("cl"))
|
|
||||||
} catch (e) {
|
|
||||||
// TODO
|
|
||||||
console.error(e)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
it("should setup msvc 2015", async () => {
|
|
||||||
try {
|
|
||||||
if (process.platform !== "win32") {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
await setupMSVC("2015", "", process.arch)
|
|
||||||
console.log(which.sync("cl"))
|
|
||||||
} catch (e) {
|
|
||||||
// TODO
|
|
||||||
console.error(e)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -56,3 +56,15 @@ export async function testBin(
|
||||||
throw new Error(`Failed to test bin ${name}: ${err}`)
|
throw new Error(`Failed to test bin ${name}: ${err}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function runnerWindowsVersion() {
|
||||||
|
if (process.platform !== "win32") {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
const maybeVersionString = process.env.RUNNER_OS_NAME?.split("-")[1]
|
||||||
|
if (maybeVersionString === undefined) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
return parseInt(maybeVersionString, 10)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue