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

Switch from tox build wrapper to charmcraft.yaml overrides #509

Merged
merged 4 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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/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.1
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v22.0.0

unit-test:
name: Unit test charm
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v21.0.1
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v22.0.0
with:
cache: true

Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
- lint
- unit-test
- build
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v21.0.1
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v22.0.0
with:
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
architecture: ${{ matrix.architecture }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ jobs:

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

release:
name: Release charm
needs:
- lib-check
- ci-tests
- build
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v21.0.1
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v22.0.0
with:
channel: 8.0/edge
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
sync-docs:
name: Sync docs from Discourse
uses: canonical/data-platform-workflows/.github/workflows/sync_docs.yaml@v21.0.1
uses: canonical/data-platform-workflows/.github/workflows/sync_docs.yaml@v22.0.0
with:
reviewers: a-velasco
permissions:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ tox # runs 'lint' and 'unit' environments
Build the charm in this git repository using:

```shell
tox run -e build-dev
charmcraftcache pack
```

### Deploy
Expand Down
26 changes: 16 additions & 10 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,26 @@ parts:
files:
plugin: dump
source: .
stage:
# Exclude requirements.txt file during staging
# Workaround for https://github.com/canonical/charmcraft/issues/1389 on charmcraft 2
- -requirements.txt
prime:
- scripts
charm:
override-pull: |
craftctl default
if [[ ! -f requirements.txt ]]
then
echo 'ERROR: Use "tox run -e build-dev" instead of calling "charmcraft pack" directly' >&2
exit 1
fi
charm-strict-dependencies: true
build-snaps:
- rustup
build-packages:
- libffi-dev
- libssl-dev
- pkg-config
- rustc
- cargo
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
charm-strict-dependencies: true
charm-requirements: [requirements.txt]
23 changes: 12 additions & 11 deletions poetry.lock

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

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ parameterized = "^0.9.0"

[tool.poetry.group.integration.dependencies]
pytest = "^7.4.0"
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/github_secrets"}
pytest-microceph = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/microceph"}
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v22.0.0", subdirectory = "python/pytest_plugins/github_secrets"}
pytest-microceph = {git = "https://github.com/canonical/data-platform-workflows", tag = "v22.0.0", subdirectory = "python/pytest_plugins/microceph"}
pytest-operator = "^0.28.0"
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v22.0.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v22.0.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
juju = "^3.5.2.0"
ops = "^2.15.0"
mysql-connector-python = "~8.0.33"
Expand All @@ -65,7 +65,7 @@ urllib3 = "^1.26.16"
lightkube = "^0.14.0"
kubernetes = "^27.2.0"
allure-pytest = "^2.13.2"
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.1", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v22.0.0", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}
pytest-asyncio = "^0.21.1"

[tool.coverage.run]
Expand Down
23 changes: 0 additions & 23 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,6 @@ set_env =
allowlist_externals =
poetry

[testenv:build-{production,dev,wrapper}]
# Wrap `charmcraft pack`
pass_env =
CI
GH_TOKEN
allowlist_externals =
{[testenv]allowlist_externals}
charmcraft
charmcraftcache
mv
commands_pre =
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

[testenv:format]
description = Apply coding style standards to code
commands_pre =
Expand Down Expand Up @@ -78,12 +60,7 @@ pass_env =
CI
GITHUB_OUTPUT
SECRETS_FROM_GITHUB
allowlist_externals =
{[testenv:build-wrapper]allowlist_externals}
commands_pre =
poetry install --only integration
{[testenv:build-wrapper]commands_pre}
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}
Loading