forked from gaudenz/sireader
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,515 additions
and
1,531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!-- Please explain the changes you made --> | ||
|
||
<!-- | ||
Please, make sure: | ||
- you have read the contributing guidelines: | ||
https://github.com/sportorg/sportident/blob/master/CONTRIBUTING.md | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Bump version | ||
|
||
on: | ||
# push: | ||
# branches: [ master ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
fetch-depth: 0 | ||
|
||
- name: Create bump and changelog | ||
uses: commitizen-tools/commitizen-action@master | ||
with: | ||
push: true | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.8' | ||
|
||
- name: Install python dependencies | ||
run: make install-poetry install | ||
|
||
- name: Run linters | ||
run: make lint | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.version }} | ||
|
||
- name: Install python dependencies | ||
run: make install-poetry install | ||
|
||
- name: Run test | ||
run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Lint PR | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
main: | ||
name: Validate PR title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/action-semantic-pull-request@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Publish to PYPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
release: | ||
types: | ||
- created | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.8' | ||
|
||
- name: Install poetry | ||
run: make install-poetry | ||
|
||
- name: Publish package to pypi | ||
run: make publish | ||
env: | ||
pypi_username: ${{ secrets.PYPI_USERNAME }} | ||
pypi_password: ${{ secrets.PYPI_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Code of Conduct | ||
|
||
This project adheres to the Python Code of Conduct, which can be found [here](https://www.python.org/psf/conduct/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Contributing | ||
|
||
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change. | ||
|
||
Welcome! Happy to see you willing to make the project better. | ||
|
||
## Getting started | ||
|
||
### Install | ||
|
||
**Activate virtual environment** | ||
|
||
``` | ||
python -m venv .venv | ||
``` | ||
|
||
**Install poetry** | ||
|
||
``` | ||
make install-poetry | ||
# pip install poetry | ||
``` | ||
|
||
Don't forget to use last version of poetry! | ||
|
||
**Install dependencies** | ||
|
||
``` | ||
make install | ||
``` | ||
|
||
### Run tests | ||
|
||
``` | ||
make test | ||
``` | ||
|
||
### Formatting | ||
|
||
``` | ||
make format | ||
``` | ||
|
||
### Lint | ||
|
||
``` | ||
make lint | ||
``` | ||
|
||
## Release | ||
|
||
Automatically after merging with the master | ||
|
||
1. `make bump` | ||
2. `git push` and `git push --tags` | ||
|
||
## Commit Message Format | ||
|
||
This project adheres to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). | ||
A specification for adding human and machine readable meaning to commit messages. | ||
|
||
### Commit Message Header | ||
|
||
``` | ||
<type>(<scope>): <short summary> | ||
│ │ │ | ||
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end. | ||
│ │ | ||
│ └─⫸ Commit Scope | ||
│ | ||
└─⫸ Commit Type: feat|fix|build|ci|docs|perf|refactor|test|chore | ||
``` | ||
|
||
#### Type | ||
|
||
| type | name | description | | ||
|----------|--------------------------|--------------------------------------------------------------------------------------------------------| | ||
| feat | Features | A new feature | | ||
| fix | Bug Fixes | A bug fix | | ||
| docs | Documentation | Documentation only changes | | ||
| style | Styles | Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) | | ||
| refactor | Code Refactoring | A code change that neither fixes a bug nor adds a feature | | ||
| perf | Performance Improvements | A code change that improves performance | | ||
| test | Tests | Adding missing tests or correcting existing tests | | ||
| build | Builds | Changes that affect the build system or external dependencies (example scopes: mypy, pip, pytest) | | ||
| ci | Continuous Integrations | Changes to our CI configuration files and scripts (example scopes: Github Actions) | | ||
| chore | Chores | Other changes that don't modify src or test files | | ||
| revert | Reverts | Reverts a previous commit | |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,64 @@ | ||
PYTHONPATH = PYTHONPATH=./ | ||
TEST = $(PYTHONPATH) pytest --verbosity=2 --showlocals --log-level=DEBUG --strict $(arg) -k "$(k)" | ||
PYLINT_CODE = sportident.py test_sportident.py | ||
CODE = $(PYLINT_CODE) | ||
.DEFAULT_GOAL := help | ||
CODE = sportident.py test_sportident.py | ||
POETRY_RUN = poetry run | ||
TEST = $(POETRY_RUN) pytest $(args) | ||
|
||
.PHONY: test test-fast test-failed test-cov teamcity lint format check | ||
.PHONY: help | ||
help: ## Show help | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
test: | ||
$(TEST) --cov | ||
.PHONY: all | ||
all: format lint test ## Run formakt lint test | ||
|
||
test-fast: | ||
.PHONY: install-poetry | ||
install-poetry: ## Install poetry | ||
pip install poetry | ||
|
||
.PHONY: install | ||
install: ## Install dependencies | ||
poetry install | ||
|
||
.PHONY: install-docs | ||
install-docs: ## Install docs dependencies | ||
poetry install --only docs | ||
|
||
.PHONY: publish | ||
publish: ## Publish package | ||
@poetry publish --build --no-interaction --username=$(pypi_username) --password=$(pypi_password) | ||
|
||
.PHONY: test | ||
test: ## Test with coverage | ||
$(TEST) --cov=./ | ||
|
||
.PHONY: test-fast | ||
test-fast: ## Test until error | ||
$(TEST) --exitfirst | ||
|
||
test-failed: | ||
.PHONY: test-failed | ||
test-failed: ## Test failed | ||
$(TEST) --last-failed | ||
|
||
test-cov: | ||
.PHONY: test-report | ||
test-report: ## Report testing | ||
$(TEST) --cov --cov-report html | ||
$(POETRY_RUN) python -m webbrowser 'htmlcov/index.html' | ||
|
||
teamcity: export TEAMCITY_VERSION=1 | ||
teamcity: lint test | ||
.PHONY: lint | ||
lint: ## Check code | ||
$(POETRY_RUN) black --check $(CODE) | ||
$(POETRY_RUN) pytest --dead-fixtures --dup-fixtures | ||
# $(POETRY_RUN) mypy $(CODE) | ||
|
||
lint: | ||
flake8 --jobs 4 --statistics --show-source $(CODE) | ||
#pylint --jobs 4 --rcfile=setup.cfg $(PYLINT_CODE) | ||
black --target-version py37 --skip-string-normalization --check $(CODE) | ||
pytest --dead-fixtures --dup-fixtures | ||
safety check --bare --full-report | ||
.PHONY: format | ||
format: ## Formatting code | ||
$(POETRY_RUN) black $(CODE) | ||
|
||
format: | ||
autoflake --recursive --in-place --remove-all-unused-imports $(CODE) | ||
isort --apply --recursive $(CODE) | ||
black --target-version py37 --skip-string-normalization $(CODE) | ||
unify --in-place --recursive $(CODE) | ||
.PHONY: bump | ||
bump: ## Bump version (commit and tag) | ||
$(POETRY_RUN) cz bump | ||
|
||
check: format lint test | ||
.PHONY: clean | ||
clean: ## Clean | ||
rm -rf site || true | ||
rm -rf dist || true | ||
rm -rf htmlcov || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.