Skip to content

Commit

Permalink
feat: add setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jjjermiah committed Dec 16, 2023
1 parent 69a2860 commit 09c4ffc
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 131 deletions.
230 changes: 99 additions & 131 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,150 +8,118 @@ on:
branches: [ main ]

jobs:
Continuous-Integration:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.12"]
# Continuous-Integration:
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-latest, macos-latest]
# python-version: ["3.12"]

steps:
- uses: actions/checkout@v3
# steps:
# - uses: actions/checkout@v3

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

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

- name: Install package
run: poetry install
# - name: Install package
# run: poetry install

- name: Test with pytest
run: poetry run pytest
# - name: Test with pytest
# run: poetry run pytest

- name: Use Codecov to track coverage
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
# - name: Use Codecov to track coverage
# uses: codecov/codecov-action@v2
# with:
# file: ./coverage.xml

- name: Build documentation
run: poetry run make html --directory docs/
# - name: Build documentation
# run: poetry run make html --directory docs/

release:
# needs: Continuous-Integration
deploy:
if: github.ref == 'refs/heads/main' # github.event_name == 'push' &&

# Set up operating system
runs-on: ubuntu-latest

outputs:
version: ${{ steps.release.outputs.version }}
changelog: ${{ steps.release.outputs.changelog }}
tag: ${{ steps.release.outputs.tag }}
# Define job steps
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: 3.12

- 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

# This action uses Python Semantic Release v8
- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@v8.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}


- 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 \
pycounts
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
fetch-depth: 0

- uses: actions/setup-python@v2
with:
python-version: 3.12

- name: Install via poetry
run: |
pip install poetry
poetry config virtualenvs.in-project true
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

- name: Release
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
poetry version $(git describe --tags --abbrev=0)
poetry build
poetry publish --build -u __token__ -p ${{ secrets.TEST_PYPI_API_TOKEN }}

# # needs: Continuous-Integration

# if: github.ref == 'refs/heads/main' # github.event_name == 'push' &&

# # Set up operating system
# runs-on: ubuntu-latest
- name: Publish package
uses: pypa/gh-action-pypi-publish@27a0a2a
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
repository_url: https://upload.pypi.org/legacy/
build_dir: ./dist

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

# - 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

# # This action uses Python Semantic Release v8
# - name: Python Semantic Release
# id: release
# uses: python-semantic-release/python-semantic-release@v8.0.0
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}


# - 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 \
# pycounts

# - name: Publish to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}

# - name: Publish to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}


# - name: Publish package
# uses: pypa/gh-action-pypi-publish@27a0a2a
# with:
# user: __token__
# password: ${{ secrets.PYPI_TOKEN }}
# repository_url: https://upload.pypi.org/legacy/
# build_dir: ./dist

# - name: Publish documentation
# uses: maxheld83/ghpages@v0.2.1
# with:
# build_dir: docs/_build/html
# target_branch: gh-pages
# committer_name: "GitHub Actions"
# committer_email: "jermiahjoseph98@gmail.com"
- name: Publish documentation
uses: maxheld83/ghpages@v0.2.1
with:
build_dir: docs/_build/html
target_branch: gh-pages
committer_name: "GitHub Actions"
committer_email: "jermiahjoseph98@gmail.com"
9 changes: 9 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from setuptools import setup

__version__ = "0.0.0"

setup(
name="nbiatoolkit",
version=__version__,
# And so on...
)

0 comments on commit 09c4ffc

Please sign in to comment.