Skip to content

Commit

Permalink
Merge pull request #41 from engenmt/ci-cd
Browse files Browse the repository at this point in the history
build: Add CI-CD
  • Loading branch information
engenmt authored Sep 5, 2022
2 parents 68b1710 + 5d908b5 commit 1fdcc98
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 2 deletions.
64 changes: 63 additions & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,66 @@ jobs:
- name: Test with pytest
run: poetry run pytest tests/
- name: Build documentation
run: poetry run make html --directory docs/
run: poetry run make html --directory docs/

cd:
# Only run this job if the "ci" job passes
needs: ci

# Only run this job if new work is pushed to the "master" branch
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
# Set up operating system
runs-on: ubuntu-latest

# Define job steps
steps:
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Check-out repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install poetry
uses: snok/install-poetry@v1

- name: Install package
run: poetry install

- name: Use Python Semantic Release to prepare release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
poetry run semantic-release publish
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: Test install from TestPyPI
run: |
pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
permpy
- name: Test install from TestPyPI
run: |
pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
pycounts
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ sphinx-autoapi = "^1.8.4"
sphinx-rtd-theme = "^1.0.0"

[tool.semantic_release]
version_variable = "pyproject.toml:version"
version_variable = "pyproject.toml:version" # version location
branch = "master" # branch to make releases of
changelog_file = "CHANGELOG.md" # changelog file
build_command = "poetry build" # build dists
dist_path = "dist/" # where to put dists
upload_to_release = true # auto-create GitHub release
upload_to_pypi = false # don't auto-upload to PyPI
remove_dist = false # don't remove dists
patch_without_tag = true # patch release by default

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down

0 comments on commit 1fdcc98

Please sign in to comment.