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

feat: self update if there have been changes to the grammar but it was not built locally #103

Merged
merged 4 commits into from
Feb 28, 2024

Conversation

ansgarm
Copy link
Member

@ansgarm ansgarm commented Feb 22, 2024

This PR adds a new workflow to run on pull requests only while adjusting the existing test workflow to only run on commits on main from now on.

The following will happen on PRs now:

  • npm run build will be run as part of a new build job
  • copywrite headers will be run as part of the build job as well
  • If there are any changes (e.g. to file headers) or to the generated syntax json files the diff will be committed as a new commit and the workflow is aborted
  • If there are no changes (e.g. when running on the self-update commit after it has been made) the test job will run and decide the fate of whether the workflow fails or succeeds

This pattern is something we used over in CDKTF repositories a lot. It stems from the projen.io configuration management tool.

This change allows us to forget to run build and still get correct test results. Currently, if you forget to run build locally, the tests might still pass as they run against the now stale generated json grammar files.

Todos

@ansgarm ansgarm requested a review from a team as a code owner February 22, 2024 09:01
@ansgarm
Copy link
Member Author

ansgarm commented Feb 22, 2024

Here's a PR testing this: #104

(support issue created for CLA bot approval thing: https://github.com/hashicorp/releng-support/issues/248)

@ansgarm ansgarm marked this pull request as draft February 22, 2024 09:29
@ansgarm ansgarm force-pushed the feat-ci-self-update branch from 94e408f to 860a2a3 Compare February 22, 2024 14:45
@ansgarm ansgarm requested a review from dbanck February 23, 2024 08:15
@ansgarm ansgarm marked this pull request as ready for review February 23, 2024 10:22
Copy link
Member

@dbanck dbanck left a comment

Choose a reason for hiding this comment

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

Thanks for setting this up! I have two questions

…s not built locally

This PR adds a new workflow to run on pull requests only while adjusting the existing test workflow to only run on commits on main from now on.

The following will happen on PRs now:
* `npm run build` will be run as part of a new build job
* `copywrite headers` will be run as part of the build job as well
* If there are any changes (e.g. to file headers) or to the generated syntax json files the diff will be committed as a new commit and the workflow is aborted
* If there are no changes (e.g. when running on the self-update commit after it has been made) the test job will run and decide the fate of whether the workflow fails or succeeds

This pattern is something we used over in CDKTF repositories a lot. It stems from the projen.io configuration management tool.

This change allows us to forget to run build and still get correct test results. Currently, if you forget to run build locally, the tests might still pass as they run against the now stale generated json grammar files.
This will be handled in a separate workflow, refer to #105 for more
@ansgarm ansgarm requested a review from dbanck February 28, 2024 13:25
@ansgarm ansgarm force-pushed the feat-ci-self-update branch from 860a2a3 to 121c618 Compare February 28, 2024 13:49
Copy link
Member

@dbanck dbanck left a comment

Choose a reason for hiding this comment

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

Thanks!

@ansgarm ansgarm merged commit 09eb77d into main Feb 28, 2024
5 checks passed
@ansgarm ansgarm deleted the feat-ci-self-update branch February 28, 2024 14:09
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.

2 participants