Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fbd5893

Browse files
committedNov 21, 2024·
ci: Add GitHub Actions workflow for build and test automation
1 parent 3ca04eb commit fbd5893

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed
 

‎.github/workflows/build.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
release:
9+
types: [created]
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.10"]
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install build pytest pytest-cov ruff
30+
pip install -e .
31+
32+
- name: Lint with ruff
33+
run: |
34+
ruff check .
35+
36+
- name: Build package
37+
run: python -m build
38+
39+
publish:
40+
needs: test
41+
runs-on: ubuntu-latest
42+
if: github.event_name == 'release' && github.event.action == 'created'
43+
44+
steps:
45+
- uses: actions/checkout@v3
46+
47+
- name: Set up Python
48+
uses: actions/setup-python@v4
49+
with:
50+
python-version: "3.10"
51+
52+
- name: Install dependencies
53+
run: |
54+
python -m pip install --upgrade pip
55+
pip install build twine
56+
57+
- name: Build and publish
58+
env:
59+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
60+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
61+
run: |
62+
python -m build
63+
python -m twine upload dist/*

0 commit comments

Comments
 (0)