Skip to content

Commit 08d93b9

Browse files
authored
Merge pull request #676 from allure-framework/workflow-rework
Rework workflows
2 parents b249c0f + 659c001 commit 08d93b9

File tree

33 files changed

+198
-409
lines changed

33 files changed

+198
-409
lines changed

.flake8

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
max-line-length = 120
3+
import-order-style = google
4+
inline-quotes = "

.github/workflows/build.yaml

Lines changed: 100 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,110 @@
11
name: build allure python
22

3-
on: [push, pull_request]
3+
on:
4+
pull_request:
5+
branches:
6+
- master
47

58
jobs:
9+
changes:
10+
name: Collect file changes
11+
runs-on: ubuntu-latest
12+
outputs:
13+
packages: ${{ steps.filter.outputs.changes }}
14+
steps:
15+
- uses: dorny/paths-filter@v2
16+
id: filter
17+
with:
18+
filters: |
19+
allure-behave: allure-behave/**
20+
allure-nose2: allure-nose2/**
21+
allure-pytest: allure-pytest/**
22+
allure-pytest-bdd: allure-pytest-bdd/**
23+
allure-python-commons: allure-python-commons/**
24+
allure-python-commons-test: allure-python-commons-test/**
25+
allure-robotframework: allure-robotframework/**
26+
27+
commons:
28+
name: Build commons
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v3
32+
33+
- name: Cache commons
34+
id: commons
35+
uses: actions/cache@v3
36+
with:
37+
path: dist/
38+
key: commons-${{ github.sha }}
39+
40+
- name: Build python commons
41+
if: steps.commons.outputs.cache-hit != 'true'
42+
run: pip install build &&
43+
python -m build allure-python-commons --outdir dist/ &&
44+
python -m build allure-python-commons-test --outdir dist/
45+
46+
linters:
47+
name: Static check
48+
runs-on: ubuntu-latest
49+
needs: [commons, changes]
50+
strategy:
51+
matrix:
52+
package: ${{ fromJSON(needs.changes.outputs.packages) }}
53+
steps:
54+
- uses: actions/checkout@v3
55+
56+
- name: Set up Python
57+
uses: actions/setup-python@v4
58+
with:
59+
python-version: "3.10"
60+
61+
- name: Get commons from cache
62+
id: commons
63+
uses: actions/cache@v3
64+
with:
65+
path: dist/
66+
key: commons-${{ github.sha }}
67+
68+
- name: Install packages
69+
run: pip install dist/allure-python-commons*.tar.gz &&
70+
pip install ./${{ matrix.package }} &&
71+
pip install -r ${{ matrix.package }}/requirements.txt
72+
73+
- name: Static check ${{ matrix.package }}
74+
working-directory: ${{ matrix.package }}
75+
run: poe linter
76+
677
build:
78+
name: Build package
779
runs-on: ubuntu-latest
80+
needs: [linters, commons, changes]
881
strategy:
982
matrix:
10-
package: [
11-
allure-python-commons-test,
12-
allure-python-commons,
13-
allure-nose2,
14-
allure-behave,
15-
allure-pytest,
16-
allure-pytest-bdd,
17-
allure-robotframework
18-
]
83+
package: ${{ fromJSON(needs.changes.outputs.packages) }}
1984
python-version: [3.7, 3.8, 3.9, "3.10"]
20-
include:
21-
- python-version: 3.10
22-
static-check: yes
23-
85+
env:
86+
TEST_TMP: /tmp
87+
ALLURE_INDENT_OUTPUT: yep
2488
steps:
25-
- uses: actions/checkout@v2
26-
27-
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@v1
29-
with:
30-
python-version: ${{ matrix.python-version }}
31-
32-
- name: Install tox
33-
run: pip install tox
34-
35-
- name: Static check ${{ matrix.package }}
36-
if: matrix.static-check
37-
run: tox -e static-check -c ${{ matrix.package }}/tox.ini
38-
39-
- name: Prepare commons
40-
if: "!startsWith(matrix.package, 'allure-python-commons')"
41-
run: tox --sdistonly -c ./allure-python-commons && tox --sdistonly -c ./allure-python-commons-test
42-
43-
- name: Test ${{ matrix.package }}
44-
run: tox -e py`echo ${{ matrix.python-version }} | sed 's/\.//g'` -c ${{ matrix.package }}/tox.ini
89+
- uses: actions/checkout@v3
90+
91+
- name: Set up Python ${{ matrix.python-version }}
92+
uses: actions/setup-python@v4
93+
with:
94+
python-version: ${{ matrix.python-version }}
95+
96+
- name: Get commons from cache
97+
id: commons
98+
uses: actions/cache@v3
99+
with:
100+
path: dist/
101+
key: commons-${{ github.sha }}
102+
103+
- name: Install packages
104+
run: pip install dist/allure-python-commons*.tar.gz &&
105+
pip install ./${{ matrix.package }} &&
106+
pip install -r ${{ matrix.package }}/requirements.txt
107+
108+
- name: Test ${{ matrix.package }}
109+
working-directory: ${{ matrix.package }}
110+
run: poe tests

allure-behave/pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[tool.poe.tasks]
2+
linter = "flake8 ./src"
3+
tests = """behave -f allure_behave.formatter:AllureFormatter -o allure-results
4+
-f pretty ./features"""

allure-behave/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
poethepoet
2+
# linters
3+
flake8==4.*

allure-behave/tox.ini

Lines changed: 0 additions & 102 deletions
This file was deleted.

allure-nose2/pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[tool.poe.tasks]
2+
linter = "flake8 ./src ./test"
3+
tests = """nose2 --plugin=test.example_loader --plugin=allure_nose2.plugin --allure
4+
--current-example -t . -s ./test"""

allure-nose2/requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
poethepoet
2+
# linters
3+
flake8==4.*
4+
flake8-builtins

allure-nose2/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ def main():
5656
install_requires=install_requires
5757
)
5858

59+
5960
if __name__ == '__main__':
6061
main()
61-

allure-nose2/test/example_runner.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ def run_docstring_example(**kwargs):
5757
with redirect_stdout(stdout):
5858
test_nose2_instance = test_nose2(**kwargs)
5959

60-
#test_nose2_instance = test_nose2(**kwargs)
60+
# test_nose2_instance = test_nose2(**kwargs)
6161

6262
return get_plugin(test_nose2_instance, _Allure).logger
63-

allure-nose2/test/parametrized/test_parametrized.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ def test_parametrized_method(self, first, second):
5656
has_parameter(first_param_name, represent(first_param_value)),
5757
has_parameter(second_param_name, represent(second_param_value))
5858
)
59-
)
59+
)

0 commit comments

Comments
 (0)