Skip to content

Commit

Permalink
fix: fix the version check for vcpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Aug 12, 2024
1 parent 040d331 commit 7e559c0
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion dist/actions/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/actions/setup-cpp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/legacy/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/legacy/setup-cpp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modern/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modern/setup-cpp.js.map

Large diffs are not rendered by default.

24 changes: 16 additions & 8 deletions src/vcpkg/__tests__/vcpkg.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { setupVcpkg } from "../vcpkg"

jest.setTimeout(300000)
async function testVcpkg(directory: string) {
const { binDir } = await setupVcpkg("", directory, "")
await testBin("vcpkg", ["--version"], binDir)
return binDir
}

describe("setup-vcpkg", () => {
let directory: string
beforeAll(async () => {
beforeEach(async () => {
directory = await setupTmpDir("vcpkg")
})

it("should setup vcpkg", async () => {
await testVcpkg(directory)
console.log(!("true" in ["", "true"]))
const { binDir } = await setupVcpkg("", directory, "")
await testBin("vcpkg", ["--version"], binDir)
return binDir
})

it("should setup vcpkg with specific version", async () => {
const { binDir } = await setupVcpkg("e590c2b30c08caf1dd8d612ec602a003f9784b7d", directory, "")
await testBin("vcpkg", ["--version"], binDir)
return binDir
})

afterEach(async () => {
await cleanupTmpDir(directory)
})
})
2 changes: 1 addition & 1 deletion src/vcpkg/vcpkg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function setupVcpkg(version: string, setupDir: string, _arch: strin
}

// if version specified, checkout the version
if (!(version in ["", "true"])) {
if (version !== "" && version !== "true") {
info(`Checking out vcpkg version ${version}`)
execaSync("git", ["checkout", version], {
cwd: setupDir,
Expand Down

0 comments on commit 7e559c0

Please sign in to comment.