Skip to content

Commit

Permalink
Update data-platform-workflows to v23.0.4 and remove tox build wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
carlcsaposs-canonical committed Nov 8, 2024
1 parent 460b6cc commit d34a13e
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 72 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:
lint:
name: Lint
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v21.0.0
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v23.0.4

unit-test:
name: Unit test charm
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
- tests/integration/sharding_tests/application
- tests/integration/relation_tests/new_relations/application-charm
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v21.0.0
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v23.0.4
with:
path-to-charm-directory: ${{ matrix.path }}
cache: true
Expand All @@ -112,7 +112,7 @@ jobs:
- lint
- unit-test
- build
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v21.0.0
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v23.0.4
with:
artifact-prefix: packed-charm-cache-true
cloud: lxd
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v21.0.0
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v23.0.4

release-charm:
name: Release charm
needs:
- ci-tests
- build
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v21.0.0
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v23.0.4
with:
channel: 6/edge
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
Expand Down
56 changes: 37 additions & 19 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,49 @@

type: charm
bases:
- build-on:
- name: "ubuntu"
channel: "22.04"
run-on:
- name: "ubuntu"
channel: "22.04"
- name: ubuntu
channel: "22.04"
architectures: [amd64]
parts:
charm:
charm-strict-dependencies: true
files:
plugin: dump
source: .
build-packages:
- git
override-build: |
rustup default stable
# Workaround to add unique identifier (git hash) to charm version while specification
# DA053 - Charm versioning
# (https://docs.google.com/document/d/1Jv1jhWLl8ejK3iJn7Q3VbCIM9GIhp8926bgXpdtx-Sg/edit?pli=1)
# is pending review.
python3 -c 'import pathlib; import shutil; import subprocess; git_hash=subprocess.run(["git", "describe", "--always", "--dirty"], capture_output=True, check=True, encoding="utf-8").stdout; file = pathlib.Path("charm_version"); shutil.copy(file, pathlib.Path("charm_version.backup")); version = file.read_text().strip(); file.write_text(f"{version}+{git_hash}")'
python3 -c 'import pathlib; import shutil; import subprocess; git_hash=subprocess.run(["git", "describe", "--always", "--dirty"], capture_output=True, check=True, encoding="utf-8").stdout; file = pathlib.Path("charm_internal_version"); file.write_text(f"{git_hash}")'
craftctl default
stage:
# Exclude requirements.txt file during staging
# Workaround for https://github.com/canonical/charmcraft/issues/1389 on charmcraft 2
- -requirements.txt
prime:
- charm_version
- charm_internal_version
- workload_version
charm:
build-snaps:
- rustup
build-packages:
- build-essential
- libffi-dev
- libssl-dev
- pkg-config
- rustc
- cargo
version_data:
plugin: dump
source: .
prime:
- charm_version
- charm_internal_version
- workload_version
override-build: |
rustup default stable
# Convert subset of poetry.lock to requirements.txt
curl -sSL https://install.python-poetry.org | python3 -
/root/.local/bin/poetry export --only main,charm-libs --output requirements.txt
craftctl default
stage:
# Exclude charm_version file during staging
- -charm_version
charm-strict-dependencies: true
charm-requirements: [requirements.txt]
20 changes: 10 additions & 10 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 5 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
[tool.poetry]
name = "mongodb"
version = "0.0.1"
description = ""
license = "Apache-2.0"
authors = []
readme = "README.md"
homepage = "https://charmhub.io/mongodb?channel=6/edge"
repository = "https://github.com/canonical/mongodb-operator"
package-mode = false

[tool.poetry.dependencies]
python = "^3.10.12"
Expand Down Expand Up @@ -70,10 +63,10 @@ pytest = "^8.1.1"
pytest-asyncio = "^0.21.1"
pytest-mock = "^3.14.0"
pytest-operator = "^0.36.0"
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.0", subdirectory = "python/pytest_plugins/github_secrets"}
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.0", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v23.0.4", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v23.0.4", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v23.0.4", subdirectory = "python/pytest_plugins/github_secrets"}
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v23.0.4", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}

[build-system]
requires = ["poetry-core>=1.9.0"]
Expand Down
26 changes: 0 additions & 26 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,6 @@ allowlist_externals =
poetry
sh

[testenv:build-{production,dev,wrapper}]
# Wrap `charmcraft pack`
pass_env =
CI
allowlist_externals =
{[testenv]allowlist_externals}
charmcraft
charmcraftcache
mv
rm
commands_pre =
python -c 'import pathlib; import shutil; import subprocess; git_hash=subprocess.run(["git", "describe", "--always", "--dirty"], capture_output=True, check=True, encoding="utf-8").stdout; file = pathlib.Path("charm_internal_version"); file.write_text(f"{git_hash}")'
poetry export --only main,charm-libs --output requirements.txt
commands =
build-production: charmcraft pack {posargs}
build-dev: charmcraftcache pack {posargs}
commands_post =
mv requirements.txt requirements-last-build.txt
rm charm_internal_version


[testenv:format]
description = Apply coding style standards to code
commands_pre =
Expand Down Expand Up @@ -93,15 +72,10 @@ pass_env =
CI
GITHUB_OUTPUT
SECRETS_FROM_GITHUB
allowlist_externals =
{[testenv:build-wrapper]allowlist_externals}
commands_pre =
{[testenv:build-wrapper]commands_pre}
poetry install --only integration
commands =
poetry run pytest -v --tb native --log-cli-level=INFO -s --ignore={[vars]tests_path}/unit/ {posargs}
commands_post =
{[testenv:build-wrapper]commands_post}

[testenv:cleanup_juju_models]
description = Cleanup Juju models
Expand Down

0 comments on commit d34a13e

Please sign in to comment.