-
Notifications
You must be signed in to change notification settings - Fork 126
ci: use httpbin demo charm for the Charmcraft pack test #1895
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
Conversation
|
@tonyandrewmeyer would you mind having a look at this? (No urgency) It follows on from discussion that Dima, James, and I were having in #1886. |
| - name: Install yq | ||
| run: sudo snap install yq |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yq can also be apt-installed, but I guess either is fine.
tonyandrewmeyer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think switching to a local charm is definitely the right move, and httpbin-demo should be sufficient for now (I imagine that we'd want the example charms' integration tests to run at some point, and that might make this superfluous -- but maybe that will take too long, and we'd rather keep one specific one here).
We should also remove this file from .github/workflows/update-charm-tests.yaml since there's no revision to update any more.
Done, thanks! |
| echo "'parts' already exists in charmcraft.yaml" | ||
| exit 1 | ||
| fi | ||
| yq --inplace '.parts.charm.build-packages = ["git"]' charmcraft.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: probably not great to whack old build packages in case one is added later, but then we'd notice very quickly that this job fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm only adding parts if it doesn't already exist (this check). So if we add a build package later, the job should fail immediately - if I've got my logic right!
|
I'm merging this now. We can revise further in a follow-up PR if needed. Thanks everyone! |
| - name: Install yq | ||
| run: sudo snap install yq | ||
|
|
||
| - name: Add 'git' as a build package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - name: Add 'git' as a build package | |
| - name: Add 'git' as a build package |
I guess our yaml linter doesn't care about comment content... or maybe we ain't got no yaml linter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tonyandrewmeyer I seem to remember that you caught a bunch of unnecessary whitespace with pre-commit recently. Would that have been useful here? Would you mind explaining how you do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run uvx pre-commit install in the repo(s) that you want to use pre-commit. If they've already got a .pre-commit-config.yaml file, then any time you commit the configured checks will be run (against the files being committed - anything with modifications that isn't in the commit is temporarily stashed, and anything without changes is ignored).
For trailing whitespace (and a few of the other checks) it'll auto-fix for you as well, so you can commit (get failure), verify the fix (if needed), git add, and then commit again.
I don't actually know how this works if you commit outside a terminal (using an IDE for example) but I assume it shows you the output if it fails or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also invoke pre-commit manually at any time to run the checks and fixes just once (e.g. uvx pre-commit).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah great, thank you! I confirmed that pre-commit will clean up this training space next time.
This PR uses the httpbin demo charm for the "Charmcraft Pack Test" check.
Since the charm doesn't use pyproject.toml (yet? see #1805), I've kept the step that modifies requirements.txt. And since we're getting the
opspackage from a git repo, I've added a step that adds git as a build package in charmcraft.yaml. The hello-kubecon charm already had git specified as a build package.