Skip to content

Commit 17393f3

Browse files
lucabellosed-i
andauthored
feat: migrate to ci v1 (#122)
* feat: migrate to ci v1 * use pre-built charm * update things * Fix utest * change charmcraft to wget * fix unit tests and static * try to fix itests * fixy fix --------- Co-authored-by: sed-i <[email protected]>
1 parent c3b35ec commit 17393f3

22 files changed

+2563
-207
lines changed

.github/workflows/promote.yaml

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

.github/workflows/pull-request.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ on:
88
jobs:
99
pull-request:
1010
name: PR
11-
uses: canonical/observability/.github/workflows/charm-pull-request.yaml@v0
11+
uses: canonical/observability/.github/workflows/charm-pull-request.yaml@v1
1212
secrets: inherit

.github/workflows/release.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
name: Release Charm to Edge and Publish Libraries
1+
name: Release Charm
22

33
on:
44
push:
55
branches:
66
- main
7+
- track/**
78

89
jobs:
910
release:
10-
uses: canonical/observability/.github/workflows/charm-release.yaml@v0
11+
uses: canonical/observability/.github/workflows/charm-release.yaml@v1
1112
secrets: inherit

.github/workflows/tiobe-scan.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ on:
88
jobs:
99
tics:
1010
name: TiCs
11-
uses: canonical/observability/.github/workflows/charm-tiobe-scan.yaml@main
11+
uses: canonical/observability/.github/workflows/charm-tiobe-scan.yaml@v1
1212
secrets: inherit

charmcraft.yaml

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,52 @@
11
# Copyright 2021 Canonical Ltd.
22
# See LICENSE file for licensing details.
3-
3+
name: observability-libs
44
type: charm
5-
bases:
6-
- build-on:
7-
- name: "ubuntu"
8-
channel: "20.04"
9-
run-on:
10-
- name: "ubuntu"
11-
channel: "20.04"
5+
summary: Collection of Charm Libraries for the Observability charms.
6+
description: |
7+
A placeholder charm that contains helpful charm libraries curated by the
8+
Canonical Observability charm team.
9+
10+
links:
11+
website: https://charmhub.io/observability-libs
12+
source: https://github.com/canonical/observability-libs
13+
issues: https://github.com/canonical/observability-libs/issues
14+
15+
assumes:
16+
- k8s-api
17+
18+
platforms:
19+
20+
1221
parts:
1322
charm:
14-
charm-binary-python-packages:
15-
- httpx # https://github.com/pypa/setuptools_scm/issues/918
16-
build-packages:
17-
- git
23+
source: .
24+
plugin: uv
25+
build-packages: [git]
26+
build-snaps: [astral-uv]
27+
override-build: |
28+
craftctl default
29+
git describe --always > $CRAFT_PART_INSTALL/version
30+
31+
containers:
32+
placeholder:
33+
resource: placeholder-image
34+
35+
resources:
36+
placeholder-image:
37+
type: oci-image
38+
description: OCI image for placeholder
39+
upstream-source: busybox
40+
41+
config:
42+
options:
43+
cpu:
44+
description: |
45+
K8s cpu resource limit, e.g. "1" or "500m". Default is unset (no limit).
46+
See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
47+
type: string
48+
memory:
49+
description: |
50+
K8s memory resource limit, e.g. "1Gi". Default is unset (no limit).
51+
See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
52+
type: string

config.yaml

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

metadata.yaml

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

pyproject.toml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
# Copyright 2025 Canonical Ltd.
2+
# See LICENSE file for licensing details.
3+
[project]
4+
name = "observability-libs"
5+
version = "0.0"
6+
requires-python = "~=3.8"
7+
8+
dependencies = [
9+
"ops",
10+
"PyYAML",
11+
"lightkube>=v0.15.4",
12+
"tenacity",
13+
]
14+
15+
[project.optional-dependencies]
16+
dev = [
17+
# Linting
18+
"ruff",
19+
"codespell",
20+
# Static
21+
"pyright",
22+
# Unit
23+
"pytest",
24+
"coverage[toml]",
25+
"ops[testing]",
26+
"cryptography",
27+
"jsonschema",
28+
"tenacity",
29+
# Integration
30+
"juju<=3.3.0,>=3.0",
31+
"websockets<14",
32+
"lightkube",
33+
"lightkube-models",
34+
"pytest-operator",
35+
]
36+
137
# Testing tools configuration
238
[tool.coverage.run]
339
branch = true
@@ -28,9 +64,10 @@ convention = "google"
2864

2965
# Static analysis tools configuration
3066
[tool.pyright]
31-
extraPaths = ["lib"]
67+
extraPaths = ["src", "lib"]
3268
pythonVersion = "3.8"
3369
pythonPlatform = "All"
70+
exclude = ["tests/integration/tester-charm/*"]
3471

3572
[tool.pytest.ini_options]
3673
minversion = "6.0"

requirements.txt

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

tests/integration/conftest.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import functools
66
import logging
7+
import os
78
import shutil
89
from collections import defaultdict
910
from datetime import datetime
@@ -59,6 +60,9 @@ async def wrapper(*args, **kwargs):
5960
@timed_memoizer
6061
async def o11y_libs_charm(ops_test):
6162
"""The charm used for integration testing."""
63+
if charm_file := os.environ.get("CHARM_PATH"):
64+
return Path(charm_file)
65+
6266
charm = await ops_test.build_charm(".")
6367
return charm
6468

@@ -73,7 +77,7 @@ async def tester_charm(ops_test: OpsTest) -> Path:
7377
# Link to lib
7478
dest_charmlib = Path(f"{TESTINGCHARM_PATH}/{CERTHANDLER_PATH}")
7579
dest_charmlib.parent.mkdir(parents=True)
76-
dest_charmlib.hardlink_to(CERTHANDLER_PATH)
80+
dest_charmlib.hardlink_to(CERTHANDLER_PATH) # type: ignore
7781

7882
# fetch tls_certificates lib
7983
fetch_tls_cmd = [

0 commit comments

Comments
 (0)