Skip to content

Commit

Permalink
Add minimal CI integration (#111)
Browse files Browse the repository at this point in the history
* Add a minimal CI setup and pass CI tests
* Drop outdated amulet tests
* Disable coverage checks
  • Loading branch information
aieri authored Jul 18, 2024
1 parent a643b43 commit 5f50b2c
Show file tree
Hide file tree
Showing 15 changed files with 400 additions and 307 deletions.
10 changes: 10 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file is centrally managed as a template file in https://github.com/canonical/solutions-engineering-automation
# To update the file:
# - Edit it in the canonical/solutions-engineering-automation repository.
# - Open a PR with the changes.
# - When the PR merges, the soleng-terraform bot will open a PR to the target repositories with the changes.
#
# These owners will be the default owners for everything in the repo. Unless a
# later match takes precedence, @canonical/soleng-reviewers will be requested for
# review when someone opens a pull request.
* @canonical/soleng-reviewers
37 changes: 37 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Check workflow running linter, unit and functional tests

on:
workflow_call:
workflow_dispatch:
pull_request:
types: [ opened, synchronize, reopened ]
branches: [ master, main ]
paths-ignore:
- '**.md'
- '**.rst'

concurrency:
# We do not want to run multiple jobs for single PR.
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
lint-unit:
name: Lint checkers and Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Run lint checkers
run: tox -e lint
- name: Run unit tests
run: tox -e unit
25 changes: 25 additions & 0 deletions .github/workflows/promote.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Promote charm to other tracks and channels

on:
workflow_dispatch:
inputs:
destination-channel:
description: 'Destination Channel, e.g. latest/candidate'
required: true
origin-channel:
description: 'Origin Channel, e.g. latest/edge'
required: true

jobs:
promote-charm:
name: Promote charm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Release charm to channel
uses: canonical/charming-actions/[email protected]
with:
credentials: ${{ secrets.CHARMHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
destination-channel: ${{ github.event.inputs.destination-channel }}
origin-channel: ${{ github.event.inputs.origin-channel }}
29 changes: 29 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release to Edge

on:
push:
branches: [ main ]
release:
types: [ published ]

jobs:
check:
uses: ./.github/workflows/check.yaml
secrets: inherit

release:
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Initialize lxd # This should dropped once it's implemented on charming-actions itself. https://github.com/canonical/charming-actions/issues/140
uses: canonical/[email protected]
- name: Upload charm to charmhub
uses: canonical/charming-actions/[email protected]
with:
credentials: "${{ secrets.CHARMHUB_TOKEN }}"
github-token: "${{ secrets.GITHUB_TOKEN }}"
channel: "latest/edge"
# Note(rgildein): Right now we are not using destructive-mode, since our charmcraft.yaml is designed with a single build-on and the ability to run-on multiple bases. Running with destructive-mode would require aligning the base defined in this job with the one defined in charmcraft.yaml (build-on).
destructive-mode: false
48 changes: 48 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This is a template `.gitignore` file for ops charms
# This file is managed by bootstack-charms-spec and should not be modified
# within individual charm repos. https://launchpad.net/bootstack-charms-spec

# Juju files
.unit-state.db

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Tests files and dir
.pytest_cache/
.coverage
.tox
.venv
reports/
**/report/
htmlcov/
.mypy_cache

# Log files
*.log

# IDEs
.idea/
.vscode/

# vi
.*.swp

# version data
repo-info
version

# Python builds
deb_dist/
dist/
*.egg-info/

# Snaps
*.snap

# Builds
.build/
build/
*.charm
90 changes: 90 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
[tool.flake8]
ignore = ["C901", "D100", "D101", "D102", "D103", "W503", "W504"]
exclude = ['.eggs', '.git', '.tox', '.venv', '.build', 'build', 'report', 'docs']
max-line-length = 99
max-complexity = 10
extend-ignore = ["E203", "E704"]

[tool.black]
line-length = 99
exclude = '''
/(
| .eggs
| .git
| .tox
| .venv
| .build
| build
| report
| docs
)/
'''

[tool.isort]
profile = "black"
skip_glob = [
".eggs",
".git",
".tox",
".venv",
".build",
"build",
"report",
"docs"
]

[tool.pylint]
max-line-length = 99
load-plugins = "pylint.extensions.docparams"
ignore-paths = [
".eggs",
".git",
".tox",
".venv",
".build",
"build",
"report",
"tests",
"docs"
]
no-docstring-rgx = "__.*__"
default-docstring-type = "sphinx"
accept-no-param-doc = false
accept-no-raise-doc = false
accept-no-return-doc = false
accept-no-yields-doc = false
disable = [
"import-error",
"consider-using-f-string",
"missing-type-doc",
]

[tool.mypy]
warn_unused_ignores = true
warn_unused_configs = true
warn_unreachable = true
disallow_untyped_defs = false
ignore_missing_imports = true
exclude = [
".eggs",
".git",
".tox",
".venv",
".build",
"build",
"lib",
"report",
"tests",
"docs"
]

[tool.codespell]
skip = ".eggs,.tox,.git,.venv,venv,build,.build,lib,report,docs"
quiet-level = 3
check-filenames = true
ignore-words-list = "assertIn"

[tool.pytest.ini_options]
filterwarnings = [
"ignore::RuntimeWarning",
]
Loading

0 comments on commit 5f50b2c

Please sign in to comment.