Skip to content

feat: migrate integration tests to canonical/charm-ci#136

Merged
javierdelapuente merged 11 commits into
mainfrom
feat/charm-ci-integration-tests
Jun 26, 2026
Merged

feat: migrate integration tests to canonical/charm-ci#136
javierdelapuente merged 11 commits into
mainfrom
feat/charm-ci-integration-tests

Conversation

@javierdelapuente

@javierdelapuente javierdelapuente commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates the CI pipeline from canonical/operator-workflows to canonical/charm-ci (opcli-based approach), covering both integration tests and charm publishing.

Related https://github.com/canonical/canonical-repo-automation/pull/927

Changes

File Change
artifacts.yaml New — generated by opcli artifacts init; declares charm, resources, and publish channel
spread.yaml New — generated by opcli spread init; declares integration test suite
concierge.yaml New — provisions MicroK8s + Juju 3.6/stable for K8s sidecar testing
.github/workflows/integration_test.yaml Updated to use charm-ci reusable workflow + required status check job
.github/workflows/publish_charm.yaml Updated to use charm-ci publish reusable workflow
pyproject.toml / uv.lock Added opcli (pinned to v0.0.1-alpha.5) to integration dep group for pytest plugin
tests/integration/conftest.py Removed charm_fixture (replaced by opcli plugin's charm_path); simplified juju fixture
tests/integration/test_charm.py Rewrote to deploy the charm using charm_path (opcli) + RESOURCES from charmcraft.yaml
tests/conftest.py Removed --charm-file option (now owned by opcli plugin)

How it works

The new pipeline uses opcli:

  1. Buildbuild-artifacts.yml builds the charm and uploads as a GitHub artifact
  2. Testintegration-test.yml generates a spread matrix, provisions MicroK8s via concierge, and runs tox -e integration -- --model testing inside spread
  3. Publishpublish-artifacts.yml publishes to CharmHub using CHARMCRAFT_AUTH; channel (latest/edge) is declared in artifacts.yaml

The charm_path fixture is injected automatically by the opcli pytest plugin. OCI image resources are read from upstream-source in charmcraft.yaml at test module level (same pattern as canonical/traefik-k8s-operator).

All charm-ci workflows are pinned to v0.0.1-alpha.5.

Local testing done

  • tox -e lint
  • tox -e unit ✅ (4/4 tests, 100% coverage)
  • tox -e static
  • opcli artifacts build ✅ — built platform-engineering-charm-template_amd64.charm
  • opcli spread expand ✅ — spread config expands without errors
  • opcli spread jobs ✅ — generates correct CI matrix
  • opcli pytest expand ✅ — confirms tox -e integration -- --model testing

Notes

  • Juju version is driven by concierge.yaml (3.6/stable). For multi-version testing, add a second concierge file and override the CONCIERGE env var in spread.yaml.
  • The required status check job (required_status_checks) mirrors the pattern used in canonical/haproxy-operator.

AI usage

This PR was prepared with GitHub Copilot assistance.

Replace canonical/operator-workflows integration test workflow with
canonical/charm-ci (opcli-based) approach.

Changes:
- Add artifacts.yaml (generated by `opcli artifacts init`)
- Add spread.yaml (generated by `opcli spread init`)
- Add concierge.yaml for MicroK8s + Juju 3.6/stable provisioning
- Update .github/workflows/integration_test.yaml to use
  canonical/charm-ci reusable workflows (build-artifacts + integration-test)
- Add opcli to pyproject.toml integration dep group for pytest plugin
- Update uv.lock

Also adds .github/copilot-instructions.md with project context for
future Copilot sessions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@javierdelapuente javierdelapuente requested a review from a team as a code owner June 25, 2026 08:06
@javierdelapuente javierdelapuente requested review from DeeKay3 and florentianayuwono and removed request for a team June 25, 2026 08:06

@github-actions github-actions Bot left a comment

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.

license-eye has checked 86 files.

Valid Invalid Ignored Fixed
21 3 62 0
Click to see the invalid file list
  • artifacts.yaml
  • concierge.yaml
  • spread.yaml
Use this command to fix any missing license headers
```bash

docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix

</details>

skywalking-eyes requires license headers on all YAML files.
artifacts.yaml, concierge.yaml, and spread.yaml were generated by
`opcli artifacts init` and `opcli spread init` without headers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@canonical canonical deleted a comment from github-actions Bot Jun 25, 2026
@canonical canonical deleted a comment from github-actions Bot Jun 25, 2026
@canonical canonical deleted a comment from github-actions Bot Jun 25, 2026
javierdelapuente and others added 9 commits June 25, 2026 09:04
- Remove --charm-file from tests/conftest.py (opcli plugin registers it,
  causing argparse.ArgumentError: conflicting option string)
- Remove charm_fixture from tests/integration/conftest.py (opcli plugin
  provides charm_path instead)
- Update test_charm.py to use charm_path and resource_images fixtures
  from the opcli plugin and deploy the charm with its OCI image resource
- Add upstream-source to artifacts.yaml so the build workflow pulls
  kennethreitz/httpbin for the httpbin-image resource
- Add pytest-arguments-template to spread.yaml to pass --use-existing
  so the juju fixture connects to the concierge-provisioned model

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
opcli reads upstream-source from charmcraft.yaml directly.
It does not belong in artifacts.yaml (see canonical/traefik-k8s-operator
as reference).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The opcli pytest plugin does not provide resource_images for external
(non-rock) OCI images. Instead, read upstream-source directly from
charmcraft.yaml at module level (same pattern as canonical/traefik-k8s-operator
reads from metadata.yaml).

- conftest.py: add RESOURCES dict read from charmcraft.yaml resources
- test_charm.py: use charm_path (opcli) + RESOURCES (charmcraft.yaml)
- spread.yaml: use --model testing (concierge default model name)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace canonical/operator-workflows publish with charm-ci
publish-artifacts.yml reusable workflow.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Per-charm channel declared in artifacts.yaml; workflow no longer needs
to specify it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Importing from conftest.py is not good practice. Move the CHARMCRAFT
and RESOURCES constants into test_charm.py where they are used.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tatus check, remove copilot-instructions

- Update copyright year to 2026 in all new files added by this PR
- Pin charm-ci to v0.0.1-alpha.5 in integration_test.yaml and publish_charm.yaml
- Add required_status_checks job to integration_test.yaml (mirrors haproxy-operator pattern)
- Remove .github/copilot-instructions.md

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@javierdelapuente javierdelapuente merged commit da8b788 into main Jun 26, 2026
19 checks passed
@javierdelapuente javierdelapuente deleted the feat/charm-ci-integration-tests branch June 26, 2026 10:58
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