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

chore: add initial testing setup #41

Merged
merged 4 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Pytest

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Export dependencies to requirements.txt
run: |
poetry export --without-hashes --format=requirements.txt > requirements.txt

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install .
pip install pytest pytest-cov

- name: Run Pytest
run: |
pytest --cov --junitxml=junit.xml -o junit_family=legacy

- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ venv
dist/
**/__pycache__
**/*.crt
.coverage
junit.xml
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ help: ## Print this help
run: ## Run the application with enabled debug mode
@poetry run kubeseal-auto --debug

.PHONY: test
test: ## Run the tests
@poetry run pytest

.PHONY: test-coverage
test-coverage: ## Run the tests with coverage
@poetry run pytest --cov --junitxml=junit.xml -o junit_family=legacy

.PHONY: build
build: ## Package the application using poetry
@poetry build
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

<b>kubeseal-auto</b> is an interactive wrapper for kubeseal binary used to encrypt secrets for [sealed-secrets](https://github.com/bitnami-labs/sealed-secrets).

![GitHub last commit (branch)](https://img.shields.io/github/last-commit/shini4i/kubeseal-auto/main?style=plastic)
![GitHub Actions](https://img.shields.io/github/actions/workflow/status/shini4i/kubeseal-auto/run-tests.yml?branch=main)
[![codecov](https://codecov.io/gh/shini4i/kubeseal-auto/graph/badge.svg?token=E61B6OYPFX)](https://codecov.io/gh/shini4i/kubeseal-auto)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/kubeseal-auto?style=plastic)
![PyPI](https://img.shields.io/pypi/v/kubeseal-auto?style=plastic)
![license](https://img.shields.io/github/license/shini4i/kubeseal-auto?style=plastic)
Expand Down
181 changes: 180 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ icecream = "^2.1.3"
questionary = "^2.0.1"
colorama = "^0.4.6"

[tool.poetry.dev-dependencies]
[tool.poetry.group.dev.dependencies]
pytest = "^8.3.3"
pytest-cov = "^5.0.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
Loading
Loading