Skip to content

Commit

Permalink
chore: Add basic CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Gu1nness committed Nov 5, 2024
1 parent 3f17d90 commit b0fc9a2
Show file tree
Hide file tree
Showing 5 changed files with 962 additions and 1 deletion.
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Bug report
about: File a bug report
labels: bug

---

<!-- Thank you for submitting a bug report! All fields are required unless marked optional. -->

## Steps to reproduce
<!-- Please enable debug logging by running `juju model-config logging-config="<root>=INFO;unit=DEBUG"` (if possible) -->
1.

## Expected behavior


## Actual behavior
<!-- If applicable, add screenshots -->


## Versions

<!-- Run `lsb_release -sd` -->
Operating system:

<!-- Run `juju version` -->
Juju CLI:

<!-- Model version from `juju status` -->
Juju agent:

<!-- App revision from `juju status` or (advanced) commit hash -->
Charm revision:

<!-- Run `lxd version` -->
LXD:

## Log output
<!-- Please enable debug logging by running `juju model-config logging-config="<root>=INFO;unit=DEBUG"` (if possible) -->
<!-- Then, run `juju debug-log --replay > log.txt` and upload "log.txt" file here -->
Juju debug log:

<!-- (Optional) Copy the logs that are relevant to the bug & paste inside triple backticks below -->


## Additional context
<!-- (Optional) Add any additional information here -->
38 changes: 38 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!-- Provide a general summary of your changes in the Title above -->
<!-- markdownlint-disable MD041 -->

## 🏷 Type of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation Update
- [ ] Tooling and CI changes
- [ ] Dependencies upgrade or change

## 📝 Description
<!--
Describe your changes in detail including:
- the purpose and scope of this PR (what)
- the impacted components (where, often match conventional commit scope)
- explanation/algorithm if require (how)
-->

## 📑 Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- Either the associated JIRA reference or a paragraph. -->

## 🧪 How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

## ✅ Checklist
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the [**CONTRIBUTING**](../blob/main/CONTRIBUTING.md) document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run tests

on:
pull_request:
push:
branches:
- main
- feat/**
schedule:
- cron: "53 0 * * *" # Daily at 00:53 UTC
workflow_dispatch:

jobs:
lint:
name: Lint
uses: canonical/data-platform-workflows/.github/workflows/[email protected]

unit-test:
name: Unit test charm
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install tox & poetry
run: |
pipx install tox
pipx install poetry
- name: Set up python environment
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: 'poetry'
- name: Run tests
run: tox run -e unit
61 changes: 61 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Test & Publish to PyPI

on:
workflow_dispatch:

jobs:
build:
name: Build package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'poetry'
- name: Build package
run: poetry build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

unit-test:
name: Test package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install poetry and tox
run: |
pipx install tox
pipx install poetry
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'poetry'
- name: Run unit tests
run: tox run -e unit

publish:
name: Publish to PyPI
needs:
- build
runs-on: ubuntu-latest
environment: production
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
permissions:
id-token: write # Needed for trusted publishing (https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/)
Loading

0 comments on commit b0fc9a2

Please sign in to comment.