Skip to content

Commit

Permalink
ci: POC arm64 runner
Browse files Browse the repository at this point in the history
- Fix issue #314, missing testing model on crashdump
- Add arm64 functional test
- Add arm64 charm build
  • Loading branch information
jneo8 committed Sep 20, 2024
1 parent d420c63 commit 86c2e4f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ jobs:
strategy:
fail-fast: false
matrix:
runs-on: [[ubuntu-22.04]]
test-command: ['tox -e func -- --series focal', 'tox -e func -- --series jammy']
runs-on: [[ubuntu-22.04], [Ubuntu_ARM64_4C_16G_01]]
test-command: ['tox -e func -- --series focal --keep-models', 'tox -e func -- --series jammy --keep-models']
juju-channel: ["3.4/stable"]
steps:

Expand Down
5 changes: 4 additions & 1 deletion charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,23 @@ bases:
- build-on:
- name: ubuntu
channel: "22.04"
architectures: ["amd64"]
architectures: ["amd64", "arm64"]
run-on:
- name: ubuntu
channel: "24.04"
architectures:
- amd64
- arm64
- name: ubuntu
channel: "22.04"
architectures:
- amd64
- arm64
- name: ubuntu
channel: "20.04"
architectures:
- amd64
- arm64

actions:
redetect-hardware:
Expand Down
9 changes: 9 additions & 0 deletions tests/functional/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import platform

import pytest
from utils import RESOURCES_DIR, Resource
Expand Down Expand Up @@ -41,6 +42,14 @@ def series(request):
return request.config.getoption("--series")


@pytest.fixture(scope="module")
def architecture():
machine = platform.machine()
if machine == "aarch64":
return "arm64"
return "amd64"


@pytest.fixture(scope="module")
def provided_collectors(request):
return set(request.config.getoption("collectors"))
Expand Down
7 changes: 6 additions & 1 deletion tests/functional/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class AppStatus(str, Enum):
@pytest.mark.abort_on_fail
@pytest.mark.skip_if_deployed
async def test_build_and_deploy( # noqa: C901, function is too complex
ops_test: OpsTest, series, provided_collectors, required_resources
ops_test: OpsTest, series, architecture, provided_collectors, required_resources
):
"""Build the charm-under-test and deploy it together with related charms.
Expand All @@ -67,6 +67,11 @@ async def test_build_and_deploy( # noqa: C901, function is too complex
charm = await ops_test.build_charm(".")
assert charm, "Charm was not built successfully."

# This is required for subordinate appliation to choose right revison
# on different architecture.
# See issue: https://bugs.launchpad.net/juju/+bug/2067749
await ops_test.model.set_constraints({"arch": architecture})

bundle_template_path = get_this_script_dir() / "bundle.yaml.j2"

logger.info("Rendering bundle %s", bundle_template_path)
Expand Down

0 comments on commit 86c2e4f

Please sign in to comment.