Skip to content

Commit f10e96c

Browse files
Merge pull request #1 from FireTail-io/feat-release-process
Feat release process
2 parents 117e483 + 0cf8624 commit f10e96c

File tree

10 files changed

+144
-18
lines changed

10 files changed

+144
-18
lines changed

.github/release-drafter.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name-template: 'v$RESOLVED_VERSION Release'
2+
tag-template: 'v$RESOLVED_VERSION'
3+
categories:
4+
- title: '🚀 Features'
5+
labels:
6+
- 'feature'
7+
- 'enhancement'
8+
- title: '🐛 Bug Fixes'
9+
labels:
10+
- 'fix'
11+
- 'bugfix'
12+
- 'bug'
13+
- title: '🧰 Maintenance'
14+
label: 'chore'
15+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
16+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
17+
version-resolver:
18+
major:
19+
labels:
20+
- 'major'
21+
minor:
22+
labels:
23+
- 'minor'
24+
patch:
25+
labels:
26+
- 'patch'
27+
default: patch
28+
template: |
29+
## Changes
30+
$CHANGES

.github/workflows/build.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: build process
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
permissions:
8+
id-token: write
9+
contents: write
10+
pull-requests: write
11+
jobs:
12+
build-docker-image:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: draft release
16+
uses: release-drafter/release-drafter@v5
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
- name: Setup Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python }}
23+
- name: Install Tox and any other packages
24+
run: pip install tox
25+
- name: Run Tox
26+
# Run tox using the version of Python in `PATH`
27+
run: tox -e py
28+
- uses: actions/cache@v3
29+
with:
30+
path: ./coverage.xml # Note that this path is not influenced by working-directory set in defaults, for example
31+
key: coverage

.github/workflows/release.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: Release
33
on:
44
release:
55
types: [created]
6-
76
jobs:
87
deploy:
98
runs-on: ubuntu-latest
@@ -13,6 +12,8 @@ jobs:
1312
uses: actions/setup-python@v2
1413
with:
1514
python-version: "3.x"
15+
- name: Update version
16+
run: sed -i "s/__version__ = .*/__version__ = '${{github.ref_name}}'/" */version.py
1617
- name: Install dependencies
1718
run: |
1819
python -m pip install --upgrade pip

.github/workflows/test.yml

+21-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
name: Test
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
- master
84
pull_request:
95
branches:
106
- main
11-
- master
127

138
jobs:
14-
build:
9+
test:
1510
runs-on: ubuntu-latest
1611
strategy:
1712
matrix:
@@ -28,3 +23,23 @@ jobs:
2823
- name: Run Tox
2924
# Run tox using the version of Python in `PATH`
3025
run: tox -e py
26+
- uses: actions/cache@v3
27+
with:
28+
path: ./coverage.xml # Note that this path is not influenced by working-directory set in defaults, for example
29+
key: coverage
30+
31+
finish-codecov:
32+
needs: test
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/cache@v3
36+
with:
37+
path: ./coverage.xml # See the note below
38+
key: coverage # Must be the same key you specified in the first job
39+
- uses: codecov/codecov-action@v3
40+
with:
41+
files: ./coverage.xml
42+
flags: unittests # optional
43+
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
44+
fail_ci_if_error: true # optional (default = false)
45+
verbose: true # optional (default = false)

firetail_lambda/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import base64, json, time
1+
import base64
2+
import json
3+
import time
4+
25
from .version import __version__
36

7+
48
def firetail_handler(enable_sleeper=False):
59
def decorator(func):
610
def wrapper_func(*args, **kwargs):

firetail_lambda/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.1.0"
1+
__version__ = "0.1.1"

setup.cfg

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[metadata]
22
license_files = LICENSE
3+
[coverage:run]
4+
omit =
5+
setup.py

setup.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
from os.path import dirname, join
2+
13
import setuptools
2-
from os.path import join, dirname
34

45
with open('README.md', 'r', encoding='utf-8') as fh:
56
long_description = fh.read()
67

7-
# with open(join(dirname(__file__), 'firetail_lambda/version.py'), 'r') as f:
8-
# exec(f.read())
8+
with open(join(dirname(__file__), 'firetail_lambda/version.py'), 'r') as f:
9+
exec(f.read())
910

1011
setuptools.setup(
1112
name='Firetail-Lambda',
1213
author='Riley Priddle',
13-
version='0.1.0',
14+
version=__version__,
1415
author_email='[email protected]',
1516
description='Firetail Lambda Package',
1617
keywords='pypi, package',

tests/test_firetail.py

+37-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
import unittest
2-
import json
1+
2+
33
import contextlib
4+
import json
5+
import time
6+
import unittest
47
from io import StringIO
58

69
from firetail_lambda import firetail_handler
710

11+
812
class TestSimple(unittest.TestCase):
913

1014
def test_handler_api(self):
@@ -19,6 +23,35 @@ def handler(event, context):
1923
output = temp_stdout.getvalue().strip()
2024
self.assertEqual(output, 'firetail:loggingapi:eyJldmVudCI6IHt9LCAicmVzcG9uc2UiOiBbMjAxLCAie1wibWVzc2FnZVwiOiBcInN1Y2Nlc3NcIn0iXX0=')
2125

26+
def test_incorrect_handler_api(self):
27+
event = {}
28+
@firetail_handler()
29+
def handler(argument):
30+
return 201, json.dumps({"message": "success"})
31+
32+
temp_stdout = StringIO()
33+
with contextlib.redirect_stdout(temp_stdout):
34+
handler(event)
35+
output = temp_stdout.getvalue().strip()
36+
self.assertEqual(output, '')
37+
38+
def test_handler_sleeper_api(self):
39+
event = {}
40+
@firetail_handler(enable_sleeper=True)
41+
def handler(event, context):
42+
return 201, json.dumps({"message": "success"})
43+
44+
temp_stdout = StringIO()
45+
with contextlib.redirect_stdout(temp_stdout):
46+
start = time.time()
47+
handler(event, "")
48+
end = time.time()
49+
50+
difference = end - start
51+
output = temp_stdout.getvalue().strip()
52+
self.assertGreaterEqual(difference, .5)
53+
self.assertEqual(output, 'firetail:loggingapi:eyJldmVudCI6IHt9LCAicmVzcG9uc2UiOiBbMjAxLCAie1wibWVzc2FnZVwiOiBcInN1Y2Nlc3NcIn0iXX0=')
54+
2255

23-
if __name__ == '__main__':
24-
unittest.main()
56+
if __name__ == '__main__': # pragma: no cover
57+
unittest.main() # pragma: no cover

tox.ini

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[isort]
2+
profile = black
3+
multi_line_output = 3
4+
15
[tox]
26
envlist = py{38,39}
37
minversion = 3.3.0
@@ -7,7 +11,11 @@ isolated_build = true
711
deps =
812
check-manifest >= 0.42
913
pytest
14+
pytest-cov
15+
coverage
16+
isort
1017
commands =
1118
check-manifest --ignore 'tox.ini,tests/**,.editorconfig,vscode.env,.vscode/**'
1219
python setup.py check -m -s
13-
pytest tests {posargs}
20+
pytest --cov ./ --cov-report xml:{toxinidir}/coverage.xml
21+
isort . --project firetail_lambda --check-only --diff

0 commit comments

Comments
 (0)