-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Actions workflow for automated PyPI deployment (#42)
* Add missing dependency for Python 3.6 * Factor out package version to separate file * Add workflow for publishing to PyPI on new release
- Loading branch information
Showing
4 changed files
with
110 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Build, test and publish Python Package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
env: | ||
runner-os: ubuntu-latest | ||
|
||
jobs: | ||
build-package: | ||
runs-on: ${{ env.runner-os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Check git tag against package version and get python version | ||
run: | | ||
./check_package_version.sh | ||
echo "::set-output name=VERSION::$(<.python-version)" | ||
id: python-version | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ steps.python-version.outputs.VERSION }} | ||
|
||
- name: Install dependencies and build package | ||
run: | | ||
pip install pipenv wheel | ||
pipenv sync --system | ||
./build.sh | ||
- name: Cache build | ||
uses: actions/cache@v2 | ||
with: | ||
path: ./dist | ||
key: build-cache | ||
|
||
test-package: | ||
needs: build-package | ||
runs-on: ${{ env.runner-os }} | ||
strategy: | ||
matrix: | ||
python-version: ["3.6", "3.7", "3.8", "3.9"] | ||
fail-fast: true | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Recover cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ./dist | ||
key: build-cache | ||
|
||
- name: Install SDK from cache | ||
run: | | ||
PACKAGE=$(ls ./dist/ | grep -P .+\.whl$) | ||
pip install ./dist/$PACKAGE | ||
- name: Run unit tests | ||
run: | | ||
mkdir -p tests/exabel_data_sdk | ||
cp -r ./exabel_data_sdk/tests ./tests/exabel_data_sdk/ | ||
cd ./tests/ | ||
python -m unittest discover -s ./exabel_data_sdk/tests | ||
publish-package-to-pypi: | ||
needs: test-package | ||
runs-on: ${{ env.runner-os }} | ||
|
||
steps: | ||
- name: Recover cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ./dist | ||
key: build-cache | ||
|
||
- name: Publish package to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.0.23 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
VERSION="v$(<VERSION)" | ||
GIT_TAG=$(git describe --tags) | ||
|
||
echo "Verifying current git tag is the same as version set in VERSION" | ||
if [ $VERSION != $GIT_TAG ]; then | ||
echo "Current git tag does not match version set in VERSION. Aborting build ..." | ||
echo "GIT_TAG: $GIT_TAG" | ||
echo "VERSION: $VERSION" | ||
exit 1; | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,12 @@ | |
with open("README.md", "r", encoding="utf-8") as fh: | ||
long_description = fh.read() | ||
|
||
with open("VERSION", "r", encoding="utf-8") as fh: | ||
version = fh.read() | ||
|
||
setuptools.setup( | ||
name="exabel-data-sdk", | ||
version="0.0.22", | ||
version=version, | ||
author="Exabel", | ||
author_email="[email protected]", | ||
description="Python SDK for the Exabel Data API", | ||
|
@@ -14,7 +17,13 @@ | |
long_description_content_type="text/markdown", | ||
url="https://github.com/Exabel/python-sdk", | ||
packages=setuptools.find_packages(), | ||
install_requires=["grpcio", "pandas", "protobuf", "requests"], | ||
install_requires=[ | ||
'dataclasses == 0.8; python_version <= "3.6"', | ||
"grpcio", | ||
"pandas", | ||
"protobuf", | ||
"requests", | ||
], | ||
python_requires=">=3.6", | ||
classifiers=[ | ||
"Development Status :: 4 - Beta", | ||
|