Skip to content

Commit d85ce4d

Browse files
authored
Ci/deploy on release (#14)
* deploy-on-release github action added * mergify ci tool added
1 parent e70c1e4 commit d85ce4d

File tree

5 files changed

+104
-60
lines changed

5 files changed

+104
-60
lines changed

.github/FUNDING.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# These are supported funding model platforms
2+
3+
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: catalyst_team
5+
open_collective: catalyst
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/stale.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# https://github.com/marketplace/stale
2+
# Number of days of inactivity before an issue becomes stale
3+
daysUntilStale: 60
4+
# Number of days of inactivity before a stale issue is closed
5+
daysUntilClose: 14
6+
# Issues with these labels will never be considered stale
7+
exemptLabels:
8+
- pinned
9+
- security
10+
# Label to use when marking an issue as stale
11+
staleLabel: wontfix
12+
# Comment to post when marking an issue as stale. Set to `false` to disable
13+
markComment: >
14+
This issue has been automatically marked as stale because it has not had
15+
recent activity. It will be closed if no further activity occurs. Thank you
16+
for your contributions.
17+
# Comment to post when closing a stale issue. Set to `false` to disable
18+
closeComment: false
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: deploy-on-release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
9+
build-pypi:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: [3.6]
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: set up Python
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
22+
- name: Generating distribution archives
23+
run: |
24+
pip install --upgrade setuptools wheel
25+
python setup.py sdist bdist_wheel --universal
26+
27+
- name: Publish a Python distribution to PyPI
28+
uses: pypa/gh-action-pypi-publish@master
29+
with:
30+
user: __token__
31+
password: ${{ secrets.PYPI_TOKEN }}

.mergify.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
pull_request_rules:
2+
# removes reviews done by collaborators when the pull request is updated
3+
- name: remove outdated reviews
4+
conditions:
5+
- base=master
6+
actions:
7+
dismiss_reviews:
8+
9+
# automatic merge for master when required CI passes
10+
- name: automatic merge for master when CI passes and 2 review
11+
conditions:
12+
- "#approved-reviews-by>=2"
13+
- label!=WIP
14+
actions:
15+
merge:
16+
method: squash
17+
18+
# deletes the head branch of the pull request, that is the branch which hosts the commits
19+
- name: delete head branch after merge
20+
conditions:
21+
- merged
22+
actions:
23+
delete_head_branch: {}
24+
25+
# ask author of PR to resolve conflict
26+
- name: ask to resolve conflict
27+
conditions:
28+
- conflict
29+
actions:
30+
comment:
31+
message: "This pull request is now in conflicts. @{{ author }}, could you fix it? 🙏"

setup.py

Lines changed: 12 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
# Note: To use the "upload" functionality of this file, you must:
5-
# $ pip install twine
4+
from typing import Iterable, Union
5+
from pathlib import Path
66

7-
import io
8-
import os
9-
from shutil import rmtree
10-
import sys
11-
12-
from setuptools import Command, find_packages, setup
7+
from setuptools import find_packages, setup
138

149
# Package meta-data.
1510
NAME = "catalyst-codestyle"
@@ -20,62 +15,21 @@
2015
AUTHOR = "Sergey Kolesnikov"
2116
REQUIRES_PYTHON = ">=3.6.0"
2217

23-
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
18+
PROJECT_ROOT = Path(__file__).parent.resolve()
2419

2520

26-
def load_requirements(filename):
21+
def load_requirements(filename: Union[Path, str] = "requirements.txt") -> Iterable[str]:
2722
"""Load package requirements."""
28-
with open(os.path.join(PROJECT_ROOT, filename), "r") as f:
23+
with open(PROJECT_ROOT / filename) as f:
2924
return f.read().splitlines()
3025

3126

32-
def load_readme():
27+
def load_readme(filename: Union[Path, str] = "README.md") -> str:
3328
"""Load package readme."""
34-
readme_path = os.path.join(PROJECT_ROOT, "README.md")
35-
with io.open(readme_path, encoding="utf-8") as f:
29+
with open(PROJECT_ROOT / filename, encoding="utf-8") as f:
3630
return f"\n{f.read()}"
3731

3832

39-
class UploadCommand(Command):
40-
"""Support setup.py upload."""
41-
42-
description = "Build and publish the package."
43-
user_options = []
44-
45-
@staticmethod
46-
def status(s):
47-
"""Prints things in bold."""
48-
print(f"\033[1m{s}\033[0m")
49-
50-
def initialize_options(self):
51-
"""@TODO: Docs. Contribution is welcome"""
52-
pass
53-
54-
def finalize_options(self):
55-
"""@TODO: Docs. Contribution is welcome"""
56-
pass
57-
58-
def run(self):
59-
"""Run upload command."""
60-
try:
61-
self.status("Removing previous builds…")
62-
rmtree(os.path.join(PROJECT_ROOT, "dist"))
63-
except OSError:
64-
pass
65-
66-
self.status("Building Source and Wheel (universal) distribution…")
67-
os.system(f"{sys.executable} setup.py sdist bdist_wheel --universal") # noqa: E501, S605
68-
69-
self.status("Uploading the package to PyPI via Twine…")
70-
os.system("twine upload dist/*") # noqa: S605, S607
71-
72-
self.status("Pushing git tags…")
73-
os.system(f"git tag v{VERSION}") # noqa: S605
74-
os.system("git push --tags") # noqa: S605, S607
75-
76-
sys.exit()
77-
78-
7933
setup(
8034
name=NAME,
8135
version=VERSION,
@@ -92,14 +46,14 @@ def run(self):
9246
"Documentation": "https://catalyst-team.github.io/catalyst",
9347
"Source Code": "https://github.com/catalyst-team/codestyle",
9448
},
95-
packages=find_packages(exclude=("tests", )),
49+
packages=find_packages(exclude=("tests",)),
9650
scripts=[
9751
"bin/catalyst-check-codestyle",
9852
"bin/catalyst-make-codestyle",
9953
"bin/catalyst-codestyle-flake8",
10054
"bin/catalyst-codestyle-isort",
10155
],
102-
install_requires=load_requirements("requirements.txt"),
56+
install_requires=load_requirements(),
10357
include_package_data=True,
10458
license="Apache License 2.0",
10559
classifiers=[
@@ -115,10 +69,8 @@ def run(self):
11569
"Programming Language :: Python",
11670
"Programming Language :: Python :: 3.6",
11771
"Programming Language :: Python :: 3.7",
72+
"Programming Language :: Python :: 3.8",
73+
"Programming Language :: Python :: 3.9",
11874
"Programming Language :: Python :: Implementation :: CPython",
11975
],
120-
# $ setup.py publish support.
121-
cmdclass={
122-
"upload": UploadCommand,
123-
},
12476
)

0 commit comments

Comments
 (0)