Skip to content

Commit a3fa95b

Browse files
committed
update input and add test
1 parent c848652 commit a3fa95b

3 files changed

Lines changed: 29 additions & 6 deletions

File tree

.github/workflows/bat.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,36 @@ jobs:
4040
Simulink
4141
Simulink_Test
4242
Simulink_Coverage
43+
- name: Clear job summary
44+
run: echo "" > "$GITHUB_STEP_SUMMARY"
45+
shell: bash
46+
- name: Run MATLAB Tests with job summary disabled
47+
continue-on-error: true
48+
uses: ./
49+
with:
50+
generate-job-summary: false
51+
- name: Verify no job summary is generated when disabled
52+
run: |
53+
set -e
54+
if grep -q "MATLAB Test Results" "$GITHUB_STEP_SUMMARY"; then
55+
echo "Job summary should not have been generated" && exit 1
56+
fi
57+
shell: bash
58+
- name: Clear job summary
59+
run: echo "" > "$GITHUB_STEP_SUMMARY"
60+
shell: bash
4361
- name: Run MATLAB Tests
4462
continue-on-error: true
4563
uses: ./
4664
with:
4765
source-folder: sample
4866
startup-options: -logfile output.log
4967
code-coverage-metric-level: mcdc # new option to configure metric level
68+
- name: Verify job summary is generated by default
69+
run: |
70+
set -e
71+
grep -q "MATLAB Test Results" "$GITHUB_STEP_SUMMARY"
72+
shell: bash
5073
- name: Verify option application
5174
run: |
5275
set -e

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ inputs:
8484
Startup options for MATLAB
8585
required: false
8686
default: ""
87-
opt-out-of-test-results-summary:
87+
generate-job-summary:
8888
description: >-
89-
Whether to opt out of the test results summary in the GitHub Action UI
89+
Whether to generate a job summary with test results and code coverage information
9090
required: false
91-
default: false
91+
default: true
9292
code-coverage-metric-level:
9393
description: >-
9494
Level of coverage metrics to collect

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async function run() {
3131
LoggingLevel: core.getInput("logging-level"),
3232
};
3333

34-
const optOutOfTestResultsSummary = core.getBooleanInput("opt-out-of-test-results-summary");
34+
const generateJobSummary = core.getBooleanInput("generate-job-summary");
3535
var codeCoverageMetricLevel = core.getInput("code-coverage-metric-level").toLowerCase();
3636

3737
// Validate metric level
@@ -66,12 +66,12 @@ async function run() {
6666
startupOptions,
6767
)
6868
.finally(() => {
69-
if (!optOutOfTestResultsSummary) {
69+
if (generateJobSummary) {
7070
const runnerTemp = process.env.RUNNER_TEMP || "";
7171
const runId = process.env.GITHUB_RUN_ID || "";
7272
const actionName = process.env.GITHUB_ACTION || "";
7373

74-
//add test results and code coverage view
74+
// Generate test results and code coverage view
7575
testResultsSummary.processAndAddTestSummary(
7676
runnerTemp,
7777
runId,

0 commit comments

Comments
 (0)