Skip to content

Commit 1888fd3

Browse files
Switch from tox build wrapper to charmcraft.yaml overrides (#509)
https://warthogs.atlassian.net/browse/DPE-5046 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Carl Csaposs <[email protected]>
1 parent 7fb144c commit 1888fd3

File tree

8 files changed

+40
-56
lines changed

8 files changed

+40
-56
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
jobs:
1717
lint:
1818
name: Lint
19-
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v21.0.1
19+
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v22.0.0
2020

2121
unit-test:
2222
name: Unit test charm
@@ -56,7 +56,7 @@ jobs:
5656

5757
build:
5858
name: Build charm
59-
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v21.0.1
59+
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v22.0.0
6060
with:
6161
cache: true
6262

@@ -88,7 +88,7 @@ jobs:
8888
- lint
8989
- unit-test
9090
- build
91-
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v21.0.1
91+
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v22.0.0
9292
with:
9393
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
9494
architecture: ${{ matrix.architecture }}

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ jobs:
3636

3737
build:
3838
name: Build charm
39-
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v21.0.1
39+
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v22.0.0
4040

4141
release:
4242
name: Release charm
4343
needs:
4444
- lib-check
4545
- ci-tests
4646
- build
47-
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v21.0.1
47+
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v22.0.0
4848
with:
4949
channel: 8.0/edge
5050
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}

.github/workflows/sync_docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
sync-docs:
1212
name: Sync docs from Discourse
13-
uses: canonical/data-platform-workflows/.github/workflows/sync_docs.yaml@v21.0.1
13+
uses: canonical/data-platform-workflows/.github/workflows/sync_docs.yaml@v22.0.0
1414
with:
1515
reviewers: a-velasco
1616
permissions:

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ tox # runs 'lint' and 'unit' environments
5050
Build the charm in this git repository using:
5151

5252
```shell
53-
tox run -e build-dev
53+
charmcraftcache pack
5454
```
5555

5656
### Deploy

charmcraft.yaml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,26 @@ parts:
1313
files:
1414
plugin: dump
1515
source: .
16+
stage:
17+
# Exclude requirements.txt file during staging
18+
# Workaround for https://github.com/canonical/charmcraft/issues/1389 on charmcraft 2
19+
- -requirements.txt
1620
prime:
1721
- scripts
1822
charm:
19-
override-pull: |
20-
craftctl default
21-
if [[ ! -f requirements.txt ]]
22-
then
23-
echo 'ERROR: Use "tox run -e build-dev" instead of calling "charmcraft pack" directly' >&2
24-
exit 1
25-
fi
26-
charm-strict-dependencies: true
23+
build-snaps:
24+
- rustup
2725
build-packages:
2826
- libffi-dev
2927
- libssl-dev
3028
- pkg-config
31-
- rustc
32-
- cargo
29+
override-build: |
30+
rustup default stable
31+
32+
# Convert subset of poetry.lock to requirements.txt
33+
curl -sSL https://install.python-poetry.org | python3 -
34+
/root/.local/bin/poetry export --only main,charm-libs --output requirements.txt
35+
36+
craftctl default
37+
charm-strict-dependencies: true
38+
charm-requirements: [requirements.txt]

poetry.lock

Lines changed: 12 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ parameterized = "^0.9.0"
5050

5151
[tool.poetry.group.integration.dependencies]
5252
pytest = "^7.4.0"
53-
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/github_secrets"}
54-
pytest-microceph = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/microceph"}
53+
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v22.0.0", subdirectory = "python/pytest_plugins/github_secrets"}
54+
pytest-microceph = {git = "https://github.com/canonical/data-platform-workflows", tag = "v22.0.0", subdirectory = "python/pytest_plugins/microceph"}
5555
pytest-operator = "^0.28.0"
56-
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
57-
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
56+
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v22.0.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
57+
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v22.0.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
5858
juju = "^3.5.2.0"
5959
ops = "^2.15.0"
6060
mysql-connector-python = "~8.0.33"
@@ -65,7 +65,7 @@ urllib3 = "^1.26.16"
6565
lightkube = "^0.14.0"
6666
kubernetes = "^27.2.0"
6767
allure-pytest = "^2.13.2"
68-
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}
68+
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v22.0.0", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}
6969
pytest-asyncio = "^0.21.1"
7070

7171
[tool.coverage.run]

tox.ini

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,6 @@ set_env =
1818
allowlist_externals =
1919
poetry
2020

21-
[testenv:build-{production,dev,wrapper}]
22-
# Wrap `charmcraft pack`
23-
pass_env =
24-
CI
25-
GH_TOKEN
26-
allowlist_externals =
27-
{[testenv]allowlist_externals}
28-
charmcraft
29-
charmcraftcache
30-
mv
31-
commands_pre =
32-
poetry export --only main,charm-libs --output requirements.txt
33-
commands =
34-
build-production: charmcraft pack {posargs}
35-
build-dev: charmcraftcache pack {posargs}
36-
commands_post =
37-
mv requirements.txt requirements-last-build.txt
38-
3921
[testenv:format]
4022
description = Apply coding style standards to code
4123
commands_pre =
@@ -78,12 +60,7 @@ pass_env =
7860
CI
7961
GITHUB_OUTPUT
8062
SECRETS_FROM_GITHUB
81-
allowlist_externals =
82-
{[testenv:build-wrapper]allowlist_externals}
8363
commands_pre =
8464
poetry install --only integration
85-
{[testenv:build-wrapper]commands_pre}
8665
commands =
8766
poetry run pytest -v --tb native --log-cli-level=INFO -s --ignore={[vars]tests_path}/unit/ {posargs}
88-
commands_post =
89-
{[testenv:build-wrapper]commands_post}

0 commit comments

Comments
 (0)