Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add action for release #1

Merged
merged 9 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Bug
description: Let us know about an unexpected error, a crash, or an incorrect behavior.
labels:
- 'bug'
body:
- type: textarea
id: problem
attributes:
label: Problem
validations:
required: true


1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Feature
description: Suggest a new feature.
labels:
- 'enhancement'
body:
- type: textarea
id: use-cases
attributes:
label: Use Cases
validations:
required: true

- type: textarea
id: attempted-solutions
attributes:
label: Attempted Solutions
validations:
required: false
137 changes: 137 additions & 0 deletions .github/workflows/seqslab_connector_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: seqslab connector release
on:
workflow_dispatch:
inputs:
User:
description: 'Pypi User'
required: true
default: '__token__'
Password:
description: 'Pypi Password'
required: true
default: ''

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. You do not need default.
  2. Pypi Password -> Pypi Password

jobs:
test-tags:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Get versioning information
id: versions
run: |
CURRENT_TAG=${GITHUB_REF#refs/tags/}
CURRENT_VERSION=$(cat seqslab/__init__.py | grep "__version__"| awk '{print $3}' | sed 's/^"//'| sed 's/"$//' )

# set output
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_OUTPUT

- name: Print versioning information
run: |
echo "Print CURRENT_VERSION"
echo ${{ steps.versions.outputs.CURRENT_VERSION }}

- uses: mukunku/tag-exists-action@v1.2.0
id: checkTag
with:
tag: "${{ steps.versions.outputs.CURRENT_VERSION }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Verify tag is documented
run: |
if ${{ steps.checkTag.outputs.exists }}; then
echo "========================================================================"
echo "Error: ${{ steps.versions.outputs.CURRENT_VERSION }} exists";
echo "========================================================================"
exit 1;
else
echo "${{ steps.versions.outputs.CURRENT_VERSION }} does not exist"
fi


deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Get Current Timestamp
if: success()
id: date
run: echo "NOW=$(date +'%Y-%m-%d-%H-%M')">> $GITHUB_OUTPUT

- name: Get versioning information
id: versions
run: |
CURRENT_TAG=${GITHUB_REF#refs/tags/}
CURRENT_VERSION=$(cat seqslab/__init__.py | grep "__version__"| awk '{print $3}' | sed 's/^"//'| sed 's/"$//' )

# set output
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_OUTPUT

- name: Print versioning information
run: |
# set output
echo "Print Datetime"
echo ${{ steps.date.outputs.NOW }}
echo "Print CURRENT_VERSION"
echo ${{ steps.versions.outputs.CURRENT_VERSION }}

# Publish Release
- name: Create Seqslab Connector Release
if: (github.ref == 'refs/heads/main') && success()
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ steps.versions.outputs.CURRENT_VERSION }}
release_name: ${{ steps.versions.outputs.CURRENT_VERSION }}
body: |
TimeStamp
- timestamp = ${{ steps.date.outputs.NOW }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install wheel twine

- name: Build dist
run: python setup.py sdist bdist_wheel --python-tag py3

- name: Archive dist
uses: actions/upload-artifact@v3
with:
name: dist
path: |
dist/*.tar.gz
dist/*.whl

- name: Verify long description rendering
run: twine check dist/*

- name: Publish distribution 📦 to PyPI
id: deploy
env:
PYPI_API_USER: ${{ github.event.inputs.User }}
PYPI_API_TOKEN: ${{ github.event.inputs.Password }}
run: |
twine upload --non-interactive -u "${PYPI_API_USER}" -p "${PYPI_API_TOKEN}" dist/*

# delete release if deploy fail
- uses: dev-drprasad/delete-tag-and-release@v1.0 # PRERELEASE is v1.0 and can also be used to test and give us feedback
if: steps.deploy.outputs.exit_code != 0
with:
tag_name: ${{ steps.versions.outputs.CURRENT_VERSION }} #(required) tag name to delete
github_token: ${{ secrets.GITHUB_TOKEN }} # (required) a GitHub token with write access to the repo that needs to be modified
delete_release: true
11 changes: 11 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[bdist_wheel]
universal = 1
[flake8]
max-line-length = 119
# Ignore some well known paths
exclude = .venv,.tox,dist,doc,build,*.egg,db/env.py,db/versions/*.py,site
[metadata]
license_file = LICENSE
project_urls =
Documentation = https://docs.atgenomix.com/
Repository = https://github.com/atgenomix/seqslab-connector
44 changes: 37 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,43 @@
#!/usr/bin/env python3

import os
from typing import Union, Any

from setuptools import setup

import seqslab

setup_file_loc: Union[Union[str, bytes], Any] = os.path.abspath(
os.path.dirname(__file__))
# allow setup.py to be run from any path
os.chdir(setup_file_loc)

extras_require = {
}


def get_requirement():
requirements = [ # dependency list
'pip>=22.0.4'
]
with open(os.path.join(setup_file_loc, 'requirements.txt'), 'r') as f:
ori_req = f.read().splitlines()
requirements.extend(ori_req)
return requirements


def readme():
path = os.path.join(setup_file_loc, 'README.md')
with open(path, "r", encoding="utf-8") as fh:
return fh.read()

with open('README.md') as readme:
long_description = readme.read()

setup(
name="seqslab-connector",
version=seqslab.__version__,
description="Atgenomix SeqsLab Connector for Python",
long_description=long_description,
long_description=readme(),
long_description_content_type="text/markdown",
url="https://github.com/atgenomix/seqslab-connector",
author="Allen Chang",
author_email="allen.chang@atgenomix.com",
Expand All @@ -22,11 +48,15 @@
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Topic :: Database :: Front-Ends",
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
],
install_requires=[
"pyhive",
"thrift",
],
data_files=[('requirements', ['requirements.txt'])],
install_requires=get_requirement(),
extras_require={
"sqlalchemy": ["sqlalchemy>=1.3.0"],
"superset": ["superset>=2.0.1"],
Expand Down