Conversation
| > - {ref}`write-integration-tests-for-a-charm` | ||
| > - {ref}`manage-logs` | ||
| > - {ref}`set-up-ci` | ||
| > - {ref}`log-from-your-charm` |
There was a problem hiding this comment.
manage-logs pointed to the Juju docs. I'm fixing the link so that it points to our Ops doc instead.
|
|
||
| > See more: | ||
| > | ||
| > - [Prepare your environment to develop Kubernetes charms](#set-up-your-development-environment) |
There was a problem hiding this comment.
I meant to add this after switching the K8s charm tutorial to use Concierge. Adding it now.
|
|
||
| This guide demonstrates how to automatically run your charm's tests against any PR into the main branch of your GitHub repository. | ||
|
|
||
| You might also want to automatically publish your charm on Charmhub or publish charm libraries on PyPI. [charming-actions](https://github.com/canonical/charming-actions) has some useful GitHub actions for publishing on Charmhub. For guidance about publishing on PyPI, see {external+charmlibs:ref}`How to distribute charm libraries <python-package-distribution-pypi>`. |
There was a problem hiding this comment.
I wonder if we should keep endorsing charming-actions.
|
|
||
| Integration tests require a Juju controller and a cloud in which to deploy your charm. We recommend that you use [Concierge](https://github.com/canonical/concierge) to prepare the CI environment. | ||
|
|
||
| If your charm is a Kubernetes charm, create a file called `.github/workflows/integration-tests.yaml`: |
There was a problem hiding this comment.
How about we recommend putting everything in a ci.yaml file for now? The integration test job is simple enough to live in the same file as the rest.
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| integration: |
There was a problem hiding this comment.
If we put this in the same file, how about adding needs: [lint, unit]?
| run: sudo concierge prepare -p k8s | ||
| - name: Run integration tests |
There was a problem hiding this comment.
We should add a charmcraft pack here, and either the CHARM_PATH environment variable we recommend using, or add an explicit comment that tox -e integration will find the charms by path.
There was a problem hiding this comment.
Oops, yes, thanks. Added a pack step
| run: tox -e integration -- --model testing | ||
| - name: Dump logs | ||
| uses: canonical/charm-logdump-action@main | ||
| if: failure() | ||
| with: | ||
| app: your-app | ||
| model: testing |
There was a problem hiding this comment.
Would we need to make sure the charm has pytest-jubilant in its integration testing deps?
There was a problem hiding this comment.
Yes. I think that's OK, as charm-logdump-action makes some pretty strong assumptions too (microk8s only, models aren't torn down by integration tests). We should document that we're assuming pytest-jubilant integration tests, of course.
This PR consolidates our various CI examples and puts them into a how-to guide so they are much easier to find.
Preview of the new guide
I tried to keep the guidance minimal and close to what we currently have. We can build on the guidance in follow-up PRs. But if the examples themselves need tweaking/improving, let's do that in this PR.