test import fixes #28
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Depolyment Pipeline | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
version_type: | |
description: 'Version type (major, minor, patch)' | |
required: true | |
default: 'patch' | |
release_notes: | |
description: 'Release notes' | |
required: false | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest pytest-cov | |
pip install . | |
- name: Run tests and generate coverage report | |
run: | | |
pytest --cov=grafx tests/ | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
bump-version-and-release: | |
if: github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install bump2version setuptools wheel twine build | |
- name: Configure Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "sh-lee" | |
- name: Bump version | |
id: bump_version | |
run: | | |
version_type=${{ github.event.inputs.version_type }} | |
bump2version $version_type | |
new_version=$(python setup.py --version) | |
echo "::set-output name=new_version::$new_version" | |
- name: Push changes | |
run: | | |
git push origin --tags | |
git push origin HEAD:main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.bump_version.outputs.new_version }} | |
release_name: v${{ steps.bump_version.outputs.new_version }} | |
body: ${{ github.event.inputs.release_notes || 'No release notes provided.' }} | |
draft: false | |
prerelease: false | |
- name: Publish to PyPI | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
python -m build | |
twine upload dist/* |