Skip to content

docs: add how-to guide about CI#2405

Open
dwilding wants to merge 8 commits intocanonical:mainfrom
dwilding:ci-docs
Open

docs: add how-to guide about CI#2405
dwilding wants to merge 8 commits intocanonical:mainfrom
dwilding:ci-docs

Conversation

@dwilding
Copy link
Copy Markdown
Contributor

@dwilding dwilding commented Mar 31, 2026

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.

> - {ref}`write-integration-tests-for-a-charm`
> - {ref}`manage-logs`
> - {ref}`set-up-ci`
> - {ref}`log-from-your-charm`
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I meant to add this after switching the K8s charm tutorial to use Concierge. Adding it now.

This comment was marked as resolved.


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>`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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`:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we put this in the same file, how about adding needs: [lint, unit]?

Comment on lines +88 to +89
run: sudo concierge prepare -p k8s
- name: Run integration tests
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops, yes, thanks. Added a pack step

Comment on lines +91 to +97
run: tox -e integration -- --model testing
- name: Dump logs
uses: canonical/charm-logdump-action@main
if: failure()
with:
app: your-app
model: testing
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe we could do this instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Would we need to make sure the charm has pytest-jubilant in its integration testing deps?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

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