Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support charmcraft 3 and multi platform builds #92

Merged
merged 7 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 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: [[self-hosted, jammy, X64, large]]
test-command: ['tox -e func']
runs-on: [[self-hosted, jammy, X64, large], [Ubuntu_ARM64_4C_16G_01]]
test-command: ['if [ "$(uname -m)" = "aarch64" ]; then echo "skipping func tests on arm64"; else echo tox -e func; fi']
juju-channel: ["3.4/stable"]
steps:

Expand All @@ -107,7 +107,7 @@ jobs:
with:
provider: "lxd"
juju-channel: ${{ matrix.juju-channel }}
charmcraft-channel: "2.x/stable"
charmcraft-channel: "3.x/stable"

# This is used by zaza in the functional tests for non-amd64 architectures (if applicable)
- name: Set zaza juju model constraints for architecture
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/promote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
credentials: ${{ secrets.CHARMHUB_TOKEN }}
destination-channel: ${{ steps.set-channels.outputs.destination-channel }}
origin-channel: ${{ steps.set-channels.outputs.origin-channel }}
charmcraft-channel: "2.x/stable"
charmcraft-channel: "3.x/stable"
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Pack and upload to charmhub
uses: canonical/charming-actions/upload-charm@2.6.2
with:
charmcraft-channel: "2.x/stable"
charmcraft-channel: "3.x/stable"
credentials: "${{ secrets.CHARMHUB_TOKEN }}"
github-token: "${{ secrets.GITHUB_TOKEN }}"
# Ensure the charm is built in an isolated environment and on the correct base in an lxd container.
Expand Down
36 changes: 6 additions & 30 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,10 @@ parts:
charm:
source: src
plugin: reactive
# note (rgildein): This is a tmp solution, the progress of which can be monitored
# https://bugs.launchpad.net/charm-bcache-tuning/+bug/1993519
build-snaps: [ charm/2.x/stable ]
build-snaps: [charm]

bases:
- build-on:
- name: ubuntu
channel: "22.04"
architectures: ["amd64"]
run-on:
- name: ubuntu
channel: "22.04"
architectures:
- amd64
- name: ubuntu
channel: "20.04"
architectures:
- amd64
- build-on:
- name: ubuntu
channel: "22.04"
architectures: ["arm64"]
run-on:
- name: ubuntu
channel: "22.04"
architectures:
- arm64
- name: ubuntu
channel: "20.04"
architectures:
- arm64
platforms:
ubuntu@20.04:amd64:
ubuntu@22.04:amd64:
ubuntu@20.04:arm64:
ubuntu@22.04:arm64:
3 changes: 0 additions & 3 deletions src/layer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,4 @@ includes:
options:
basic:
use_venv: true
include_system_packages: true
packages:
- python3-yaml
repo: https://github.com/canonical/charm-sysconfig
1 change: 0 additions & 1 deletion src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
charmhelpers
23 changes: 6 additions & 17 deletions src/tests/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
from juju_tools import JujuTools

series = ["focal", "jammy"]
# NOTE: When the charm is split into multiple bases,
# this method of getting the charm file needs to be updated.
sources = [("local", os.getenv("CHARM_PATH_JAMMY"))]

PRINCIPAL_APP_NAME = "ubuntu-{}"

Expand Down Expand Up @@ -77,12 +74,6 @@ def series(request):
return request.param


@pytest_asyncio.fixture(scope="module", params=sources, ids=[s[0] for s in sources])
def source(request):
"""Return source of the charm under test (i.e. local, cs)."""
return request.param


def get_constraints():
constraints_str = os.environ.get("TEST_MODEL_CONSTRAINTS", "")
constraints = {}
Expand All @@ -94,10 +85,10 @@ def get_constraints():


@pytest_asyncio.fixture(scope="module", autouse=True)
async def app(model, series, source, request):
async def app(model, series, request):
"""Deploy sysconfig app along with a principal ubuntu unit."""
channel = "stable"
sysconfig_app_name = "sysconfig-{}-{}".format(series, source[0])
sysconfig_app_name = "sysconfig-{}".format(series)
principal_app_name = PRINCIPAL_APP_NAME.format(series)

# uncomment if app is already deployed while re-testing on same model
Expand All @@ -117,7 +108,7 @@ async def app(model, series, source, request):
force = True if request.node.get_closest_marker("xfail") else False

sysconfig_app = await model.deploy(
source[1],
os.getenv(f"CHARM_PATH_{series.upper()}"),
application_name=sysconfig_app_name,
series=series,
force=force,
Expand All @@ -134,12 +125,10 @@ async def app(model, series, source, request):


@pytest_asyncio.fixture(scope="module", autouse=True)
async def app_with_config(model, series, source):
async def app_with_config(model, series):
"""Deploy sysconfig app + config along with a principal ubuntu unit."""
channel = "stable"
sysconfig_app_with_config_name = "sysconfig-{}-{}-with-config".format(
series, source[0]
)
sysconfig_app_with_config_name = "sysconfig-{}-with-config".format(series)
principal_app_name = PRINCIPAL_APP_NAME.format(series)
principal_app_with_config_name = principal_app_name + "-with-config"

Expand All @@ -163,7 +152,7 @@ async def app_with_config(model, series, source):
"governor": "powersave",
}
sysconfig_app_with_config = await model.deploy(
source[1],
os.getenv(f"CHARM_PATH_{series.upper()}"),
application_name=sysconfig_app_with_config_name,
series=series,
num_units=0,
Expand Down
5 changes: 1 addition & 4 deletions src/wheelhouse.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
setuptools>=42
flit-core>=3
# NOTE: pbr 6.1.1 introduced a dependency on setuptools>=64, which is not available in the build environment constraints.
pbr==6.1.0
netifaces