Skip to content

Commit a2040af

Browse files
Murat Kaan MeralContainerized Agent
authored andcommitted
ci: add comprehensive GitHub Actions CI/CD pipeline
- Add test-lint.yml workflow for unit tests and linting - Test matrix: Python 3.10-3.13 on Linux, Windows, macOS - Comprehensive linting with ruff - Add pr-and-push.yml for automated PR and main branch checks - Concurrency control to prevent duplicate runs - Automatic test and lint on PR events - Add pypi-publish-on-release.yml for automated PyPI deployment - Uses PyPI Trusted Publisher for secure release - Validates version format before publishing - Add PULL_REQUEST_TEMPLATE.md for standardized PR submissions - Update dependabot.yml with pip and GitHub Actions monitoring
1 parent b59b9a4 commit a2040af

File tree

5 files changed

+140
-42
lines changed

5 files changed

+140
-42
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Description
2+
3+
<!-- Provide a detailed description of the changes in this PR -->
4+
5+
## Related Issues
6+
7+
<!-- Link to related issues using #issue-number format -->
8+
9+
## Type of Change
10+
11+
<!-- Choose one of the following types of changes, delete the rest -->
12+
13+
Bug fix
14+
New Feature
15+
Breaking change
16+
Documentation update
17+
Other (please describe):
18+
19+
## Testing
20+
21+
How have you tested the change?
22+
23+
- [ ] I ran `hatch run prepare`
24+
- [ ] All tests pass locally
25+
26+
## Checklist
27+
- [ ] I have read the CONTRIBUTING document
28+
- [ ] I have added any necessary tests that prove my fix is effective or my feature works
29+
- [ ] I have updated the documentation accordingly
30+
- [ ] My changes generate no new warnings
31+
- [ ] Any dependent changes have been merged and published
32+
33+
----
34+
35+
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

.github/dependabot.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ updates:
77
open-pull-requests-limit: 100
88
commit-message:
99
prefix: ci
10+
groups:
11+
dev-dependencies:
12+
patterns:
13+
- "pytest"
1014
- package-ecosystem: "github-actions"
1115
directory: "/"
1216
schedule:
1317
interval: "daily"
1418
open-pull-requests-limit: 100
1519
commit-message:
16-
prefix: ci
20+
prefix: ci

.github/workflows/pr-and-push.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Pull Request and Push Action
33
on:
44
pull_request: # Safer than pull_request_target for untrusted code
55
branches: [ main ]
6-
types: [opened, synchronize, reopened, ready_for_review, review_requested, review_request_removed]
6+
types: [opened, synchronize, reopened, ready_for_review]
77
push:
88
branches: [ main ] # Also run on direct pushes to main
99
concurrency:
@@ -16,4 +16,4 @@ jobs:
1616
permissions:
1717
contents: read
1818
with:
19-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
19+
ref: ${{ github.event.pull_request.head.sha || github.sha }}

.github/workflows/pypi-publish-on-release.yml

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -22,37 +22,37 @@ jobs:
2222
runs-on: ubuntu-latest
2323

2424
steps:
25-
- uses: actions/checkout@v4
26-
with:
27-
persist-credentials: false
25+
- uses: actions/checkout@v4
26+
with:
27+
persist-credentials: false
2828

29-
- name: Set up Python
30-
uses: actions/setup-python@v5
31-
with:
32-
python-version: '3.10'
29+
- name: Set up Python
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: '3.10'
3333

34-
- name: Install dependencies
35-
run: |
36-
python -m pip install --upgrade pip
37-
pip install hatch twine
38-
- name: Validate version
39-
run: |
40-
version=$(hatch version)
41-
if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
42-
echo "Valid version format"
43-
exit 0
44-
else
45-
echo "Invalid version format"
46-
exit 1
47-
fi
48-
- name: Build
49-
run: |
50-
hatch build
51-
- name: Store the distribution packages
52-
uses: actions/upload-artifact@v4
53-
with:
54-
name: python-package-distributions
55-
path: dist/
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install hatch twine
38+
- name: Validate version
39+
run: |
40+
version=$(hatch version)
41+
if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
42+
echo "Valid version format"
43+
exit 0
44+
else
45+
echo "Invalid version format"
46+
exit 1
47+
fi
48+
- name: Build
49+
run: |
50+
hatch build
51+
- name: Store the distribution packages
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: python-package-distributions
55+
path: dist/
5656

5757
deploy:
5858
name: Upload release to PyPI
@@ -70,10 +70,10 @@ jobs:
7070
id-token: write
7171

7272
steps:
73-
- name: Download all the dists
74-
uses: actions/download-artifact@v4
75-
with:
76-
name: python-package-distributions
77-
path: dist/
78-
- name: Publish distribution 📦 to PyPI
79-
uses: pypa/gh-action-pypi-publish@release/v1
73+
- name: Download all the dists
74+
uses: actions/download-artifact@v4
75+
with:
76+
name: python-package-distributions
77+
path: dist/
78+
- name: Publish distribution 📦 to PyPI
79+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test-lint.yml

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Lint
1+
name: Test and Lint
22

33
on:
44
workflow_call:
@@ -8,6 +8,65 @@ on:
88
type: string
99

1010
jobs:
11+
unit-test:
12+
name: Unit Tests - Python ${{ matrix.python-version }} - ${{ matrix.os-name }}
13+
permissions:
14+
contents: read
15+
strategy:
16+
matrix:
17+
include:
18+
# Linux
19+
- os: ubuntu-latest
20+
os-name: 'linux'
21+
python-version: "3.10"
22+
- os: ubuntu-latest
23+
os-name: 'linux'
24+
python-version: "3.11"
25+
- os: ubuntu-latest
26+
os-name: 'linux'
27+
python-version: "3.12"
28+
- os: ubuntu-latest
29+
os-name: 'linux'
30+
python-version: "3.13"
31+
# Windows
32+
- os: windows-latest
33+
os-name: 'windows'
34+
python-version: "3.10"
35+
- os: windows-latest
36+
os-name: 'windows'
37+
python-version: "3.11"
38+
- os: windows-latest
39+
os-name: 'windows'
40+
python-version: "3.12"
41+
- os: windows-latest
42+
os-name: 'windows'
43+
python-version: "3.13"
44+
# MacOS - latest only; not enough runners for macOS
45+
- os: macos-latest
46+
os-name: 'macOS'
47+
python-version: "3.13"
48+
fail-fast: true
49+
runs-on: ${{ matrix.os }}
50+
env:
51+
LOG_LEVEL: DEBUG
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v4
55+
with:
56+
ref: ${{ inputs.ref }} # Explicitly define which commit to check out
57+
persist-credentials: false # Don't persist credentials for subsequent actions
58+
- name: Set up Python
59+
uses: actions/setup-python@v5
60+
with:
61+
python-version: ${{ matrix.python-version }}
62+
- name: Install dependencies
63+
run: |
64+
pip install --no-cache-dir hatch
65+
- name: Run Unit tests
66+
id: tests
67+
run: hatch test tests --cover
68+
continue-on-error: false
69+
1170
lint:
1271
name: Lint
1372
runs-on: ubuntu-latest
@@ -32,5 +91,5 @@ jobs:
3291
3392
- name: Run lint
3493
id: lint
35-
run: hatch run lint
36-
continue-on-error: false
94+
run: hatch run test-lint
95+
continue-on-error: false

0 commit comments

Comments
 (0)