diff --git a/.gitignore b/.gitignore index a44a138..2b2207c 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,9 @@ typings/ # Secret files .secrets + +# bin folder +bin/ + +# obj folder +obj/ \ No newline at end of file diff --git a/__tests__/cake.test.ts b/__tests__/cake.test.ts index 2cd8736..a768c16 100644 --- a/__tests__/cake.test.ts +++ b/__tests__/cake.test.ts @@ -1,16 +1,15 @@ +import * as path from 'path'; import { exec } from '@actions/exec'; import { which } from '@actions/io'; -import * as path from 'path'; - import * as cake from '../src/cake'; -import { CakeArgument, CakeSwitch } from '../src/cakeParameter'; -import { CakeToolSettings } from '../src/cakeToolSettings'; import { ToolsDirectory } from '../src/toolsDirectory'; +import { CakeToolSettings } from '../src/cakeToolSettings'; +import { CakeArgument, CakeSwitch } from '../src/cakeParameter'; const pathToLocalToolsDirectory = path.join('path', 'to', 'tool'); const pathToLocalTool = path.join(pathToLocalToolsDirectory, 'dotnet-cake'); -const dotnetManifestCake = 'dotnet tool run dotnet-cake'; const pathToCsprojFile = path.join('build', 'Build.csproj'); +const dotnetManifestCake = 'dotnet tool run dotnet-cake'; const dotnetRun = 'dotnet run'; jest.mock('@actions/exec'); @@ -212,6 +211,7 @@ describe('When running a Cake Frosting project successfully', () => { '--no-launch-profile', '--verbosity', 'minimal', '--configuration', 'Release', + '--', `--paths_tools="${fakeToolsDirectory.path}"` ]); }); @@ -230,6 +230,7 @@ describe('When running a Cake Frosting project successfully', () => { '--no-launch-profile', '--verbosity', 'minimal', '--configuration', 'Release', + '--', `--paths_tools="${fakeToolsDirectory.path}"`, '--param=arg', '--switch' @@ -244,7 +245,7 @@ describe('When failing to run a Cake Frosting Project', () => { fakeExec.mockReturnValue(Promise.resolve(-21)); }); - test('it should throw error when csproj-path does not exist', async () => { + test('it should throw an error containing the exit code', async () => { await expect(cake.runProject('', new ToolsDirectory())).rejects.toThrow('-21'); }); }); diff --git a/dist/index.js b/dist/index.js index 60f91a8..190e08f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4096,6 +4096,7 @@ function runProject(csprojPath, toolsDir, ...params) { '--no-launch-profile', '--verbosity', 'minimal', '--configuration', 'Release', + '--', `--paths_tools="${toolsDir}"`, ...cakeParams ]); @@ -4454,13 +4455,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge Object.defineProperty(exports, "__esModule", ({ value: true })); exports.run = void 0; const core = __importStar(__nccwpck_require__(2186)); -const action = __importStar(__nccwpck_require__(7672)); -const cake = __importStar(__nccwpck_require__(9275)); -const cakeTool = __importStar(__nccwpck_require__(4574)); +const toolsDirectory_1 = __nccwpck_require__(6745); const cakeToolSettings_1 = __nccwpck_require__(6881); -const dotnet = __importStar(__nccwpck_require__(9870)); const guards_1 = __nccwpck_require__(3265); -const toolsDirectory_1 = __nccwpck_require__(6745); +const dotnet = __importStar(__nccwpck_require__(9870)); +const cakeTool = __importStar(__nccwpck_require__(4574)); +const cake = __importStar(__nccwpck_require__(9275)); +const action = __importStar(__nccwpck_require__(7672)); function run() { return __awaiter(this, void 0, void 0, function* () { try { @@ -4474,16 +4475,16 @@ function run() { const cakeToolSettings = new cakeToolSettings_1.CakeToolSettings(toolsDir, (version === null || version === void 0 ? void 0 : version.version) === 'tool-manifest'); dotnet.disableTelemetry(); dotnet.disableWelcomeMessage(); - if (!csprojPath) { + if (csprojPath) { + yield cake.runProject(csprojPath, toolsDir, ...inputs.scriptArguments); + } + else { yield cakeTool.install(toolsDir, version); if (bootstrap === 'explicit') { yield cake.bootstrapScript(scriptPath, cakeToolSettings); } yield cake.runScript(scriptPath, cakeToolSettings, ...inputs.scriptArguments); } - else { - yield cake.runProject(csprojPath, toolsDir, ...inputs.scriptArguments); - } } catch (error) { if ((0, guards_1.isError)(error)) { diff --git a/src/action.ts b/src/action.ts index 2cedfc7..319a184 100644 --- a/src/action.ts +++ b/src/action.ts @@ -1,5 +1,4 @@ import * as core from '@actions/core'; - import * as script from './cakeParameter'; import * as input from './input'; diff --git a/src/cake.ts b/src/cake.ts index 7ff30e2..5bf51e5 100644 --- a/src/cake.ts +++ b/src/cake.ts @@ -33,6 +33,7 @@ export async function runProject( '--no-launch-profile', '--verbosity', 'minimal', '--configuration', 'Release', + '--', `--paths_tools="${toolsDir}"`, ...cakeParams ]);