Skip to content

Commit 14a3e7a

Browse files
authored
[MISC] Switch to strict deps and latest dpw (#325)
* Switch to strict deps and latest dpw * Bump juju2 agent * Update contrib * Ranged psycopg2
1 parent c609632 commit 14a3e7a

File tree

10 files changed

+393
-383
lines changed

10 files changed

+393
-383
lines changed

.github/renovate.json5

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,5 @@
1111
"matchPackageNames": ["python"],
1212
"allowedVersions": "<3.11"
1313
}
14-
],
15-
"regexManagers": [
16-
{
17-
"fileMatch": ["(^|/)([\\w-]*)charmcraft\\.ya?ml$"],
18-
"matchStrings": ["- (?<depName>.*?)(?:\\[.*?\\])?==(?<currentValue>.*?) +# renovate"],
19-
"datasourceTemplate": "pypi",
20-
"versioningTemplate": "loose"
21-
}
2214
]
2315
}

.github/workflows/ci.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on:
2222
jobs:
2323
lint:
2424
name: Lint
25-
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v7.0.0
25+
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v9.3.1
2626

2727
unit-test:
2828
name: Unit test charm
@@ -42,25 +42,24 @@ jobs:
4242

4343
build:
4444
name: Build charm
45-
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
46-
permissions:
47-
actions: write # Needed to manage GitHub Actions cache
48-
45+
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
46+
with:
47+
charmcraft-snap-channel: beta
4948

5049
integration-test:
5150
strategy:
5251
fail-fast: false
5352
matrix:
5453
juju:
55-
- agent: 2.9.45
54+
- agent: 2.9.46
5655
libjuju: ^2
5756
- agent: 3.1.7
5857
name: Integration test charm | ${{ matrix.juju.agent }}
5958
needs:
6059
- lint
6160
- unit-test
6261
- build
63-
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v7.0.0
62+
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v9.3.1
6463
with:
6564
artifact-name: ${{ needs.build.outputs.artifact-name }}
6665
cloud: lxd

.github/workflows/lib-check.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ jobs:
2626
uses: actions/checkout@v4
2727
with:
2828
fetch-depth: 0
29+
- name: Set up environment
30+
run: |
31+
pipx install tox
32+
pipx install poetry
33+
pipx inject poetry poetry-plugin-export
34+
# TODO: Remove after https://github.com/python-poetry/poetry/pull/5980 is closed
35+
poetry config warnings.export false
36+
- name: Generate requirements
37+
run: |
38+
tox run -e build-wrapper
39+
mv requirements-last-build.txt requirements.txt
2940
- name: Check libs
3041
uses: canonical/charming-actions/[email protected]
3142
with:

.github/workflows/release.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ jobs:
1919
name: Tests
2020
uses: ./.github/workflows/ci.yaml
2121
secrets: inherit
22-
permissions:
23-
actions: write # Needed to manage GitHub Actions cache
2422

2523
build:
2624
name: Build charm
27-
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
25+
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
26+
with:
27+
charmcraft-snap-channel: beta
2828

2929
release:
3030
name: Release charm
3131
needs:
3232
- ci-tests
3333
- build
34-
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v7.0.0
34+
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v9.3.1
3535
with:
3636
channel: 14/edge
3737
artifact-name: ${{ needs.build.outputs.artifact-name }}

.github/workflows/sync_issue_to_jira.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
sync:
1111
name: Sync GitHub issue to Jira
12-
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v7.0.0
12+
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v9.3.1
1313
with:
1414
jira-base-url: https://warthogs.atlassian.net
1515
jira-project-key: DPE

CONTRIBUTING.md

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

4545
```shell
46-
tox -e build
46+
tox run -e build-dev
4747
```
4848

