Skip to content

Commit 62d4cd5

Browse files
authored
[DPE-8030] Initial CI (#3)
* Initial ci * Add renovate and jira sync * Pyright * Templates * Add permissions * Add microk8s to template
1 parent 5dc9791 commit 62d4cd5

File tree

13 files changed

+279
-20
lines changed

13 files changed

+279
-20
lines changed

.github/.jira_sync_config.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Sync GitHub issues to Jira issues
2+
3+
# Configuration syntax:
4+
# https://github.com/canonical/gh-jira-sync-bot/blob/main/README.md#client-side-configuration
5+
settings:
6+
# Repository specific settings
7+
components: # Jira components that will be added to Jira issue
8+
- postgresql-vm
9+
- postgresql-k8s
10+
11+
# Settings shared across Data Platform repositories
12+
label_mapping:
13+
# If the GitHub issue does not have a label in this mapping, the Jira issue will be created as a Bug
14+
enhancement: Story
15+
jira_project_key: DPE # https://warthogs.atlassian.net/browse/DPE
16+
status_mapping:
17+
opened: untriaged
18+
closed: done # GitHub issue closed as completed
19+
not_planned: rejected # GitHub issue closed as not planned
20+
add_gh_comment: true
21+
sync_description: false
22+
sync_comments: false
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: Bug report
3+
about: File a bug report
4+
labels: bug
5+
6+
---
7+
8+
<!-- Thank you for submitting a bug report! All fields are required unless marked optional. -->
9+
10+
## Steps to reproduce
11+
<!-- Please enable debug logging by running `juju model-config logging-config="<root>=INFO;unit=DEBUG"` (if possible) -->
12+
1.
13+
14+
## Expected behavior
15+
16+
17+
## Actual behavior
18+
<!-- If applicable, add screenshots -->
19+
20+
21+
## Versions
22+
23+
<!-- Run `lsb_release -sd` -->
24+
Operating system:
25+
26+
<!-- Run `juju version` -->
27+
Juju CLI:
28+
29+
<!-- Model version from `juju status` -->
30+
Juju agent:
31+
32+
<!-- App revision from `juju status` or (advanced) commit hash -->
33+
Charm revision:
34+
35+
<!-- Run `lxd version` -->
36+
LXD:
37+
38+
<!-- Run `microk8s version` -->
39+
microk8s:
40+
41+
## Log output
42+
<!-- Please enable debug logging by running `juju model-config logging-config="<root>=INFO;unit=DEBUG"` (if possible) -->
43+
<!-- Then, run `juju debug-log --replay > log.txt` and upload "log.txt" file here -->
44+
Juju debug log:
45+
46+
<!-- (Optional) Copy the logs that are relevant to the bug & paste inside triple backticks below -->
47+
48+
49+
## Additional context
50+
<!-- (Optional) Add any additional information here -->

.github/codecov.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
github_checks:
2+
annotations: false
3+
coverage:
4+
status:
5+
project:
6+
default:
7+
target: 70%
8+
patch:
9+
default:
10+
target: 33%

.github/pull_request_template.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Issue
2+
3+
## Solution
4+
5+
## Checklist
6+
- [ ] I have added or updated any relevant documentation.
7+
- [ ] I have cleaned any remaining cloud resources from my accounts.

.github/renovate.json5

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
3+
extends: [
4+
'github>canonical/data-platform//renovate_presets/charm.json5',
5+
],
6+
reviewers: [
7+
'team:data-postgresql',
8+
],
9+
packageRules: [
10+
],
11+
customManagers: [
12+
],
13+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2025 Canonical Ltd.
2+
# See LICENSE file for licensing details.
3+
name: Approve Renovate pull request
4+
5+
on:
6+
pull_request:
7+
types:
8+
- opened
9+
10+
jobs:
11+
approve-pr:
12+
name: Approve Renovate pull request
13+
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
14+
permissions:
15+
pull-requests: write # Needed to approve PR

.github/workflows/check_pr.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2025 Canonical Ltd.
2+
# See LICENSE file for licensing details.
3+
name: Check pull request
4+
5+
on:
6+
pull_request:
7+
types:
8+
- opened
9+
- labeled
10+
- unlabeled
11+
- edited
12+
branches:
13+
- main
14+
15+
permissions:
16+
pull-requests: read # Needed to check labels
17+
jobs:
18+
check-pr:
19+
name: Check pull request
20+
uses: canonical/data-platform-workflows/.github/workflows/[email protected]

.github/workflows/ci.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copyright 2025 Canonical Ltd.
2+
# See LICENSE file for licensing details.
3+
name: Tests
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
on:
10+
pull_request:
11+
paths-ignore:
12+
- '.gitignore'
13+
- '.jujuignore'
14+
- 'LICENSE'
15+
- '**.md'
16+
- .github/renovate.json5
17+
- '.github/workflows/sync_docs.yaml'
18+
schedule:
19+
- cron: '53 0 * * *' # Daily at 00:53 UTC
20+
# Triggered on push to branch "main" by .github/workflows/release.yaml
21+
workflow_call:
22+
outputs:
23+
artifact-prefix:
24+
description: build_charm.yaml `artifact-prefix` output
25+
value: ${{ jobs.build.outputs.artifact-prefix }}
26+
27+
permissions: {}
28+
jobs:
29+
# TODO install uv in reusable and re-enable
30+
# lint:
31+
# name: Lint
32+
# uses: canonical/data-platform-workflows/.github/workflows/[email protected]
33+
lint:
34+
name: tox run -e lint
35+
runs-on: ubuntu-latest
36+
timeout-minutes: 5
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v5
40+
- name: Install tox & uv
41+
run: |
42+
pipx install tox
43+
sudo snap install astral-uv --classic
44+
- name: Run linters
45+
run: tox run -e lint
46+
47+
unit-test:
48+
name: Unit test charm
49+
runs-on: ubuntu-latest
50+
timeout-minutes: 5
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v5
54+
- name: Install tox & uv
55+
run: |
56+
pipx install tox
57+
sudo snap install astral-uv --classic
58+
- name: Run tests
59+
run: tox run -e unit
60+
- name: Upload Coverage to Codecov
61+
uses: codecov/codecov-action@v5
62+
env:
63+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
venv/
2+
build/
3+
*.charm
4+
.tox/
5+
.coverage
6+
coverage.xml
7+
__pycache__/
8+
*.py[cod]
9+
*.ini
10+
*.log
11+
*.tar.xz
12+
postgresql_charms_single_kernel.egg-info/

pyproject.toml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ format = [
2626
"ruff==0.12.11"
2727
]
2828
lint = [
29-
"codespell==2.4.1"
29+
"codespell==2.4.1",
30+
"pyright==1.1.405"
3031
]
3132
unit = [
3233
"coverage[toml]==7.9.1; python_version > '3.8'",
@@ -96,3 +97,13 @@ max-complexity = 10
9697

9798
[tool.ruff.lint.pydocstyle]
9899
convention = "google"
100+
101+
[tool.pyright]
102+
include = ["single_kernel_postgresql"]
103+
pythonVersion = "3.8"
104+
pythonPlatform = "All"
105+
typeCheckingMode = "basic"
106+
reportIncompatibleMethodOverride = false
107+
reportImportCycles = false
108+
reportMissingModuleSource = true
109+
stubPath = ""

0 commit comments

Comments
 (0)