Skip to content

Commit d3376ec

Browse files
committed
CI: added ci workflows and relevant files
Added workflows to run tests, upload coverage reports, and create tags. Also added workflows to upload package to PyPI after successful tests.
1 parent b113cb1 commit d3376ec

File tree

3 files changed

+404
-0
lines changed

3 files changed

+404
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build and Publish to PyPI, and Create Github Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+' # Trigger only on semantic version tags like v0.1.0
7+
8+
jobs:
9+
build:
10+
name: Build Python Package
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.10'
21+
22+
- name: Install build tools
23+
run: python -m pip install --upgrade pip build
24+
25+
- name: Build package
26+
run: python -m build
27+
28+
- name: Upload build artifacts
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: python-dist
32+
path: dist/
33+
34+
publish:
35+
name: Publish to PyPI
36+
needs: build
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- name: Download build artifacts
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: python-dist
44+
path: dist/
45+
46+
- name: Publish to PyPI
47+
uses: pypa/[email protected]
48+
with:
49+
password: ${{ secrets.PYPI_API_TOKEN }}
50+
51+
release:
52+
name: Create GitHub Release
53+
needs: publish
54+
runs-on: ubuntu-latest
55+
56+
steps:
57+
- name: Create GitHub Release
58+
uses: softprops/action-gh-release@v1
59+
with:
60+
tag_name: ${{ github.ref_name }}
61+
generate_release_notes: true
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)