Skip to content

Commit

Permalink
Rename option publish_check to check_run
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoMi committed Dec 18, 2023
1 parent c0636b4 commit 4623574
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ jobs:
-e "INPUT_DEDUPLICATE_CLASSES_BY_FILE_NAME" \
-e "INPUT_LARGE_FILES" \
-e "INPUT_IGNORE_RUNS" \
-e "INPUT_CHECK_RUN" \
-e "INPUT_JOB_SUMMARY" \
-e "INPUT_PUBLISH_CHECK" \
-e "INPUT_COMPARE_TO_EARLIER_COMMIT" \
-e "INPUT_PULL_REQUEST_BUILD" \
-e "INPUT_EVENT_FILE" \
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ Those are highlighted in pull request comments to easily spot unintended test re

***Note:** This requires `check_run_annotations` to be set to `all tests, skipped tests`.*

Comments can be disabled with `comment_mode: off`.

### Commit and pull request checks

The checks section of a commit and related pull requests list a short summary (here `1 fail, 1 skipped, …`),
Expand All @@ -198,6 +200,8 @@ Pull request checks:

![pull request checks example](misc/github-pull-request-checks.png)

Check runs can be disabled with `check_run: false`.

### Commit and pull request annotations

Each failing test produces an annotation with failure details in the checks section of a commit:
Expand All @@ -213,6 +217,8 @@ Use option `test_file_prefix` to add a prefix to, or remove a prefix from these

***Note:** Only the first failure of a test is shown. If you want to see all failures, set `report_individual_runs: "true"`.*

Check run annotations can be disabled with `ignore_runs: true`.

### GitHub Actions job summary

