Skip to content

Commit

Permalink
Charm it (#1176)
Browse files Browse the repository at this point in the history
* add initial charm

* add charm tests

* separate database

* add database and migration script

* add support for postgresql

* fix issue with accessing error status code

* change to lower case

* Add charm workflows

* add x64 to runs-on

* bump version in pyproject.toml

* fix typo

* fix typo

* ignore security warning

* add x64 to runs-on

* add .licenserc.yaml

* ignore "master"

* add/correct license headers

* ignore licenses in migrations folder

* rewrite docstring to please linter

* fix tox env

* add missing final new line

* enhance config description

* fix lint

* add juju dep

* temporarily switch to github-hosted runners

* update requirements.txt

* use operator workflows for charm integration test

* add trivy config

* add trivy.yaml to license ignore

* ignore auth_health point from coverage report

* separate app and charm tests

* lint, re-add app integration tests and use fake github token

* fix after merge

* move pytest_addoption to the root

* do not use operator workflows for app tests

* pass github token to integration test

* add note to set INTEGRATION_TEST_ARGS

* Use __name__ as arg to Flask constructor

* add optional: false

* add comment to use juju user secrets in the future

* pin paas-app-charmer==1.0.0

* add integration test for auth_health endpoint

* add coverage exclusion for postgresql engine

* fix placement of no cover directive

* pin pytest==8.1.1

* add missing src-docs

* change version to 1.8.0 in rockcraft.yaml

* Revert "pin pytest==8.1.1"

This reverts commit 507a9d8.

* lint tests.yaml

* reenable edge runners

* ignore bandit warning

* use gunicorn logger

* refactor setup logging

remove handler from urllib3 to avoid duplicate logs

* add no cover to _setup_root_logger

---------

Co-authored-by: jdkandersson <[email protected]>
  • Loading branch information
cbartz and jdkandersson committed May 2, 2024
1 parent 7ddef39 commit 9ce0b74
Show file tree
Hide file tree
Showing 63 changed files with 12,968 additions and 305 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/auto_update_libs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Auto-update charm libraries

on:
schedule:
- cron: "0 1 * * *"

jobs:
auto-update-libs:
uses: canonical/operator-workflows/.github/workflows/auto_update_charm_libs.yaml@main
secrets: inherit
10 changes: 10 additions & 0 deletions .github/workflows/bot_pr_approval.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Provide approval for bot PRs

on:
pull_request:

jobs:
bot_pr_approval:
uses: canonical/operator-workflows/.github/workflows/bot_pr_approval.yaml@main
secrets: inherit

23 changes: 23 additions & 0 deletions .github/workflows/integration_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Charm Integration tests

on:
pull_request:
branches-ignore:
- 'test-branch/**'

jobs:
# Usage of operator workflows requires INTEGRATION_TEST_ARGS to be set with
# --github-token PAT, where PAT is a GitHub Personal Access Token with sufficient perms for the
# charm integration test.
charm-integration-test:
uses: canonical/operator-workflows/.github/workflows/integration_test.yaml@main
secrets: inherit
with:
juju-channel: 3.1/stable
channel: 1.28-strict/stable
self-hosted-runner: true
self-hosted-runner-label: "edge"
rockcraft-channel: latest/edge
charmcraft-channel: latest/edge
test-tox-env: charm-integration-test
trivy-image-config: "trivy.yaml"
67 changes: 0 additions & 67 deletions .github/workflows/integration_tests.yaml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/promote_charm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Promote charm

on:
workflow_dispatch:
inputs:
origin-channel:
type: choice
description: 'Origin Channel'
options:
- latest/edge
destination-channel:
type: choice
description: 'Destination Channel'
options:
- latest/stable
secrets:
CHARMHUB_TOKEN:
required: true

jobs:
promote-charm:
uses: canonical/operator-workflows/.github/workflows/promote_charm.yaml@main
with:
origin-channel: ${{ github.event.inputs.origin-channel }}
destination-channel: ${{ github.event.inputs.destination-channel }}
secrets: inherit
16 changes: 16 additions & 0 deletions .github/workflows/publish_charm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Publish to edge

on:
workflow_dispatch:
push:
branches:
- main

jobs:
publish-to-edge:
uses: canonical/operator-workflows/.github/workflows/publish_charm.yaml@main
secrets: inherit
with:
channel: latest/edge
charm-directory: charm
charmcraft-channel: "latest/edge"
Loading

0 comments on commit 9ce0b74

Please sign in to comment.