4949
The tox build environment assumes that there is a preinstalled [poetry](https://python-poetry.org/) on the system.

charmcraft.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ parts:
2424
- rustc
2525
- cargo
2626
- pkg-config
27+
charm-strict-dependencies: true
2728
charm-binary-python-packages:
28-
- psycopg2-binary==2.9.9 # renovate
29+
- psycopg2-binary

poetry.lock

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

pyproject.toml

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ repository = "https://github.com/canonical/postgresql-operator"
1313

1414
[tool.poetry.dependencies]
1515
python = "^3.10"
16-
ops = "^2.8.0"
17-
cryptography = "^41.0.5"
18-
boto3 = "^1.28.70"
16+
ops = "^2.9.0"
17+
cryptography = "^41.0.7"
18+
boto3 = "^1.34.22"
1919
pgconnstr = "^1.0.1"
2020
requests = "^2.31.0"
2121
tenacity = "^8.2.3"
22-
# psycopg2 = "2.9.5" # Injected in charmcraft.yaml
22+
psycopg2-binary = "^2.9.9"
2323
cosl = "^0.0.7"
2424
pydantic = "^1.10.13"
25-
poetry-core = "^1.7.0"
26-
pyOpenSSL = "^23.2.0"
25+
poetry-core = "^1.8.0"
26+
pyOpenSSL = "^23.3.0"
2727

2828
[tool.poetry.group.charm-libs.dependencies]
2929
# data_platform_libs/v0/data_interfaces.py
@@ -40,8 +40,8 @@ cosl = "*"
4040
optional = true
4141

4242
[tool.poetry.group.format.dependencies]
43-
black = "^23.9.1"
44-
ruff = "^0.1.3"
43+
black = "^23.12.1"
44+
ruff = "^0.1.13"
4545

4646
[tool.poetry.group.lint]
4747
optional = true
@@ -55,27 +55,26 @@ optional = true
5555
[tool.poetry.group.unit.dependencies]
5656
coverage = {extras = ["toml"], version = "^7.3.2"}
5757
pytest = "^7.4.0"
58-
pytest-asyncio = "^0.21.1"
58+
pytest-asyncio = "*"
5959
parameterized = "^0.9.0"
60-
jsonschema = "^4.19.1"
61-
psycopg2-binary = "^2.9.9"
62-
jinja2 = "^3.1.2"
60+
jsonschema = "^4.21.0"
61+
jinja2 = "^3.1.3"
6362

6463
[tool.poetry.group.integration]
6564
optional = true
6665

6766
[tool.poetry.group.integration.dependencies]
68-
pytest = "^7.4.0"
69-
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v7.0.0", subdirectory = "python/pytest_plugins/github_secrets"}
70-
pytest-operator = "^0.29.0"
71-
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v7.0.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
72-
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v7.0.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
73-
juju = "^3.2.2"
74-
boto3 = "^1.28.70"
75-
tenacity = "^8.2.3"
67+
pytest = "^7.4.4"
68+
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v9.3.1", subdirectory = "python/pytest_plugins/github_secrets"}
69+
pytest-operator = "^0.32.0"
70+
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v9.3.1", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
71+
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v9.3.1", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
72+
juju = "^3.3.0.0"
73+
boto3 = "*"
74+
tenacity = "*"
7675
landscape-api-py3 = "^0.9.0"
7776
mailmanclient = "^3.3.5"
78-
psycopg2-binary = "^2.9.9"
77+
psycopg2-binary = "*"
7978

8079
# Testing tools configuration
8180
[tool.coverage.run]

tox.ini

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,20 @@ set_env =
1717
allowlist_externals =
1818
poetry
1919

20-
[testenv:{build,pack-wrapper}]
20+
[testenv:build-{production,dev,wrapper}]
2121
# Wrap `charmcraft pack`
2222
pass_env =
23-
CRAFT_SHARED_CACHE
23+
CI
2424
allowlist_externals =
2525
{[testenv]allowlist_externals}
2626
charmcraft
27+
charmcraftcache
2728
mv
2829
commands_pre =
29-
poetry export --only main,charm-libs --output requirements.txt --without-hashes
30+
poetry export --only main,charm-libs --output requirements.txt
3031
commands =
31-
build: charmcraft pack {posargs}
32+
build-production: charmcraft pack {posargs}
33+
build-dev: charmcraftcache pack {posargs}
3234
commands_post =
3335
mv requirements.txt requirements-last-build.txt
3436

@@ -77,11 +79,11 @@ pass_env =
7779
GITHUB_OUTPUT
7880
SECRETS_FROM_GITHUB
7981
allowlist_externals =
80-
{[testenv:pack-wrapper]allowlist_externals}
82+
{[testenv:build-wrapper]allowlist_externals}
8183
commands_pre =
8284
poetry install --only integration --no-root
83-
{[testenv:pack-wrapper]commands_pre}
85+
{[testenv:build-wrapper]commands_pre}
8486
commands =
8587
poetry run pytest -v --tb native --log-cli-level=INFO -s --ignore={[vars]tests_path}/unit/ {posargs}
8688
commands_post =
87-
{[testenv:pack-wrapper]commands_post}
89+
{[testenv:build-wrapper]commands_post}

0 commit comments

Comments
 (0)