Skip to content

Commit 6fc043d

Browse files
authored
Merge pull request #181 from reportportal/develop
Release
2 parents 1ba5894 + d3853af commit 6fc043d

File tree

7 files changed

+149
-9
lines changed

7 files changed

+149
-9
lines changed

.github/workflows/release.yml

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,121 @@
11
name: Upload Python Package
22

33
on:
4-
release:
5-
types: [published]
4+
push:
5+
branches: ['master']
6+
paths-ignore:
7+
- '.github/**'
8+
- CHANGELOG.md
9+
- README.rst
10+
- CONTRIBUTING.rst
11+
12+
env:
13+
VERSION_FILE: setup.py
14+
VERSION_EXTRACT_PATTERN: >-
15+
__version__\s*=\s*'([^']+)
16+
VERSION_REPLACE_PATTERN: >-
17+
__version__ = '\1'
18+
TMP_SUFFIX: _updated
19+
CHANGE_LOG_FILE: CHANGELOG.md
620

721
jobs:
822
deploy:
923
runs-on: ubuntu-latest
1024
steps:
1125
- uses: actions/checkout@v2
26+
27+
- name: Generate versions
28+
uses: HardNorth/[email protected]
29+
with:
30+
version-source: file
31+
version-file: ${{ env.VERSION_FILE }}
32+
version-file-extraction-pattern: ${{ env.VERSION_EXTRACT_PATTERN }}
33+
34+
- name: Setup git credentials
35+
uses: oleksiyrudenko/gha-git-credentials@v2
36+
with:
37+
name: 'reportportal.io'
38+
39+
token: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Tagging new version
42+
id: newVersionTag
43+
run: |
44+
git tag -a ${{ env.RELEASE_VERSION }} -m "Release ${{ env.RELEASE_VERSION }}"
45+
git push --tags
46+
1247
- name: Set up Python
1348
uses: actions/setup-python@v1
1449
with:
1550
python-version: '3.6'
51+
1652
- name: Install dependencies
1753
run: |
1854
python -m pip install --upgrade pip
1955
pip install setuptools wheel twine
56+
2057
- name: Build and publish
2158
env:
2259
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
2360
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2461
run: |
2562
python setup.py sdist bdist_wheel
2663
twine upload dist/*
64+
65+
- name: Update CHANGELOG.md
66+
id: changelogUpdate
67+
run: |
68+
sed '/\[Unreleased\]/q' ${{ env.CHANGE_LOG_FILE }} >> ${{ env.CHANGE_LOG_FILE }}${{ env.TMP_SUFFIX }}
69+
sed -E '1,/#?#\s*\[Unreleased\]/d' ${{ env.CHANGE_LOG_FILE }} | sed -E '/#?#\s*\[/q' | \
70+
{ echo -e '\n## [${{ env.RELEASE_VERSION }}]'; sed '$d'; } >> ${{ env.CHANGE_LOG_FILE }}${{ env.TMP_SUFFIX }}
71+
grep -E '#?#\s*\[[0-9]' ${{ env.CHANGE_LOG_FILE }} | head -n1 >> ${{ env.CHANGE_LOG_FILE }}${{ env.TMP_SUFFIX }}
72+
sed -E '1,/#?#\s*\[[0-9]/d' ${{ env.CHANGE_LOG_FILE }} >> ${{ env.CHANGE_LOG_FILE }}${{ env.TMP_SUFFIX }}
73+
rm ${{ env.CHANGE_LOG_FILE }}
74+
mv ${{ env.CHANGE_LOG_FILE }}${{ env.TMP_SUFFIX }} ${{ env.CHANGE_LOG_FILE }}
75+
git add ${{ env.CHANGE_LOG_FILE }}
76+
git commit -m "Changelog update"
77+
git push
78+
79+
- name: Read changelog Entry
80+
id: readChangelogEntry
81+
uses: mindsers/[email protected]
82+
with:
83+
version: ${{ env.RELEASE_VERSION }}
84+
path: ./${{ env.CHANGE_LOG_FILE }}
85+
86+
- name: Create Release
87+
id: createRelease
88+
uses: actions/create-release@v1
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
with:
92+
tag_name: ${{ env.RELEASE_VERSION }}
93+
release_name: Release ${{ env.RELEASE_VERSION }}
94+
body: ${{ steps.readChangelogEntry.outputs.log_entry }}
95+
draft: false
96+
prerelease: false
97+
98+
- name: Checkout develop branch
99+
uses: actions/checkout@v2
100+
with:
101+
ref: 'develop'
102+
fetch-depth: 0
103+
104+
- name: Merge release branch into develop
105+
id: mergeIntoDevelop
106+
run: |
107+
git merge -m 'Merge master branch into develop after a release' origin/master
108+
git status | (! grep -Fq 'both modified:') || git status | grep -F 'both modified:' \
109+
| { echo -e 'Unable to merge master into develop, merge conflicts:'; (! grep -Eo '[^ ]+$') }
110+
111+
- name: Update version file
112+
id: versionFileUpdate
113+
run: |
114+
export CURRENT_VERSION_VALUE=`echo '${{ env.CURRENT_VERSION }}' | sed -E 's/(.*)/${{ env.VERSION_REPLACE_PATTERN }}/'`
115+
export NEXT_VERSION_VALUE=`echo '${{ env.NEXT_VERSION }}' | sed -E 's/(.*)/${{ env.VERSION_REPLACE_PATTERN }}/'`
116+
sed "s/${CURRENT_VERSION_VALUE}/${NEXT_VERSION_VALUE}/g" ${{ env.VERSION_FILE }} > ${{ env.VERSION_FILE }}${{ env.TMP_SUFFIX }}
117+
rm ${{ env.VERSION_FILE }}
118+
mv ${{ env.VERSION_FILE }}${{ env.TMP_SUFFIX }} ${{ env.VERSION_FILE }}
119+
git add ${{ env.VERSION_FILE }}
120+
git commit -m "Version update"
121+
git push origin develop

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
## [Unreleased]
4+
### Fixed
5+
- Issue [#180](https://github.com/reportportal/client-Python/issues/180):
6+
logger crash on attachments, by @HardNorth
7+
### Changed
8+
- Log processing does not stop on the first error now.
9+
10+
## [5.2.0]
11+
### Changed
12+
- Client fixes, by @HardNorth

reportportal_client/core/rp_file.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""This module contains classes representing RP file object."""
22

3+
import uuid
4+
35

46
class RPFile(object):
57
"""Class representation for a file that will be attached to the log."""
@@ -20,7 +22,7 @@ def __init__(self,
2022
"""
2123
self.content = content or data
2224
self.content_type = content_type or mime
23-
self.name = name
25+
self.name = name if name and name.strip() else str(uuid.uuid4())
2426

2527
@property
2628
def payload(self):

reportportal_client/core/rp_requests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import json
2323
import logging
24-
import uuid
2524

2625
from reportportal_client.core.rp_file import RPFile
2726
from reportportal_client.core.rp_issues import Issue
@@ -440,7 +439,7 @@ def __init__(self, log_reqs):
440439

441440
def __get_file(self, rp_file):
442441
"""Form a tuple for the single file."""
443-
return ('file', (rp_file.name or uuid.uuid4(),
442+
return ('file', (rp_file.name,
444443
rp_file.content,
445444
rp_file.content_type or self.default_content))
446445

reportportal_client/core/worker.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ def _request_process(self, request):
121121
except Exception as err:
122122
logger.exception('[%s] Unknown exception has occurred. Terminating'
123123
' the worker.', err)
124-
self.stop_immediate()
125124
self._queue.task_done()
126125

127126
def _stop(self):

setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from setuptools import setup, find_packages
44

5-
__version__ = '5.2.0'
5+
__version__ = '5.2.1'
66

77
with open('requirements.txt') as f:
88
requirements = f.read().splitlines()
@@ -20,10 +20,11 @@
2020
keywords=['testing', 'reporting', 'reportportal'],
2121
classifiers=[
2222
'Programming Language :: Python :: 2.7',
23-
'Programming Language :: Python :: 3.5',
2423
'Programming Language :: Python :: 3.6',
2524
'Programming Language :: Python :: 3.7',
26-
'Programming Language :: Python :: 3.8'
25+
'Programming Language :: Python :: 3.8',
26+
'Programming Language :: Python :: 3.9',
27+
'Programming Language :: Python :: 3.10'
2728
],
2829
install_requires=requirements
2930
)

tests/logs/test_rp_file.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright (c) 2022 https://reportportal.io .
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# https://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License
13+
14+
import pytest
15+
16+
from reportportal_client.core.rp_file import RPFile
17+
18+
19+
@pytest.mark.parametrize(
20+
['name'],
21+
[
22+
[''],
23+
[None],
24+
[' ']
25+
]
26+
)
27+
def test_rp_file_name_should_not_be_empty(name):
28+
file = RPFile(name, '{"test": true}', 'application/json')
29+
30+
payload = file.payload
31+
assert payload['name']
32+
assert len(payload['name']) > 10

0 commit comments

Comments
 (0)