Skip to content

Commit e965401

Browse files
committed
🚀 Add/improve GitHub Actions workflows
- Fix Python version compatibility (remove 3.7, consistent with project requirements) - Add comprehensive CI pipeline with testing, linting, and security checks - Add automated PyPI publishing with trusted publishing - Update dependencies and configurations for consistency - Improve caching and use latest action versions
1 parent 691ec02 commit e965401

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

‎.github/workflows/ci.yml‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
14+
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
1515

1616
steps:
1717
- uses: actions/checkout@v4
@@ -22,10 +22,10 @@ jobs:
2222
python-version: ${{ matrix.python-version }}
2323

2424
- name: Cache pip dependencies
25-
uses: actions/cache@v3
25+
uses: actions/cache@v4
2626
with:
2727
path: ~/.cache/pip
28-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
28+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt', '**/pyproject.toml') }}
2929
restore-keys: |
3030
${{ runner.os }}-pip-
3131
@@ -56,7 +56,7 @@ jobs:
5656
pytest --cov=pyhetznerserver --cov-report=xml --cov-report=term-missing
5757
5858
- name: Upload coverage to Codecov
59-
uses: codecov/codecov-action@v3
59+
uses: codecov/codecov-action@v4
6060
with:
6161
file: ./coverage.xml
6262
flags: unittests
@@ -80,11 +80,11 @@ jobs:
8080
8181
- name: Run Bandit security linter
8282
run: |
83-
bandit -r pyhetznerserver/ -f json -o bandit-report.json || true
83+
bandit -r pyhetznerserver/ -ll
8484
8585
- name: Run Safety check
8686
run: |
87-
safety check --json --output safety-report.json || true
87+
safety check
8888
8989
build:
9090
runs-on: ubuntu-latest
@@ -111,7 +111,7 @@ jobs:
111111
twine check dist/*
112112
113113
- name: Upload build artifacts
114-
uses: actions/upload-artifact@v3
114+
uses: actions/upload-artifact@v4
115115
with:
116116
name: dist
117117
path: dist/

‎.github/workflows/publish.yml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,15 @@ jobs:
4949
- name: Install build dependencies
5050
run: |
5151
python -m pip install --upgrade pip
52-
pip install build
52+
pip install build twine
5353
5454
- name: Build package
5555
run: |
5656
python -m build
5757
58+
- name: Check package
59+
run: |
60+
twine check dist/*
61+
5862
- name: Publish to PyPI (Trusted Publishing)
59-
if: github.event_name == 'release' && github.event.action == 'published' || github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
6063
uses: pypa/gh-action-pypi-publish@release/v1

‎pyproject.toml‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ classifiers = [
4444
]
4545
requires-python = ">=3.8"
4646
dependencies = [
47-
"requests>=2.28.0",
48-
"typing-extensions>=4.0.0; python_version<'3.8'"
47+
"requests>=2.28.0"
4948
]
5049

5150
[project.optional-dependencies]
@@ -82,7 +81,7 @@ exclude = ["tests*"]
8281

8382
[tool.black]
8483
line-length = 100
85-
target-version = ['py37', 'py38', 'py39', 'py310', 'py311']
84+
target-version = ['py38', 'py39', 'py310', 'py311', 'py312']
8685
include = '\.pyi?$'
8786
extend-exclude = '''
8887
/(
@@ -108,7 +107,7 @@ use_parentheses = true
108107
ensure_newline_before_comments = true
109108

110109
[tool.mypy]
111-
python_version = "3.7"
110+
python_version = "3.8"
112111
warn_return_any = true
113112
warn_unused_configs = true
114113
disallow_untyped_defs = true

‎requirements.txt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
requests>=2.28.0
2-
typing-extensions>=4.0.0
1+
requests>=2.28.0

0 commit comments

Comments
 (0)