Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DPE-5762] Add CI workflows #2

Merged
merged 13 commits into from
Nov 7, 2024
21 changes: 21 additions & 0 deletions .github/.jira_sync_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Sync GitHub issues to Jira issues

# Configuration syntax:
# https://github.com/canonical/gh-jira-sync-bot/blob/main/README.md#client-side-configuration
settings:
# Repository specific settings
components: # Jira components that will be added to Jira issue
- etcd-vm

# Settings shared across Data Platform repositories
label_mapping:
# If the GitHub issue does not have a label in this mapping, the Jira issue will be created as a Bug
enhancement: Story
jira_project_key: DPE # https://warthogs.atlassian.net/browse/DPE
status_mapping:
opened: untriaged
closed: done # GitHub issue closed as completed
not_planned: rejected # GitHub issue closed as not planned
add_gh_comment: true
sync_description: false
sync_comments: false
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
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:

## 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 -->
87 changes: 87 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

name: Tests

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
workflow_call:
pull_request:
schedule:
- cron: '53 0 * * *' # Daily at 00:53 UTC

jobs:
lint:
name: Lint
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
skourta marked this conversation as resolved.
Show resolved Hide resolved

unit-test:
name: Unit test charm
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install tox & poetry
run: |
pipx install tox
pipx install poetry
- name: Run tests
run: tox run -e unit
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4

lib-check:
name: Check libraries
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
# Workaround for https://github.com/canonical/charmcraft/issues/1389#issuecomment-1880921728
touch requirements.txt
- name: Check libs
uses: canonical/charming-actions/[email protected]
with:
credentials: ${{ secrets.CHARMHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
use-labels: false
fail-build: ${{ github.event_name == 'pull_request' }}

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
with:
cache: true

integration-test:
strategy:
fail-fast: false
matrix:
juju:
# This runs on all runs
- agent: 3.5.4 # renovate: juju-agent-pin-minor
allure_report: true
# This runs only on scheduled runs, DPW 21 specifics (scheduled + 3.6/X)
- snap_channel: 3.6/beta
allure_report: false
name: Integration test charm | ${{ matrix.juju.agent || matrix.juju.snap_channel }}
needs:
- lint
- unit-test
- build
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
with:
juju-agent-version: ${{ matrix.juju.agent }}
juju-snap-channel: ${{ matrix.juju.snap_channel }}
_beta_allure_report: ${{ matrix.juju.allure_report }}
artifact-prefix: packed-charm-cache-true
cloud: lxd
permissions:
contents: write
54 changes: 54 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
name: Release to Charmhub

on:
push:
branches:
- main

jobs:
ci-tests:
name: Tests
uses: ./.github/workflows/ci.yaml
secrets: inherit
permissions:
contents: write # Needed for Allure Report beta

release-libraries:
name: Release libraries
needs:
- ci-tests
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
# Workaround for https://github.com/canonical/charmcraft/issues/1389#issuecomment-1880921728
touch requirements.txt
- name: Release charm libraries
uses: canonical/charming-actions/[email protected]
with:
credentials: ${{ secrets.CHARMHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/[email protected]

# release:
# name: Release charm
# needs:
# - ci-tests
# - build
# uses: canonical/data-platform-workflows/.github/workflows/[email protected]
# with:
# channel: 3.5/edge
# artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
# secrets:
# charmhub-token: ${{ secrets.CHARMHUB_TOKEN }}
# permissions:
# contents: write # Needed to create GitHub release
30 changes: 23 additions & 7 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

# This file configures Charmcraft.
# See https://juju.is/docs/sdk/charmcraft-config for guidance.

name: charmed-etcd-operator
type: charm
title: Charmed etcd VM operator
summary: Operator for etcd databases in VM environments.
description: |
Etcd is a distributed, reliable key-value store for the most critical data of
distributed systems, such as Kubernetes. This charmed operator deploys and operates
etcd on virtual machines.

# temporary based on 22.04 as data-platform-workflows is not ready yet for 24.04
# see: https://github.com/canonical/data-platform-workflows/issues/246
Expand All @@ -19,3 +15,23 @@ bases:
run-on:
- name: ubuntu
channel: "22.04"

parts:
charm:
build-snaps:
- rustup
build-packages:
- libffi-dev
- libssl-dev
- pkg-config
override-build: |
rustup default stable

# Convert subset of poetry.lock to requirements.txt
curl -sSL https://install.python-poetry.org | python3 -
/root/.local/bin/poetry export --only main,charm-libs --output requirements.txt

craftctl default
charm-strict-dependencies: true
charm-requirements: [requirements.txt]
charm-entrypoint: src/charm.py
10 changes: 10 additions & 0 deletions metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2024 Canonical Ltd.
skourta marked this conversation as resolved.
Show resolved Hide resolved
# See LICENSE file for licensing details.

name: charmed-etcd-operator
title: Charmed etcd VM operator
summary: Operator for etcd databases in VM environments.
description: |
Etcd is a distributed, reliable key-value store for the most critical data of
distributed systems, such as Kubernetes. This charmed operator deploys and operates
etcd on virtual machines.
Loading
Loading