From 3b035817c8902275696803844355645a062f3206 Mon Sep 17 00:00:00 2001 From: Carl Csaposs Date: Fri, 1 Dec 2023 13:39:23 +0000 Subject: [PATCH] first pass --- .github/workflows/ci.yaml | 16 +- .github/workflows/release.yaml | 12 +- .github/workflows/sync_issue_to_jira.yaml | 2 + .gitignore | 4 +- CONTRIBUTING.md | 16 +- charmcraft.yaml | 1 + poetry.lock | 641 +++++++++++----------- pyproject.toml | 23 +- 8 files changed, 354 insertions(+), 361 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b101ac4c..fe2aee64 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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: @@ -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 @@ -41,8 +40,8 @@ jobs: - name: Check libs uses: canonical/charming-actions/check-libraries@2.4.0 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 @@ -67,6 +66,7 @@ jobs: actions: write # Needed to manage GitHub Actions cache integration-test: + # TODO: use reusable workflow strategy: fail-fast: false matrix: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 44a9eb72..b05112c4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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/build_charm_without_cache.yaml@v5.1.2 - 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 @@ -35,7 +34,6 @@ jobs: name: Release libraries runs-on: ubuntu-latest needs: - - ci-tests - release-charm steps: - name: Checkout @@ -45,5 +43,5 @@ jobs: - name: Release any bumped charm libs uses: canonical/charming-actions/release-libraries@2.2.2 with: - credentials: "${{ secrets.CHARMHUB_TOKEN }}" - github-token: "${{ secrets.GITHUB_TOKEN }}" + credentials: ${{ secrets.CHARMHUB_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/sync_issue_to_jira.yaml b/.github/workflows/sync_issue_to_jira.yaml index 4221f69e..cd41a699 100644 --- a/.github/workflows/sync_issue_to_jira.yaml +++ b/.github/workflows/sync_issue_to_jira.yaml @@ -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 }} diff --git a/.gitignore b/.gitignore index 353d0bdf..b8e493e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +/requirements.txt +/requirements-last-build.txt + venv/ build/ *.charm @@ -7,4 +10,3 @@ __pycache__/ *.py[cod] .idea .vscode/ -requirements.txt diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 20e88bcc..cc04745f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 @@ -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 ```