Skip to content

Commit 01d12ba

Browse files
committed
add arm64, ppc64el and s390x and migrate workflows to charm-ci
1 parent 1fea4e2 commit 01d12ba

12 files changed

Lines changed: 141 additions & 144 deletions

File tree

.github/workflows/docs_spread.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ on:
88

99
jobs:
1010
tutorial-spread-test:
11-
uses: canonical/operator-workflows/.github/workflows/docs_spread.yaml@main
11+
uses: canonical/charm-ci/.github/workflows/integration-test.yml@main
1212
secrets: inherit
13+
permissions:
14+
contents: read
15+
packages: write
16+
actions: read
1317
with:
14-
input-file: docs/tutorial.md
15-
output-dir: tests/spread/tutorial/
16-
spread-job: github-ci:ubuntu-24.04-64:tests/spread/tutorial
18+
working-directory: .
19+
spread-jobs-include: "*tests/spread/tutorial*"

.github/workflows/integration_test.yaml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,12 @@ on:
77

88
jobs:
99
integration-tests:
10-
strategy:
11-
fail-fast: false
12-
matrix:
13-
base:
14-
- "20.04"
15-
- "22.04"
16-
- "24.04"
17-
uses: canonical/operator-workflows/.github/workflows/integration_test.yaml@main
10+
uses: canonical/charm-ci/.github/workflows/integration-test.yml@main
1811
secrets: inherit
1912
permissions:
13+
contents: read
2014
packages: write
15+
actions: read
2116
with:
22-
trivy-fs-enabled: true
23-
trivy-image-config: "trivy.yaml"
24-
self-hosted-runner: true
25-
self-hosted-runner-label: "edge"
26-
juju-channel: "3/stable"
27-
provider: "lxd"
28-
extra-arguments: "--base ${{ matrix.base }}"
29-
with-uv: true
30-
allure-report:
31-
if: ${{ !cancelled() && github.event_name == 'schedule' }}
32-
needs:
33-
- integration-tests
34-
uses: canonical/operator-workflows/.github/workflows/allure_report.yaml@main
17+
working-directory: .
18+
spread-jobs-include: "*tests/integration*"

.github/workflows/publish_charm.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ on:
88

99
jobs:
1010
publish-to-edge:
11-
uses: canonical/operator-workflows/.github/workflows/publish_charm.yaml@main
11+
uses: canonical/charm-ci/.github/workflows/publish-artifacts.yml@main
1212
permissions:
13-
actions: read
1413
contents: write
14+
actions: read
1515
secrets: inherit
1616
with:
1717
channel: latest/edge
18-
integration-test-workflow-file: integration_test.yaml
18+
integration-workflow-name: integration_test.yaml

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
venv/
22
build/
33
*.charm
4+
artifacts.build.yaml
45
.tox/
56
.coverage
67
__pycache__/

artifacts.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2026 Canonical Ltd.
2+
# See LICENSE file for licensing details.
3+
4+
version: 1
5+
charms:
6+
- name: aproxy
7+
charmcraft-yaml: charmcraft.yaml
8+
platforms:
9+
- arch: amd64
10+
runner: [ubuntu-latest]
11+
- arch: arm64
12+
runner: [ubuntu-24.04-arm]
13+
- arch: ppc64el
14+
runner: [self-hosted-linux-ppc64el-noble-medium]
15+
- arch: s390x
16+
runner: [self-hosted-linux-s390x-noble-medium]
17+

charmcraft.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,17 @@ description: |
2525
2626
platforms:
2727
ubuntu@20.04:amd64:
28+
ubuntu@20.04:arm64:
29+
ubuntu@20.04:ppc64el:
30+
ubuntu@20.04:s390x:
2831
ubuntu@22.04:amd64:
32+
ubuntu@22.04:arm64:
33+
ubuntu@22.04:ppc64el:
34+
ubuntu@22.04:s390x:
2935
ubuntu@24.04:amd64:
36+
ubuntu@24.04:arm64:
37+
ubuntu@24.04:ppc64el:
38+
ubuntu@24.04:s390x:
3039

3140
requires:
3241
juju-info:

concierge.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2026 Canonical Ltd.
2+
# See LICENSE file for licensing details.
3+
4+
juju:
5+
channel: 3.6/stable
6+
model-defaults:
7+
test-mode: "true"
8+
automatically-retry-hooks: "false"
9+
10+
providers:
11+
lxd:
12+
enable: true
13+
bootstrap: true
14+

spread.yaml

Lines changed: 51 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,68 @@
11
# Copyright 2026 Canonical Ltd.
22
# See LICENSE file for licensing details.
33

4-
project: aproxy-operator
4+
project: aproxy
55

6-
path: /aproxy-operator
7-
environment:
8-
PROJECT_PATH: /aproxy-operator
6+
path: /home/ubuntu/proj
97

10-
# important to ensure adhoc and linode/qemu behave the same
11-
SUDO_USER: ""
12-
SUDO_UID: ""
8+
kill-timeout: 60m
9+
warn-timeout: 1m
1310

