Skip to content

Commit

Permalink
CI Cleanup (#30)
Browse files Browse the repository at this point in the history
## Proposal
Reuse CI pipeline in release.yaml.
  • Loading branch information
Will Fitch authored Oct 12, 2022
1 parent 96fd6c6 commit 74ba1d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 101 deletions.
101 changes: 3 additions & 98 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,111 +20,16 @@ jobs:
credentials: "${{ secrets.CHARMHUB_TOKEN }}" # FIXME: current token will expire in 2023-07-04
github-token: "${{ secrets.GITHUB_TOKEN }}"

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: python3 -m pip install tox
- name: Run linters
run: tox -e lint

unit-test:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: python -m pip install tox
- name: Run tests
run: tox -e unit

integration-standalone:
name: Integration tests for standalone charm
needs:
- lib-check
- lint
- unit-test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: lxd
lxd-channel: 5.4/stable
- name: Run integration tests
run: tox -e standalone-integration

integration-backend:
name: Integration tests for backend relation
needs:
- lib-check
- lint
- unit-test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: lxd
lxd-channel: 5.4/stable
- name: Run integration tests
run: tox -e backend-integration


integration-legacy-relations:
name: Integration tests for legacy relations
needs:
- lib-check
- lint
- unit-test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: lxd
lxd-channel: 5.4/stable
- name: Run integration tests
run: tox -e legacy-relation-integration

integration-scaling:
name: Integration tests for scaling pgbouncer (microk8s)
ci:
needs:
- lib-check
- lint
- unit-test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: lxd
lxd-channel: 5.4/stable
- name: Run scaling integration tests
run: tox -e scaling-integration
uses: ./.github/workflows/ci.yaml

release-to-charmhub:
name: Release to CharmHub
needs:
- lib-check
- lint
- unit-test
- integration-standalone
- integration-backend
- integration-legacy-relations
- integration-scaling
- ci
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
5 changes: 2 additions & 3 deletions src/relations/backend_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ def initialise_auth_function(self, dbs: List[str]):
psycopg2.Error if self.postgres isn't usable.
"""
logger.info("initialising auth function")

install_script = open("src/relations/sql/pgbouncer-install.sql", "r").read()

for dbname in dbs:
Expand All @@ -217,8 +216,7 @@ def remove_auth_function(self, dbs: List[str]):
Raises:
psycopg2.Error if self.postgres isn't usable.
"""
logger.info("initialising auth function")

logger.info("removing auth function from backend relation")
uninstall_script = open("src/relations/sql/pgbouncer-uninstall.sql", "r").read()
for dbname in dbs:
with self.postgres.connect_to_database(dbname) as conn, conn.cursor() as cursor:
Expand All @@ -230,6 +228,7 @@ def remove_auth_function(self, dbs: List[str]):
def relation(self) -> Relation:
"""Relation object for postgres backend-database relation."""
backend_relation = self.model.get_relation(BACKEND_RELATION_NAME)

if not backend_relation:
return None
else:
Expand Down

0 comments on commit 74ba1d5

Please sign in to comment.