Skip to content

Commit

Permalink
feat: Test coverage and automate publish (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitdas13 authored Apr 27, 2023
1 parent b313033 commit 60df5f0
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: CI
on:
push:
branches:
- master
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
python -m build
python -m pip install --upgrade twine
python -m twine check dist/*
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
with:
name: dist
path: dist/
test:
name: Test Coverage
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install responses
pip install coverage
python ${{ github.workspace }}/setup.py install
- name: Run Tests
run: |
python -m coverage run -m unittest
python -m coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3

publish:
if: startsWith(github.ref, 'refs/tags/v')
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Set up Python 3
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Publish packages to PyPi
run: |
python -m pip install --upgrade twine
set -ex
export VERSION=$(python3 setup.py --version)
python -m twine upload --verbose dist/razorpay-$VERSION-py3-none-any.whl dist/razorpay-$VERSION.tar.gz
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}

0 comments on commit 60df5f0

Please sign in to comment.