Skip to content

Commit cdf41dd

Browse files
committed
👷 Add CI/CD workflow
Add GitHub Actions workflow for continuous integration and delivery This commit introduces a new CI/CD pipeline using GitHub Actions: - Add .github/workflows/ci-cd.yml file - Configure automated testing and deployment processes - Ensure code quality and consistency across the project This workflow will help maintain project integrity and streamline the development process.
1 parent 9da2f28 commit cdf41dd

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

‎.github/workflows/ci-cd.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags:
7+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
8+
pull_request:
9+
branches: [ main ]
10+
11+
jobs:
12+
build-and-test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.12'
20+
- name: Install dependencies
21+
run: |
22+
pip install poetry
23+
poetry install
24+
- name: Run tests
25+
run: poetry run pytest
26+
- name: Upload test results
27+
uses: actions/upload-artifact@v3
28+
with:
29+
name: test-results
30+
path: test-results
31+
32+
create-release:
33+
needs: [build-and-test]
34+
runs-on: ubuntu-latest
35+
if: startsWith(github.ref, 'refs/tags/')
36+
steps:
37+
- uses: actions/checkout@v3
38+
- name: Create Release
39+
id: create_release
40+
uses: actions/create-release@v1
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
with:
44+
tag_name: ${{ github.ref }}
45+
release_name: Release ${{ github.ref }}
46+
draft: false
47+
prerelease: false
48+
49+
release:
50+
needs: create-release
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v3
54+
- name: Set up Python
55+
uses: actions/setup-python@v4
56+
with:
57+
python-version: '3.12'
58+
- name: Install dependencies
59+
run: |
60+
pip install poetry
61+
poetry install
62+
- name: Build package
63+
run: poetry build
64+
- name: Publish to PyPI
65+
env:
66+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
67+
run: |
68+
poetry config pypi-token.pypi $PYPI_TOKEN
69+
poetry publish

0 commit comments

Comments
 (0)