|
1 | 1 | name: build allure python |
2 | 2 |
|
3 | | -on: [push, pull_request] |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - master |
4 | 7 |
|
5 | 8 | 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 | + |
6 | 77 | build: |
| 78 | + name: Build package |
7 | 79 | runs-on: ubuntu-latest |
| 80 | + needs: [linters, commons, changes] |
8 | 81 | strategy: |
9 | 82 | 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) }} |
19 | 84 | 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 |
24 | 88 | 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 |
0 commit comments