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

ci: improve github workflows #1460

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stevenh
Copy link
Contributor

@stevenh stevenh commented Aug 20, 2023

Summary

Centralise the CI in GitHub workflow, fix detection missing changes and improve performance.

Changes

  • Centralise the CI in GitHub workflow file main.yml
  • Fix detection of files added by generation.
  • Eliminate duplicate test run.
  • Add check for missing go mod tidy.
  • Update to action/setup-go@v4

Motivation

Make it easier for contributors to understand the requirements by avoiding them having to view and understand non-standard script files.

Ensure that missing changes / clean are detected before merges, to improve quality.

Speed up actions by removing duplicate actions and using caching.

@stevenh stevenh changed the title ci: centralise ci in workflow file ci: improve github workflows Aug 20, 2023
Centralise the CI in main.yml making it easier for contributors to
understand the requirements avoid them to view non-standard script
files.

Fix detection of new files so that broken changes are detected by CI.

Eliminate duplicate test run to reduce the time needed to run.

Add check for go mod tidy to ensure that go mod is clean before it's
allowed to be merged.

Update to action/setup-go@v4 which enables caching by default improving
the performance of all workflows.
@stevenh stevenh marked this pull request as ready for review August 20, 2023 15:51
run: |
go mod tidy
(cd _codegen && go mod tidy)
git --no-pager diff && [[ -z $(git status -s) ]]
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use --exit-code parameter here and below:

Suggested change
git --no-pager diff && [[ -z $(git status -s) ]]
git --no-pager diff --exit-code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That wouldn't handle the case where there are new files generated unfortunately., which is what git status -s catches.

@dolmen
Copy link
Collaborator

dolmen commented Oct 10, 2023

The separate scripts allow the maintainers and the contributor to run the checks offline on their local machine without depending on GitHub Actions. This is a feature, not a bug!

GitHub Action checkout v4 is already #1408. Please review it.

@dolmen
Copy link
Collaborator

dolmen commented Oct 10, 2023

Please split this MR in multiple ones:

  • fix codegen changes detection in .ci.gogenerate.sh
  • add check for missing go mod tidy

Also drop the merge of .ci.*.sh into .github/workflows.

@dolmen dolmen added github_actions Pull requests that update GitHub Actions code rejected/unrelated-changes labels Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github_actions Pull requests that update GitHub Actions code rejected/unrelated-changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants