Skip to content

Commit 9c6e6a7

Browse files
Switch from tox build wrapper to charmcraft.yaml overrides (#626)
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 7219d1e commit 9c6e6a7

File tree

8 files changed

+31
-55
lines changed

8 files changed

+31
-55
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
jobs:
2424
lint:
2525
name: Lint
26-
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v21.0.1
26+
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v22.0.0
2727

2828
unit-test:
2929
name: Unit test charm
@@ -45,7 +45,7 @@ jobs:
4545

4646
build:
4747
name: Build charm
48-
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v21.0.1
48+
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v22.0.0
4949
with:
5050
cache: true
5151

@@ -77,7 +77,7 @@ jobs:
7777
- lint
7878
- unit-test
7979
- build
80-
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v21.0.1
80+
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v22.0.0
8181
with:
8282
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
8383
architecture: ${{ matrix.architecture }}

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ jobs:
2525

2626
build:
2727
name: Build charm
28-
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v21.0.1
28+
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v22.0.0
2929

3030
release:
3131
name: Release charm
3232
needs:
3333
- ci-tests
3434
- build
35-
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v21.0.1
35+
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v22.0.0
3636
with:
3737
channel: 14/edge
3838
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,izmalk
1616
permissions:

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ charmcraftcache --help
7676
Build the charm (inside this Git repository):
7777

7878
```shell
79-
tox run -e build-dev
79+
charmcraftcache pack
8080
```
8181

8282
### Deploy

charmcraft.yaml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,23 @@ bases:
1111
architectures: [arm64]
1212
parts:
1313
charm:
14-
override-pull: |
15-
craftctl default
16-
if [[ ! -f requirements.txt ]]
17-
then
18-
echo 'ERROR: Use "tox run -e build" instead of calling "charmcraft pack" directly' >&2
19-
exit 1
20-
fi
21-
override-build: |
22-
rustup default stable
23-
craftctl default
24-
charm-strict-dependencies: true
2514
build-snaps:
26-
- rustup/latest/stable
15+
- rustup
2716
build-packages:
2817
- libffi-dev
2918
- libssl-dev
3019
- pkg-config
3120
- libpq-dev
21+
override-build: |
22+
rustup default stable
23+
24+
# Convert subset of poetry.lock to requirements.txt
25+
curl -sSL https://install.python-poetry.org | python3 -
26+
/root/.local/bin/poetry export --only main,charm-libs --output requirements.txt
27+
28+
craftctl default
29+
charm-strict-dependencies: true
30+
charm-requirements: [requirements.txt]
3231
libpq:
3332
build-packages:
3433
- libpq-dev

poetry.lock

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

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ optional = true
6161

6262
[tool.poetry.group.integration.dependencies]
6363
pytest = "^8.3.3"
64-
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/github_secrets"}
64+
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v22.0.0", subdirectory = "python/pytest_plugins/github_secrets"}
6565
pytest-operator = "^0.36.0"
66-
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
67-
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
66+
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v22.0.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
67+
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v22.0.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
6868
# renovate caret doesn't work: https://github.com/renovatebot/renovate/issues/26940
6969
juju = "<=3.5.0.0"
7070
boto3 = "*"
@@ -73,7 +73,7 @@ landscape-api-py3 = "^0.9.0"
7373
mailmanclient = "^3.3.5"
7474
psycopg2-binary = "^2.9.9"
7575
allure-pytest = "^2.13.5"
76-
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}
76+
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v22.0.0", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}
7777

7878
# Testing tools configuration
7979
[tool.coverage.run]

tox.ini

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

20-
[testenv:build-{production,dev,wrapper}]
21-
# Wrap `charmcraft pack`
22-
pass_env =
23-
CI
24-
GH_TOKEN
25-
allowlist_externals =
26-
{[testenv]allowlist_externals}
27-
charmcraft
28-
charmcraftcache
29-
mv
30-
commands_pre =
31-
poetry export --only main,charm-libs --output requirements.txt
32-
commands =
33-
build-production: charmcraft pack {posargs}
34-
build-dev: charmcraftcache pack {posargs}
35-
commands_post =
36-
mv requirements.txt requirements-last-build.txt
37-
3820
[testenv:format]
3921
description = Apply coding style standards to code
4022
commands_pre =
@@ -80,12 +62,7 @@ pass_env =
8062
CI
8163
GITHUB_OUTPUT
8264
SECRETS_FROM_GITHUB
83-
allowlist_externals =
84-
{[testenv:build-wrapper]allowlist_externals}
8565
commands_pre =
8666
poetry install --only integration --no-root
87-
{[testenv:build-wrapper]commands_pre}
8867
commands =
8968
poetry run pytest -v --tb native --log-cli-level=INFO -s --ignore={[vars]tests_path}/unit/ {posargs}
90-
commands_post =
91-
{[testenv:build-wrapper]commands_post}

0 commit comments

Comments
 (0)