Skip to content

Commit

Permalink
chore(pipelines): automatic releases and publishing (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
portellaa committed Jan 29, 2021
1 parent f7fed0d commit 5223ab1
Show file tree
Hide file tree
Showing 8 changed files with 242 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
48 changes: 48 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Merge into main branch

on:
push:
branches: [ master ]

jobs:
prepare:
name: Calculate Version
runs-on: ubuntu-20.04

outputs:
new_release: ${{ steps.semantic.outputs.new_release_published }}
release: ${{ steps.semantic.outputs.new_release_version }}
release_notes: ${{ steps.semantic.outputs.new_release_notes }}

steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.ACCESS_TOKEN }}

- uses: cycjimmy/semantic-release-action@v2
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
dry_run: true

prerelease:
if: needs.prepare.outputs.new_release == 'true'

name: Create Pre-Release
runs-on: ubuntu-20.04

needs: prepare

steps:
- uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
VERSION: ${{ needs.prepare.outputs.release }}
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
body: ${{ needs.prepare.outputs.release_notes }}
draft: false
prerelease: true

83 changes: 83 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: prerelease

on:
release:
types: [ prereleased ]

jobs:
package:
name: Build and Package
runs-on: ubuntu-20.04

outputs:
version: ${{ steps.version.outputs.value }}

steps:
- uses: actions/checkout@v2

- name: Version
id: version
run: echo ::set-output name=value::$(cat VERSION)

- name: Setup Python 3.7
uses: actions/setup-python@v2
with:
python-version: '3.7'

- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install wheel
- name: Build package
run: make package version=${{ steps.version.outputs.value }}

- name: Upload Pipeline Artifacts
uses: actions/upload-artifact@v2
with:
name: built-artifacts
path: dist/

upload-assets:
name: Upload Assets to Release
runs-on: ubuntu-20.04

needs: package

steps:
- uses: actions/download-artifact@v2
with:
name: built-artifacts
path: dist/

- uses: AButler/upload-release-assets@v2.0
with:
files: 'dist/*'
repo-token: ${{ secrets.ACCESS_TOKEN }}
release-tag: ${{ needs.package.outputs.version }}

publish-pypi:
name: Publish packages to PyPi
runs-on: ubuntu-20.04

needs: package

steps:
- uses: actions/download-artifact@v2
with:
name: built-artifacts
path: dist/

- uses: pypa/gh-action-pypi-publish@v1.4.1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
38 changes: 38 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: pull request

on:
pull_request:
branches: [ master ]

jobs:
validate:
name: Validate
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: Setup Python 3.7
uses: actions/setup-python@v2
with:
python-version: '3.7'

- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install wheel
- name: Lint
run: make lint || exit 0

- name: Tests
run: make test || exit 0
7 changes: 7 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tagFormat": "${version}",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator"
]
}
9 changes: 9 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include *.txt
include *.md
include LICENSE
include VERSION

exclude .gitignore
exclude .releaserc.json
exclude .dvcignore
exclude .dvc
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
PYTHON = python3.7
PIP = pip3.7

.PHONY: help lint test package clean install

help: # The following lines will print the available commands when entering just 'make'
ifeq ($(UNAME), Linux)
@grep -P '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
else
@awk -F ':.*###' '$$0 ~ FS {printf "%15s%s\n", $$1 ":", $$2}' \
$(MAKEFILE_LIST) | grep -v '@awk' | sort
endif

lint: ### Validates project with linting rules
$(PIP) install pylint
$(PYTHON) -m pylint src/

test: ### Runs all the project tests
"Run tests"
$(PIP) install pytest
$(PYTHON) -m pytest tests/

package: clean ### Runs the project setup
echo "$(version)" > VERSION
$(PYTHON) setup.py sdist bdist_wheel

clean: ### Removes build binaries
rm -rf build dist

install: ### Installs required dependencies
$(PIP) install dist/ydata-synthetic-$(version).tar.gz



21 changes: 16 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
from setuptools import setup, find_namespace_packages
import os
from pathlib import Path

here = Path(__file__).parent.resolve()

requirements = (here / "requirements.txt").read_text(encoding="utf8")
long_description = (here / 'README.md').read_text(encoding='utf-8')

VERSION = os.getenv('VERSION')
version = (here / 'VERSION').read_text().rstrip("\n")

setup(name='ydata-synthetic',
version=VERSION,
version=version,
description='Synthetic data generation methods with different synthetization methods.',
author='YData',
author_email='community@ydata.ai',
classifiers=[
'Programming Language :: Python :: 3 :: Only',
'Topic :: Software Development :: Artificial Intelligence :: Python Modules :: ',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Financial and Insurance Industry',
'Intended Audience :: Healthcare Industry',
'Intended Audience :: Science/Research',
'Intended Audience :: Telecommunications Industry',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: Implementation',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries :: Python Modules'
],
keywords='data science ydata',
url='https://github.com/ydataai/ydata-synthetic',
Expand Down

0 comments on commit 5223ab1

Please sign in to comment.