fix: use correct conan path

This commit is contained in:
2024-11-05 23:33:46 +13:00
parent 1e28f77086
commit f1b10b13b9
6 changed files with 36 additions and 4 deletions

View File

@@ -48,3 +48,15 @@ describe('getConanPlatform', () => {
expect(util.getConanPlatform()).toBe('linux') expect(util.getConanPlatform()).toBe('linux')
}) })
}) })
describe('getConanBinPath', () => {
it('should return an empty string for Windows', () => {
Object.defineProperty(process, 'platform', { value: 'win32' })
expect(util.getConanBinPath()).toBe('')
})
it('should return "/bin" for non-Windows platforms', () => {
Object.defineProperty(process, 'platform', { value: 'linux' })
expect(util.getConanBinPath()).toBe('/bin')
})
})

View File

@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20" role="img" aria-label="Coverage: 39.06%"><title>Coverage: 39.06%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#e05d44"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">39.06%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">39.06%</text></g></svg> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20" role="img" aria-label="Coverage: 43.47%"><title>Coverage: 43.47%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#e05d44"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">43.47%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">43.47%</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

12
dist/index.js generated vendored
View File

@@ -28374,6 +28374,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.run = run; exports.run = run;
const core = __importStar(__nccwpck_require__(7484)); const core = __importStar(__nccwpck_require__(7484));
const util = __importStar(__nccwpck_require__(4527));
const download_1 = __nccwpck_require__(1531); const download_1 = __nccwpck_require__(1531);
/** /**
* The main function for the action. * The main function for the action.
@@ -28386,7 +28387,7 @@ async function run() {
conanVersion = await (0, download_1.getLatestVersion)(); conanVersion = await (0, download_1.getLatestVersion)();
} }
const path = await (0, download_1.download)(conanVersion); const path = await (0, download_1.download)(conanVersion);
core.addPath(path); core.addPath(path + util.getConanBinPath());
} }
catch (error) { catch (error) {
if (error instanceof Error) if (error instanceof Error)
@@ -28406,6 +28407,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getPlatformExtension = getPlatformExtension; exports.getPlatformExtension = getPlatformExtension;
exports.getConanArchitecture = getConanArchitecture; exports.getConanArchitecture = getConanArchitecture;
exports.getConanPlatform = getConanPlatform; exports.getConanPlatform = getConanPlatform;
exports.getConanBinPath = getConanBinPath;
function getPlatformExtension() { function getPlatformExtension() {
switch (process.platform) { switch (process.platform) {
case 'win32': case 'win32':
@@ -28434,6 +28436,14 @@ function getConanPlatform() {
return 'linux'; return 'linux';
} }
} }
function getConanBinPath() {
switch (process.platform) {
case 'win32':
return '';
default:
return '/bin';
}
}
/***/ }), /***/ }),

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,5 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import * as util from './util'
import { download, getLatestVersion } from './download' import { download, getLatestVersion } from './download'
/** /**
@@ -14,7 +15,7 @@ export async function run(): Promise<void> {
} }
const path = await download(conanVersion) const path = await download(conanVersion)
core.addPath(path) core.addPath(path + util.getConanBinPath())
} catch (error) { } catch (error) {
if (error instanceof Error) core.setFailed(error.message) if (error instanceof Error) core.setFailed(error.message)
} }

View File

@@ -28,3 +28,12 @@ export function getConanPlatform(): string {
return 'linux' return 'linux'
} }
} }
export function getConanBinPath(): string {
switch (process.platform) {
case 'win32':
return ''
default:
return '/bin'
}
}