The results are added to the job summary page of the workflow that runs this action:
Expand All @@ -223,12 +229,16 @@ In presence of failures or errors, the job summary links to the respective [chec

***Note:** Job summary requires [GitHub Actions runner v2.288.0](https://github.com/actions/runner/releases/tag/v2.288.0) or above.*

Job summaries can be disabled with `job_summary: false`.

### GitHub Actions check summary of a commit

Test results are published in the GitHub Actions check summary of the respective commit:

![checks comment example](misc/github-checks-comment.png)

Check runs can be disabled with `check_run: false`.

## The symbols
[comment]: <> (This heading is linked to from method get_link_and_tooltip_label_md)

Expand Down Expand Up @@ -295,8 +305,8 @@ The list of most notable options:
|:-----|:-----:|:----------|
|`time_unit`|`seconds`|Time values in the test result files have this unit. Supports `seconds` and `milliseconds`.|
|`test_file_prefix`|`none`|Paths in the test result files should be relative to the git repository for annotations to work best. This prefix is added to (if starting with "+"), or remove from (if starting with "-") test file paths. Examples: "+src/" or "-/opt/actions-runner".|
|`check_run`|`true`|Set to `true`, the results are published as a check run, but it may not be associated with the workflow that ran this action.|
|`job_summary`|`true`|Set to `true`, the results are published as part of the [job summary page](https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/) of the workflow run.|
|`publish_check`|`true`|Set to `true`, the results are published as another check in the reference, but may not be associated with the workflow which triggered it.|
|`compare_to_earlier_commit`|`true`|Test results are compared to results of earlier commits to show changes:<br/>`false` - disable comparison, `true` - compare across commits.'|
|`test_changes_limit`|`10`|Limits the number of removed or skipped tests reported on pull request comments. This report can be disabled with a value of `0`.|
|`report_individual_runs`|`false`|Individual runs of the same test may see different failures. Reports all individual failures when set `true`, and the first failure only otherwise.|
Expand Down
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ inputs:
description: 'Does not collect test run information from the test result files, which is useful for very large files. This disables any check run annotations.'
default: 'false'
required: false
job_summary:
description: 'Set to "true", the results are published as part of the job summary page of the workflow run.'
check_run:
description: 'Set to "true", the results are published as a check run, but it may not be associated with the workflow that ran this action.'
default: 'true'
required: false
publish_check:
description: 'Set to "true", the results are published as a check run, not may not be associated with the workflow which initiated it.'
job_summary:
description: 'Set to "true", the results are published as part of the job summary page of the workflow run.'
default: 'true'
required: false
compare_to_earlier_commit:
Expand Down
10 changes: 5 additions & 5 deletions composite/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ inputs:
description: 'Does not collect test run information from the test result files, which is useful for very large files. This disables any check run annotations.'
default: 'false'
required: false
job_summary:
description: 'Set to "true", the results are published as part of the job summary page of the workflow run.'
check_run:
description: 'Set to "true", the results are published as a check run, but it may not be associated with the workflow that ran this action.'
default: 'true'
required: false
publish_check:
description: 'Set to "true", the results are published as a check run, not may not be associated with the workflow which initiated it.'
job_summary:
description: 'Set to "true", the results are published as part of the job summary page of the workflow run.'
default: 'true'
required: false
compare_to_earlier_commit:
Expand Down Expand Up @@ -297,8 +297,8 @@ runs:
JSON_THOUSANDS_SEPARATOR: ${{ inputs.json_thousands_separator }}
JSON_SUITE_DETAILS: ${{ inputs.json_suite_details }}
JSON_TEST_CASE_RESULTS: ${{ inputs.json_test_case_results }}
CHECK_RUN: ${{ inputs.check_run }}
JOB_SUMMARY: ${{ inputs.job_summary }}
PUBLISH_CHECK: ${{ inputs.publish_check }}
SEARCH_PULL_REQUESTS: ${{ inputs.search_pull_requests }}
# not documented
ROOT_LOG_LEVEL: ${{ inputs.root_log_level }}
Expand Down
4 changes: 2 additions & 2 deletions python/publish/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class Settings:
check_name: str
comment_title: str
comment_mode: str
check_run: bool
job_summary: bool
publish_check: bool
compare_earlier: bool
pull_request_build: str
test_changes_limit: int
Expand Down Expand Up @@ -199,7 +199,7 @@ def publish(self,

check_run = None
before_check_run = None
if self._settings.publish_check:
if self._settings.check_run:
if self._settings.is_fork:
# running on a fork, we cannot publish the check, but we can still read before_check_run
# bump the version if you change the target of this link (if it did not exist already) or change the section
Expand Down
4 changes: 2 additions & 2 deletions python/publish_test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ def get_settings(options: dict, gha: GithubAction) -> Settings:
event = json.load(f)

repo = get_var('GITHUB_REPOSITORY', options)
check_run = get_bool_var('CHECK_RUN', options, default=True)
job_summary = get_bool_var('JOB_SUMMARY', options, default=True)
publish_check = get_bool_var('PUBLISH_CHECK', options, default=True)
comment_mode = get_var('COMMENT_MODE', options) or comment_mode_always

# we cannot create a check run or pull request comment when running on pull_request event from a fork
Expand Down Expand Up @@ -475,8 +475,8 @@ def get_settings(options: dict, gha: GithubAction) -> Settings:
check_name=check_name,
comment_title=get_var('COMMENT_TITLE', options) or check_name,
comment_mode=comment_mode,
check_run=check_run,
job_summary=job_summary,
publish_check=publish_check,
compare_earlier=get_bool_var('COMPARE_TO_EARLIER_COMMIT', options, default=True),
pull_request_build=get_var('PULL_REQUEST_BUILD', options) or 'merge',
test_changes_limit=int(test_changes_limit),
Expand Down
22 changes: 11 additions & 11 deletions python/test/test_action_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ def get_settings(token='token',
check_name='check name',
comment_title='title',
comment_mode=comment_mode_always,
check_run=True,
job_summary=True,
publish_check=True,
compare_earlier=True,
test_changes_limit=10,
pull_request_build=pull_request_build_mode_merge,
Expand Down Expand Up @@ -234,8 +234,8 @@ def get_settings(token='token',
check_name=check_name,
comment_title=comment_title,
comment_mode=comment_mode,
check_run=check_run,
job_summary=job_summary,
publish_check=publish_check,
compare_earlier=compare_earlier,
pull_request_build=pull_request_build,
test_changes_limit=test_changes_limit,
Expand Down Expand Up @@ -458,6 +458,15 @@ def test_get_settings_compare_to_earlier_commit(self):
self.do_test_get_settings(COMPARE_TO_EARLIER_COMMIT='foo', expected=self.get_settings(compare_earlier=True), warning=warning, exception=RuntimeError)
self.do_test_get_settings(COMPARE_TO_EARLIER_COMMIT=None, expected=self.get_settings(compare_earlier=True))

def test_get_settings_check_run(self):
warning = 'Option check_run has to be boolean, so either "true" or "false": foo'
self.do_test_get_settings(CHECK_RUN='false', expected=self.get_settings(check_run=False))
self.do_test_get_settings(CHECK_RUN='False', expected=self.get_settings(check_run=False))
self.do_test_get_settings(CHECK_RUN='true', expected=self.get_settings(check_run=True))
self.do_test_get_settings(CHECK_RUN='True', expected=self.get_settings(check_run=True))
self.do_test_get_settings(CHECK_RUN='foo', expected=self.get_settings(check_run=True), warning=warning, exception=RuntimeError)
self.do_test_get_settings(CHECK_RUN=None, expected=self.get_settings(check_run=True))

def test_get_settings_job_summary(self):
warning = 'Option job_summary has to be boolean, so either "true" or "false": foo'
self.do_test_get_settings(JOB_SUMMARY='false', expected=self.get_settings(job_summary=False))
Expand All @@ -467,15 +476,6 @@ def test_get_settings_job_summary(self):
self.do_test_get_settings(JOB_SUMMARY='foo', expected=self.get_settings(job_summary=True), warning=warning, exception=RuntimeError)
self.do_test_get_settings(JOB_SUMMARY=None, expected=self.get_settings(job_summary=True))

def test_get_settings_publish_check(self):
warning = 'Option publish_check has to be boolean, so either "true" or "false": foo'
self.do_test_get_settings(PUBLISH_CHECK='false', expected=self.get_settings(publish_check=False))
self.do_test_get_settings(PUBLISH_CHECK='False', expected=self.get_settings(publish_check=False))
self.do_test_get_settings(PUBLISH_CHECK='true', expected=self.get_settings(publish_check=True))
self.do_test_get_settings(PUBLISH_CHECK='True', expected=self.get_settings(publish_check=True))
self.do_test_get_settings(PUBLISH_CHECK='foo', expected=self.get_settings(publish_check=True), warning=warning, exception=RuntimeError)
self.do_test_get_settings(PUBLISH_CHECK=None, expected=self.get_settings(publish_check=True))

def test_get_settings_report_individual_runs(self):
warning = 'Option report_individual_runs has to be boolean, so either "true" or "false": foo'
self.do_test_get_settings(REPORT_INDIVIDUAL_RUNS='false', expected=self.get_settings(report_individual_runs=False))
Expand Down
8 changes: 4 additions & 4 deletions python/test/test_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def create_github_pr(repo: str,
@staticmethod
def create_settings(actor='actor',
comment_mode=comment_mode_always,
check_run=True,
job_summary=True,
publish_check=True,
compare_earlier=True,
report_individual_runs=False,
dedup_classes_by_file_name=False,
Expand Down Expand Up @@ -125,8 +125,8 @@ def create_settings(actor='actor',
check_name='Check Name',
comment_title='Comment Title',
comment_mode=comment_mode,
check_run=check_run,
job_summary=job_summary,
publish_check=publish_check,
compare_earlier=compare_earlier,
pull_request_build=pull_request_build,
test_changes_limit=test_changes_limit,
Expand Down Expand Up @@ -503,8 +503,8 @@ def test_publish_without_job_summary_and_comment_on_fork(self):
self.assertEqual(('before', ), args)
self.assertEqual({}, kwargs)

def test_publish_without_publish_check_job_summary_and_comment(self):
settings = self.create_settings(comment_mode=comment_mode_off, job_summary=False, publish_check=False)
def test_publish_without_check_run_job_summary_and_comment(self):
settings = self.create_settings(comment_mode=comment_mode_off, job_summary=False, check_run=False)
mock_calls = self.call_mocked_publish(settings, prs=[object()])

self.assertEqual(0, len(mock_calls))
Expand Down

0 comments on commit 4623574

Please sign in to comment.