Skip to content

Commit

Permalink
first pass
Browse files Browse the repository at this point in the history
  • Loading branch information
carlcsaposs-canonical committed Jan 4, 2024
1 parent d25620d commit 3b03581
Show file tree
Hide file tree
Showing 8 changed files with 354 additions and 361 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ on:
- cron: "53 0 * * *" # Daily at 00:53 UTC
# Triggered on push to branch "main" by .github/workflows/release.yaml
workflow_call:
secrets:
CHARMHUB_TOKEN:
required: true

jobs:
lint:
Expand All @@ -23,9 +20,11 @@ jobs:
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install tox
run: python3 -m pip install tox
uses: actions/checkout@v4
- name: Install tox & poetry
run: |
pipx install tox
pipx install poetry
- name: Run linters
run: tox run -e lint

Expand All @@ -41,8 +40,8 @@ jobs:
- name: Check libs
uses: canonical/charming-actions/[email protected]
with:
credentials: "${{ secrets.CHARMHUB_TOKEN }}" # FIXME: current token will expire in 2023-07-04
github-token: "${{ secrets.GITHUB_TOKEN }}"
credentials: ${{ secrets.CHARMHUB_TOKEN }} # FIXME: current token will expire in 2023-07-04
github-token: ${{ secrets.GITHUB_TOKEN }}

unit-test:
name: Unit test charm
Expand All @@ -67,6 +66,7 @@ jobs:
actions: write # Needed to manage GitHub Actions cache

integration-test:
# TODO: use reusable workflow
strategy:
fail-fast: false
matrix:
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,19 @@ on:
jobs:
ci-tests:
uses: ./.github/workflows/ci.yaml
secrets:
CHARMHUB_TOKEN: "${{ secrets.CHARMHUB_TOKEN }}"
secrets: inherit

build:
name: Build charm
# TODO: update version
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
with:
charmcraft-snap-channel: "latest/stable"

release-charm:
name: Release charm
needs:
- ci-tests
- build
# TODO: update version
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v5
with:
channel: 6/edge
Expand All @@ -35,7 +34,6 @@ jobs:
name: Release libraries
runs-on: ubuntu-latest
needs:
- ci-tests
- release-charm
steps:
- name: Checkout
Expand All @@ -45,5 +43,5 @@ jobs:
- name: Release any bumped charm libs
uses: canonical/charming-actions/[email protected]
with:
credentials: "${{ secrets.CHARMHUB_TOKEN }}"
github-token: "${{ secrets.GITHUB_TOKEN }}"
credentials: ${{ secrets.CHARMHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/sync_issue_to_jira.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ on:
jobs:
sync:
name: Sync GitHub issue to Jira
# TODO: update version
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v2
with:
jira-base-url: https://warthogs.atlassian.net
jira-project-key: DPE
# TODO: update
jira-component-names: mongodb-vm
secrets:
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/requirements.txt
/requirements-last-build.txt

venv/
build/
*.charm
Expand All @@ -7,4 +10,3 @@ __pycache__/
*.py[cod]
.idea
.vscode/
requirements.txt
16 changes: 12 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@

To make contributions to this charm, you'll need a working [development setup](https://juju.is/docs/sdk/dev-setup).

You can create an environment for development with `tox`:
## Developing
Install `tox` and `poetry`
```shell
python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install tox
pipx install poetry
```

You can create an environment for development:

```shell
tox devenv -e integration
source venv/bin/activate
poetry install
```

## Testing
Expand All @@ -28,7 +36,7 @@ tox # runs 'format', 'lint', 'static', and 'unit' environme
Build the charm in this git repository using:

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

<!-- You may want to include any contribution/style guidelines in this document>
1 change: 1 addition & 0 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ bases:

parts:
charm:
# todo: remove binary packages
charm-binary-python-packages:
- setuptools
- cryptography
Expand Down
641 changes: 309 additions & 332 deletions poetry.lock

Large diffs are not rendered by default.

23 changes: 14 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.

[tool.poetry]
name = "mongos-operator"
# Charm is not packed as a standard Python package; this information is not used
name = "charm"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]
readme = "README.md"
authors = []

[tool.poetry.dependencies]
python = "^3.10"
Expand All @@ -27,37 +30,39 @@ typing-extensions = "^4.5.0"
parameterized = "^0.9.0"
jsonschema = "^4.20.0"


[tool.poetry.group.charm-libs.dependencies]
# data_platform_libs/v0/data_interfaces.py
ops = ">=2.0.0"
# tls_certificates_interface/v1/tls_certificates.py
cryptography = "*"
jsonschema = "*"

[tool.poetry.group.fmt.dependencies]
[tool.poetry.group.format]
optional = true

[tool.poetry.group.format.dependencies]
black = "^23.11.0"
ruff = "^0.1.6"

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

[tool.poetry.group.lint.dependencies]
black = "^23.11.0"
ruff = "^0.1.6"
codespell = "^2.2.6"
pyright = "^1.1.337"


[tool.poetry.group.unit.dependencies]
pytest = "^7.4.3"
coverage = "^7.3.2"
jsonschema = "^4.20.0"
pytest-mock = "^3.12.0"


[tool.poetry.group.integration.dependencies]
pytest = ">=7.2"
pytest = "^7.4.3"
juju = "^3.2.0"
pytest-operator = ">0.20"
pytest-operator = "^0.28.0"
coverage = "^7.3.2"
protobuf = "3.20"

Expand Down

0 comments on commit 3b03581

Please sign in to comment.