14-
LANG: "C.UTF-8"
15-
LANGUAGE: "en"
11+
backends:
12+
integration-test:
13+
type: integration-test
14+
systems:
15+
- ubuntu-24.04:
16+
runner: [ubuntu-24.04]
17+
arch: amd64
18+
cpu: 4
19+
memory: 8
20+
disk: 40
21+
- ubuntu-24.04-arm64:
22+
runner: [ubuntu-24.04-arm]
23+
arch: arm64
24+
cpu: 4
25+
memory: 8
26+
disk: 40
27+
- ubuntu-24.04-ppc64el:
28+
runner: [self-hosted-linux-ppc64el-noble-medium]
29+
arch: ppc64el
30+
cpu: 4
31+
memory: 8
32+
disk: 40
33+
- ubuntu-24.04-s390x:
34+
runner: [self-hosted-linux-s390x-noble-medium]
35+
arch: s390x
36+
cpu: 4
37+
memory: 8
38+
disk: 40
39+
40+
environment:
41+
CONCIERGE: '$(HOST: echo "${CONCIERGE:-concierge.yaml}")'
42+
OPCLI_GIT_REF: '$(HOST: echo "${OPCLI_GIT_REF:-main}")'
1643

1744
exclude:
1845
- .git
1946
- .github
2047
- .tox
2148
- .venv
2249
- .*_cache
23-
- charmcraft
24-
- libexec
25-
- schema
26-
- snap
27-
28-
backends:
29-
github-ci:
30-
type: adhoc
31-
allocate: |
32-
echo "Allocating ad-hoc $SPREAD_SYSTEM"
33-
if [ -z "${GITHUB_RUN_ID:-}" ]; then
34-
FATAL "this back-end only works inside GitHub CI"
35-
exit 1
36-
fi
37-
echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' | sudo tee /etc/sudoers.d/99-spread-users
38-
ADDRESS localhost:22
39-
discard: |
40-
echo "Discarding ad-hoc $SPREAD_SYSTEM"
41-
systems:
42-
- ubuntu-24.04-64:
43-
username: ubuntu
44-
password: ubuntu
45-
workers: 1
46-
47-
prepare: |
48-
snap refresh --hold
49-
50-
if systemctl is-enabled unattended-upgrades.service; then
51-
systemctl stop unattended-upgrades.service
52-
systemctl mask unattended-upgrades.service
53-
fi
50+
- build
5451

55-
sudo snap install --classic concierge
56-
sudo concierge prepare -p machine
52+
integration-suites:
53+
tests/integration/:
54+
working-dir: ./
55+
summary: aproxy integration tests
56+
backends:
57+
- integration-test
58+
pytest-arguments-template: |
59+
--model testing
60+
--keep-models
5761
5862
suites:
59-
tests/spread/:
60-
summary: tutorial test
63+
tests/spread/tutorial/:
64+
summary: aproxy tutorial smoke test
6165
systems:
62-
- ubuntu-24.04-64
66+
- ubuntu-24.04
67+
environment:
68+
TUTORIAL: docs/tutorial.md

tests/conftest.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

tests/integration/conftest.py

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
# pylint: disable=unused-argument
55
"""Fixtures for charm tests."""
66

7-
import pathlib
8-
import subprocess # nosec B404
97
import typing
108

119
import jubilant
@@ -15,46 +13,22 @@
1513

1614

1715
@pytest.fixture(name="aproxy_charm_file", scope="session")
18-
def aproxy_charm_file_fixture(pytestconfig: pytest.Config) -> str:
19-
"""Build or get the aproxy charm file.
16+
def aproxy_charm_file_fixture(charm_paths: dict, pytestconfig: pytest.Config) -> str:
17+
"""Return the path to the built aproxy charm for the requested base.
18+
19+
The ``charm_paths`` fixture is provided by the opcli (canonical/charm-ci)
20+
pytest plugin and resolves builds from ``artifacts.build.yaml`` for the
21+
current architecture.
2022
2123
Args:
24+
charm_paths: Mapping of charm name to its per-base build paths.
2225
pytestconfig: Pytest configuration object.
2326
2427
Returns:
25-
Path to the built or provided aproxy charm file.
28+
Path to the built aproxy charm file for the requested base.
2629
"""
27-
charms = pytestconfig.getoption("--charm-file")
2830
base = pytestconfig.getoption("--base")
29-
30-
if charms:
31-
# Filter by requested base
32-
matching_charms = [file for file in charms if base in file]
33-
if matching_charms:
34-
return matching_charms[0]
35-
raise AssertionError(f"No matching charm found for base {base}.")
36-
37-
# Otherwise, build the charm for the requested base
38-
base_index_map = {"20.04": 0, "22.04": 1, "24.04": 2}
39-
bases_index = base_index_map.get(base, 2)
40-
41-
try:
42-
subprocess.run( # nosec B603
43-
["/usr/bin/charmcraft", "pack", f"--bases-index={bases_index}"],
44-
check=True,
45-
capture_output=True,
46-
text=True,
47-
)
48-
except subprocess.CalledProcessError as exc:
49-
raise OSError(f"Error packing charm: {exc}; Stderr:\n{exc.stderr}") from None
50-
51-
charm_path = pathlib.Path(__file__).parent.parent.parent
52-
charms = [p.absolute() for p in charm_path.glob("aproxy_*.charm")]
53-
# Filter for the requested base
54-
matching_charms = [c for c in charms if base in str(c)]
55-
if matching_charms:
56-
return str(matching_charms[0])
57-
raise AssertionError(f"No matching charm found for base {base}.")
31+
return str(charm_paths["aproxy"][f"ubuntu@{base}"])
5832

5933

6034
@pytest.fixture(name="juju", scope="module")

0 commit comments

Comments
 (0)