Skip to content

Commit

Permalink
[MISC] Switch to strict requirements (#349)
Browse files Browse the repository at this point in the history
* Switch to strict requirements

* Regenerate lock

* Switch to dpw 9

* Update boilerplate
  • Loading branch information
dragomirp authored Jan 10, 2024
1 parent c7b9692 commit a938b78
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 75 deletions.
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"
}
]
}
14 changes: 7 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.0.2

unit-test:
name: Unit test charm
Expand All @@ -45,28 +45,28 @@ jobs:

build:
name: Build charm
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_charms_with_cache.yaml@v9.0.2
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.6
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.0.2
with:
artifact-name: ${{ needs.build.outputs.artifact-name }}
cloud: microk8s
microk8s-snap-channel: 1.28-strict/stable
microk8s-snap-channel: 1.29-strict/stable
juju-agent-version: ${{ matrix.juju.agent }}
libjuju-version-constraint: ${{ matrix.juju.libjuju }}
secrets:
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
19 changes: 15 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ jobs:
name: Tests
uses: ./.github/workflows/ci.yaml
secrets: inherit
permissions:
actions: write # Needed to manage GitHub Actions cache

release-libraries:
name: Release libraries
Expand All @@ -33,6 +31,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: Release charm libraries
uses: canonical/charming-actions/[email protected]
with:
Expand All @@ -41,14 +50,16 @@ jobs:

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.0.2
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.0.2
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 @@ -49,7 +49,7 @@ microk8s config > ~/.kube/config
Build the charm in this git repository using:

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

### Deploy
Expand Down
5 changes: 3 additions & 2 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ 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
build-packages:
Expand All @@ -21,5 +21,6 @@ parts:
- rustc
- cargo
- pkg-config
charm-strict-dependencies: true
charm-binary-python-packages:
- psycopg2-binary==2.9.9 # renovate
- psycopg2-binary
4 changes: 2 additions & 2 deletions lib/charms/observability_libs/v1/kubernetes_service_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def setUp(self, *unused):

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 8
LIBPATCH = 9

ServiceType = Literal["ClusterIP", "LoadBalancer"]

Expand Down Expand Up @@ -314,7 +314,7 @@ def _is_patched(self, client: Client) -> bool:
raise

# Construct a list of expected ports, should the patch be applied
expected_ports = [(p.port, p.targetPort) for p in self.service.spec.ports]
expected_ports = [(p.port, p.targetPort) for p in self.service.spec.ports] # type: ignore[attr-defined]
# Construct a list in the same manner, using the fetched service
fetched_ports = [
(p.port, p.targetPort) for p in service.spec.ports # type: ignore[attr-defined]
Expand Down
Loading

0 comments on commit a938b78

Please sign in to comment.