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

[MISC] Switch to strict deps and latest dpw #325

Merged
merged 4 commits into from
Jan 19, 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
8 changes: 0 additions & 8 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,5 @@
"matchPackageNames": ["python"],
"allowedVersions": "<3.11"
}
],
"regexManagers": [
{
"fileMatch": ["(^|/)([\\w-]*)charmcraft\\.ya?ml$"],
"matchStrings": ["- (?<depName>.*?)(?:\\[.*?\\])?==(?<currentValue>.*?) +# renovate"],
"datasourceTemplate": "pypi",
"versioningTemplate": "loose"
}
]
}
13 changes: 6 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
jobs:
lint:
name: Lint
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v7.0.0
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v9.3.1

unit-test:
name: Unit test charm
Expand All @@ -42,25 +42,24 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
permissions:
actions: write # Needed to manage GitHub Actions cache

uses: canonical/data-platform-workflows/.github/workflows/[email protected]
with:
charmcraft-snap-channel: beta

integration-test:
strategy:
fail-fast: false
matrix:
juju:
- agent: 2.9.45
- agent: 2.9.46
libjuju: ^2
- agent: 3.1.7
name: Integration test charm | ${{ matrix.juju.agent }}
needs:
- lint
- unit-test
- build
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v7.0.0
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v9.3.1
with:
artifact-name: ${{ needs.build.outputs.artifact-name }}
cloud: lxd
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/lib-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up environment
run: |
pipx install tox
pipx install poetry
pipx inject poetry poetry-plugin-export
# TODO: Remove after https://github.com/python-poetry/poetry/pull/5980 is closed
poetry config warnings.export false
- name: Generate requirements
run: |
tox run -e build-wrapper
mv requirements-last-build.txt requirements.txt
- name: Check libs
uses: canonical/charming-actions/[email protected]
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ 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/[email protected]
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
with:
charmcraft-snap-channel: beta

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@v9.3.1
with:
channel: 14/edge
artifact-name: ${{ needs.build.outputs.artifact-name }}
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@v9.3.1
with:
jira-base-url: https://warthogs.atlassian.net
jira-project-key: DPE
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ tox # runs 'lint' and 'unit' environments
Build the charm in this git repository using:

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

The tox build environment assumes that there is a preinstalled [poetry](https://python-poetry.org/) on the system.
Expand Down
3 changes: 2 additions & 1 deletion charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ parts:
- rustc
- cargo
- pkg-config
charm-strict-dependencies: true
charm-binary-python-packages:
- psycopg2-binary==2.9.9 # renovate
- psycopg2-binary
672 changes: 339 additions & 333 deletions poetry.lock

Large diffs are not rendered by default.

41 changes: 20 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ repository = "https://github.com/canonical/postgresql-operator"

[tool.poetry.dependencies]
python = "^3.10"
ops = "^2.8.0"
cryptography = "^41.0.5"
boto3 = "^1.28.70"
ops = "^2.9.0"
cryptography = "^41.0.7"
boto3 = "^1.34.22"
pgconnstr = "^1.0.1"
requests = "^2.31.0"
tenacity = "^8.2.3"
# psycopg2 = "2.9.5" # Injected in charmcraft.yaml
psycopg2-binary = "^2.9.9"
cosl = "^0.0.7"
pydantic = "^1.10.13"
poetry-core = "^1.7.0"
pyOpenSSL = "^23.2.0"
poetry-core = "^1.8.0"
pyOpenSSL = "^23.3.0"

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

[tool.poetry.group.format.dependencies]
black = "^23.9.1"
ruff = "^0.1.3"
black = "^23.12.1"
ruff = "^0.1.13"

[tool.poetry.group.lint]
optional = true
Expand All @@ -55,27 +55,26 @@ optional = true
[tool.poetry.group.unit.dependencies]
coverage = {extras = ["toml"], version = "^7.3.2"}
pytest = "^7.4.0"
pytest-asyncio = "^0.21.1"
pytest-asyncio = "*"
parameterized = "^0.9.0"
jsonschema = "^4.19.1"
psycopg2-binary = "^2.9.9"
jinja2 = "^3.1.2"
jsonschema = "^4.21.0"
jinja2 = "^3.1.3"

[tool.poetry.group.integration]
optional = true

[tool.poetry.group.integration.dependencies]
pytest = "^7.4.0"
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v7.0.0", subdirectory = "python/pytest_plugins/github_secrets"}
pytest-operator = "^0.29.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"}
juju = "^3.2.2"
boto3 = "^1.28.70"
tenacity = "^8.2.3"
pytest = "^7.4.4"
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v9.3.1", subdirectory = "python/pytest_plugins/github_secrets"}
pytest-operator = "^0.32.0"
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v9.3.1", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v9.3.1", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
juju = "^3.3.0.0"
boto3 = "*"
tenacity = "*"
landscape-api-py3 = "^0.9.0"
mailmanclient = "^3.3.5"
psycopg2-binary = "^2.9.9"
psycopg2-binary = "*"

# Testing tools configuration
[tool.coverage.run]
Expand Down
16 changes: 9 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ 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 =
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

Expand Down Expand Up @@ -77,11 +79,11 @@ pass_env =
GITHUB_OUTPUT
SECRETS_FROM_GITHUB
allowlist_externals =
{[testenv:pack-wrapper]allowlist_externals}
{[testenv:build-wrapper]allowlist_externals}
commands_pre =
poetry install --only integration --no-root
{[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}