Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cmake-workflow/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,7 @@ inputs:

If the input is not specified, the action will use the value defined by the environment variable `CMAKE_RUN_TESTS`.

If the environment variable is also not specified, the action will attempt to run tests but will not fail if
there are no tests.
If the environment variable is also not specified, the action will run tests if there are any.

When the value is `true` or `false`, the action will also set the `configure-tests-flag` to `ON` or `OFF`.
When the value is undefined, the `configure-tests-flag` is ignored.
Expand Down
4 changes: 2 additions & 2 deletions cmake-workflow/dist/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions cmake-workflow/dist/index.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions cmake-workflow/src/process-entry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,14 +660,15 @@ describe('processEntry — test step', () => {
.rejects.toThrow('CMake tests failed with exit code 1');
});

it('does not throw on test failure when runTests is undefined', async () => {
it('throws on test failure when runTests is undefined', async () => {
mockedExec.getExecOutput
.mockResolvedValueOnce({ exitCode: 0, stdout: '', stderr: '' }) // configure
.mockResolvedValueOnce({ exitCode: 0, stdout: '', stderr: '' }) // build
.mockResolvedValueOnce({ exitCode: 1, stdout: '', stderr: '' }); // test

const entry = makeInputs({ runTests: undefined, is_main_entry: true });
await expect(processEntry(entry, makeSetupOutputs(), makeParams())).resolves.not.toThrow();
await expect(processEntry(entry, makeSetupOutputs(), makeParams()))
.rejects.toThrow('CMake tests failed with exit code 1');
});

it('calls createCMakeTestAnnotations', async () => {
Expand Down
2 changes: 1 addition & 1 deletion cmake-workflow/src/process-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ async function runTestStep(
if (entry.createAnnotations) {
createCMakeTestAnnotations(stdout, entry);
}
if (exitCode !== 0 && entry.runTests === true) {
if (exitCode !== 0) {
throw new ExpectedError(`CMake tests failed with exit code ${exitCode}. Check the test output above for details.`, 'CMake Tests Failed');
}
}
Expand Down
3 changes: 1 addition & 2 deletions cmake-workflow/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,7 @@ system.`

If the input is not specified, the action will use the value defined by the environment variable \`CMAKE_RUN_TESTS\`.

If the environment variable is also not specified, the action will attempt to run tests but will not fail if
there are no tests.
If the environment variable is also not specified, the action will run tests if there are any.

When the value is \`true\` or \`false\`, the action will also set the \`configure-tests-flag\` to \`ON\` or \`OFF\`.
When the value is undefined, the \`configure-tests-flag\` is ignored.`
Expand Down