Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure CI workflow passes #30

Merged
merged 1 commit into from
Dec 27, 2023
Merged

Ensure CI workflow passes #30

merged 1 commit into from
Dec 27, 2023

Conversation

ChrisBAshton
Copy link
Contributor

For a long time, GOV.UK had a convention whereby repositories had to specify a status check called 'test', which should be the name of the CI job that runs a repo's tests, linter, and so on. These would all run under the 'test' job, usually via something like bundle exec rake.

In January 2023, a new convention was established, whereby there would now be an overall workflow called 'CI'. Within this workflow, there would be several individual jobs, each with their own responsibility (e.g. 'test-ruby' for running tests, 'lint-ruby' for running the linter, and so on).

We should therefore no longer look for a 'test' job: the modern equivalent is to check for the 'CI' workflow, and to validate that every job within the CI workflow passes.

Note that as a stopgap, we temporarily stopped looking for a 'test' job and switched to looking for a 'test-ruby' job instead. This is suboptimal as it only checks for the outcome of the unit tests, and doesn't consider other checks such as the linter, so it will incorrectly try and fail to approve and merge PRs whose unit tests pass but where there is another check failing.

@ChrisBAshton ChrisBAshton mentioned this pull request Dec 27, 2023
For a long time, GOV.UK had a convention whereby repositories had
to specify a status check called 'test', which should be the name
of the CI job that runs a repo's tests, linter, and so on.
These would all run under the 'test' job, usually via something
like `bundle exec rake`.

In January 2023, a [new convention](alphagov/content-data-admin@89a888b)
was established, whereby there would now be an overall workflow
called 'CI'. Within this workflow, there would be several individual
jobs, each with their own responsibility (e.g. 'test-ruby' for
running tests, 'lint-ruby' for running the linter, and so on).

We should therefore no longer look for a 'test' job: the modern
equivalent is to check for the 'CI' workflow, and to validate
that every job within the CI workflow passes.

Note that as a [stopgap](#21),
we temporarily stopped looking for a 'test' job and switched to
looking for a 'test-ruby' job instead. This is suboptimal as it
only checks for the outcome of the unit tests, and doesn't
consider other checks such as the linter, so it will incorrectly
[try and fail to approve and merge](alphagov/support-api#870 (review))
PRs whose unit tests pass but where there is another check failing.
@ChrisBAshton ChrisBAshton force-pushed the ensure-ci-workflow-passes branch from c59f288 to 9296156 Compare December 27, 2023 12:43
@ChrisBAshton ChrisBAshton merged commit f33ff79 into main Dec 27, 2023
5 checks passed
@ChrisBAshton ChrisBAshton deleted the ensure-ci-workflow-passes branch December 27, 2023 13:20

private

def ci_workflow_run_id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to return twice in this method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can probably be tidied up 👍 will consider a small refactor PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, just a nitpick! Maybe something like this would work:

  return @ci_workflow_run_id if @ci_workflow_run_id
  ...
  @ci_workflow_run_id = ci_workflow["id"] if ci_workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants