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

Refactor tests for poetry #42

Merged
merged 23 commits into from
May 14, 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
12 changes: 6 additions & 6 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ codecov:
coverage:
precision: 2
status:
patch: off
patch: false
project:
default:
target: 100%

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no
conditional: true
loop: true
method: false
macro: false

ignore:
- "tests"
- "^tests.*"
3 changes: 0 additions & 3 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
source = pyefergy

omit =
# omit setup
setup.py

# omit tests
tests/*

Expand Down
83 changes: 0 additions & 83 deletions .github/workflows/actions.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI
on:
push:
branches:
- master
- dev
pull_request: ~
env:
DEFAULT_PYTHON: "3.12"
jobs:
ci:
name: CI
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout the repository
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Install poetry
run: pip install poetry==1.8.2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/[email protected]
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"
- name: Install dependencies
run: poetry install
- name: 🧹 Lint files with pylint
run: poetry run pylint pyefergy
- name: 🖤 Format with black
run: poetry run black . --check
- name: Check with ruff
run: poetry run ruff check
- name: 🔍 Inspect with mypy
run: poetry run mypy pyefergy
- name: Test with pytest
run: |
poetry export --with dev --format requirements.txt --output requirements.txt
pip install -r requirements.txt
coverage run -m pytest
- name: Upload Coverage to Codecov
if: ${{ failure() != true }}
uses: codecov/[email protected]
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
23 changes: 23 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# An action to build and publish python package to https://pypi.org/ using poetry https://github.com/sdispater/poetry
# For more information see: https://github.com/marketplace/actions/publish-python-poetry-package

name: Publish python package

on:
push:
tags:
- "*.*.*"

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
plugins: "poetry-dynamic-versioning[plugin]"
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Robert Hillis
Copyright (c) 2021-2024 Robert Hillis

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

25 changes: 0 additions & 25 deletions Makefile

This file was deleted.

16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# pyefergy

[![codecov](https://codecov.io/gh/tkdrob/pyefergy/branch/master/graph/badge.svg)](https://codecov.io/gh/tkdrob/pyefergy)
![python version](https://img.shields.io/badge/Python-3.8=><=3.10-blue.svg)
![python version](https://img.shields.io/badge/Python-3.8=><=3.12-blue.svg)
[![PyPI](https://img.shields.io/pypi/v/pyefergy)](https://pypi.org/project/pyefergy)
![Actions](https://github.com/tkdrob/pyefergy/workflows/Actions/badge.svg?branch=master)

Expand Down Expand Up @@ -41,9 +41,11 @@ asyncio.get_event_loop().run_until_complete(async_example())

1. Fork the repository
2. Clone the repository locally and open the devcontainer or use GitHub codespaces
3. Do your changes
4. Lint the files with `make lint`
5. Ensure all tests passes with `make test`
6. Ensure 100% coverage with `make coverage`
7. Commit your work, and push it to GitHub
8. Create a PR against the `master` branch
3. Install poetry
4. Install dependencies: `poetry install`
5. Do your changes
6. Lint the files with `poetry run pylint pyefergy && black . && ruff check && mypy pyefergy`
7. Ensure all tests pass with `poetry run pytest`
8. Ensure 100% coverage
9. Commit your work, and push it to GitHub
10. Create a PR against the `master` branch
1 change: 1 addition & 0 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example usage of pyefergy."""

import asyncio

from pyefergy import Efergy
Expand Down
Loading