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

Update data-platform-workflows to v12.6.1 #99

Closed
wants to merge 7 commits into from
Closed
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
13 changes: 8 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: |
# Workaround for https://github.com/canonical/charmcraft/issues/1389#issuecomment-1880921728
touch requirements.txt
- name: Check libs
uses: canonical/charming-actions/check-libraries@2.2.2
with:
Expand All @@ -63,9 +66,9 @@ jobs:

build:
name: Build charms
uses: canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v7.0.0
permissions:
actions: write # Needed to manage GitHub Actions cache
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v12.6.1
with:
cache: true

gh-hosted-collect-integration-tests:
name: (GH hosted) Collect integration test groups
Expand Down Expand Up @@ -141,9 +144,9 @@ jobs:
if: ${{ matrix.libjuju-version == '2.9.44.1' }}
run: poetry add --lock --group integration juju@'${{ matrix.libjuju-version }}'
- name: Download packed charm(s)
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.artifact-name }}
pattern: ${{ needs.build.outputs.artifact-prefix }}-*
- name: Select test stability level
id: select-test-stability
run: |
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,20 @@ jobs:
name: Tests
uses: ./.github/workflows/ci.yaml
secrets: inherit
permissions:
actions: write # Needed to manage GitHub Actions cache

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm_without_cache.yaml@v7.0.0
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v12.6.1

release:
name: Release charm
needs:
- ci-tests
- build
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v7.0.0
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v12.6.1
with:
channel: dpe/edge
artifact-name: ${{ needs.build.outputs.artifact-name }}
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
secrets:
charmhub-token: ${{ secrets.CHARMHUB_TOKEN }}
permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync_issue_to_jira.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
sync:
name: Sync GitHub issue to Jira
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v7.0.0
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v12.6.1
with:
jira-base-url: https://warthogs.atlassian.net
jira-project-key: DPE
Expand Down
9 changes: 5 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@ git clone https://github.com/canonical/mysql-router-operator.git
cd mysql-router-operator
```

Install `tox` and `poetry`
Install `tox`, `poetry`, and `charmcraftcache`

Install pipx: https://pipx.pypa.io/stable/installation/
```shell
python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install tox
pipx install poetry
pipx install charmcraftcache
```

You can create an environment for development:
Expand All @@ -85,7 +86,7 @@ tox # runs 'lint' and 'unit' environments
Build the charm in this git repository using:

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

### Deploy
Expand Down
3 changes: 2 additions & 1 deletion charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ parts:
craftctl default
if [[ ! -f requirements.txt ]]
then
echo 'ERROR: Use "tox run -e build" instead of calling "charmcraft pack" directly' >&2
echo 'ERROR: Use "tox run -e build-dev" instead of calling "charmcraft pack" directly' >&2
exit 1
fi
charm-strict-dependencies: true
charm-entrypoint: src/machine_charm.py
prime:
- charm_version
Expand Down
10 changes: 5 additions & 5 deletions poetry.lock

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

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ pytest-mock = "^3.11.1"
[tool.poetry.group.integration.dependencies]
pytest = "^7.4.0"
pytest-operator = "^0.28.0"
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v7.0.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v7.0.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v12.6.1", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v12.6.1", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
juju = "3.2.0.1"
mysql-connector-python = "~8.0.33"
tenacity = "^8.2.2"
Expand Down
17 changes: 9 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ set_env =
allowlist_externals =
poetry

[testenv:{build,pack-wrapper}]
[testenv:build-{production,dev,wrapper}]
# Wrap `charmcraft pack`
pass_env =
CRAFT_SHARED_CACHE
CI
allowlist_externals =
{[testenv]allowlist_externals}
charmcraft
charmcraftcache
mv
commands_pre =
# TODO charm versioning: Remove
Expand All @@ -33,10 +34,10 @@ commands_pre =
# is pending review.
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_version"); shutil.copy(file, pathlib.Path("charm_version.backup")); version = file.read_text().strip(); file.write_text(f"{version}+{git_hash}")'

# `--without-hashes` workaround for https://github.com/canonical/charmcraft/issues/1179
poetry export --only main,charm-libs --output requirements.txt --without-hashes
poetry export --only main,charm-libs --output requirements.txt
commands =
build: charmcraft pack {posargs}
build-production: charmcraft pack {posargs}
build-dev: charmcraftcache pack {posargs}
commands_post =
mv requirements.txt requirements-last-build.txt
mv charm_version.backup charm_version
Expand Down Expand Up @@ -83,11 +84,11 @@ pass_env =
CI
GITHUB_OUTPUT
allowlist_externals =
{[testenv:pack-wrapper]allowlist_externals}
{[testenv:build-wrapper]allowlist_externals}
commands_pre =
poetry install --only integration
{[testenv:pack-wrapper]commands_pre}
{[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:pack-wrapper]commands_post}
{[testenv:build-wrapper]commands_post}
Loading