Skip to content

Commit

Permalink
Add Python Package CI/CD workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanjaypranav committed Feb 27, 2024
1 parent 85c09c4 commit 48c0831
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/python-package-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Python Package CI/CD

on:
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with Flake8
run: |
flake8 --exclude=__init__.py
- name: Test with pytest
run: |
pytest
deploy:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main'

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Build and upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry build
twine upload dist/*

0 comments on commit 48c0831

Please sign in to comment.