Skip to content

Commit dd2410b

Browse files
committed
Merge feature/add-cicd-workflow into master
2 parents fe13e5d + e120e25 commit dd2410b

File tree

4 files changed

+134
-5
lines changed

4 files changed

+134
-5
lines changed

.github/workflows/ci.yaml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
tags: '*.*.*'
6+
release:
7+
types: [ published ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version:
15+
- '3.8'
16+
- '3.9'
17+
- '3.10'
18+
- '3.11'
19+
- '3.12'
20+
- '3.13'
21+
- '3.14'
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
python -m pip install pytest pytest-cov
35+
# pip install -e ".[test]"
36+
37+
- name: Run tests
38+
run: |
39+
# python -m pytest tests/ --cov=lib --cov-report=xml
40+
export PYTHONPATH="$(pwd -P)/lib:$PYTHONPATH"
41+
python -m pytest tests/ --cov=lib --cov-report=term
42+
43+
# - name: Upload coverage to Codecov
44+
# uses: codecov/codecov-action@v3
45+
# if: matrix.python-version == '3.10'
46+
# with:
47+
# file: ./coverage.xml
48+
# fail_ci_if_error: true
49+
50+
security:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v3
54+
55+
- name: Set up Python
56+
uses: actions/setup-python@v4
57+
with:
58+
python-version: '3.10'
59+
60+
- name: Install safety
61+
run: pip install safety
62+
63+
- name: Check dependencies for vulnerabilities
64+
run: safety check --full-report
65+
66+
- name: Install bandit
67+
run: pip install bandit
68+
69+
- name: Static security analysis
70+
run: bandit -r lib/ -f json -o bandit-report.json --skip B101
71+
72+
type-check:
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v3
76+
77+
- name: Set up Python
78+
uses: actions/setup-python@v4
79+
with:
80+
python-version: '3.10'
81+
82+
- name: Install mypy
83+
run: pip install mypy
84+
85+
- name: Type checking
86+
run: |
87+
export PYTHONPATH="$(pwd -P)/lib:$PYTHONPATH"
88+
mypy lib/ --disable-error-code import-untyped
89+
90+
build:
91+
needs: [test, security, type-check]
92+
runs-on: ubuntu-latest
93+
94+
steps:
95+
- uses: actions/checkout@v3
96+
97+
- name: Set up Python
98+
uses: actions/setup-python@v4
99+
with:
100+
python-version: '3.10'
101+
102+
- name: Install build dependencies
103+
run: pip install build wheel
104+
105+
- name: Build wheel package
106+
run: python -m build --wheel
107+
108+
- name: List artifacts
109+
run: ls -la dist/
110+
111+
- name: Upload wheel to GitHub Releases
112+
uses: svenstaro/upload-release-action@v2
113+
with:
114+
repo_token: ${{ secrets.GITHUB_TOKEN }}
115+
file: dist/*.whl
116+
tag: ${{ github.ref }}
117+
overwrite: true
118+
file_glob: true

changelog.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## Unreleased
9+
### Added
910

1011
- [ ] feature: implement r/w stream edit using reading by chunks instead of by lines
1112
- [ ] enhancement: change dictionary format: better compress
1213
- [ ] feature: extend dictionary: add more words, handle separately lower/upper-cased specific words
1314
- [ ] feature: add lint option
1415
- [ ] feature: add replacement stats
1516

17+
## [0.1.2] — 2025-12-28
18+
### Added
19+
20+
- [x] feature: setup github CI/CD workflow configuration
21+
22+
### Fixed
23+
24+
- [x] fix: `mypy` & `bandit` warnings
25+
1626
## [0.1.1] — 2025-03-02
1727
### Fixed
1828

@@ -76,5 +86,6 @@ Initial release
7686

7787
</details>
7888

79-
[0.1.1]: https://github.com/md-py/md.language.yofication/releases/tag/0.1.1
89+
[0.2.0]: https://github.com/md-py/md.language.yofication/releases/compare/0.1.1...0.1.2
90+
[0.1.1]: https://github.com/md-py/md.language.yofication/releases/compare/0.1.0...0.1.1
8091
[0.1.0]: https://github.com/md-py/md.language.yofication/releases/tag/0.1.0

lib/md/language/yofication/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def main(arguments: typing.Sequence[str]) -> int:
110110

111111
if not parsed_arguments.replace:
112112
# todo consider to separate to `--interactive/-i` and `-`$
113-
application = ApplicationEchoLines(yoficate=yoficate)
113+
application: ApplicationEchoLines = ApplicationEchoLines(yoficate=yoficate)
114114
if file_path_count == 0:
115115
application.run(input_stream=sys.stdin)
116116
return 0
@@ -121,8 +121,8 @@ def main(arguments: typing.Sequence[str]) -> int:
121121
return 0
122122

123123
assert parsed_arguments.replace and file_path_count >= 1
124-
application = ApplicationReplaceLines(yoficate=yoficate)
125-
application.run(file_path_list=parsed_arguments.file_path)
124+
application: ApplicationReplaceLines = ApplicationReplaceLines(yoficate=yoficate) # type: ignore[no-redef]
125+
application.run(file_path_list=parsed_arguments.file_path) # type: ignore[call-arg]
126126
return 0
127127

128128

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
long_description = fh.read()
77

88

9-
def create_zip():
9+
def create_zip() -> None:
1010
with open('lib/md/language/yofication/_data/dictionary.ru_RU.txt', 'rb') as source:
1111
with bz2.BZ2File('lib/md/language/yofication/_data/dictionary.ru_RU.txt.bz2', 'w') as stream:
1212
stream.write(source.read())

0 commit comments

Comments
 (0)