Skip to content

Commit 00bd424

Browse files
committed
Cache commons
1 parent 19f489f commit 00bd424

File tree

1 file changed

+43
-9
lines changed

1 file changed

+43
-9
lines changed

.github/workflows/pytest.yaml

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,35 @@ on:
44
pull_request:
55
branches:
66
- master
7+
paths:
8+
- "allure-pytest/**"
9+
- "allure-python-commons/**"
10+
- "allure-python-commons-test/**"
711

812
jobs:
13+
commons:
14+
name: Build commons
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Cache commons
20+
id: commons
21+
uses: actions/cache@v3
22+
with:
23+
path: dist/
24+
key: commons-${{ hashFiles('allure-python-commons/**', 'allure-python-commons-test/**') }}
25+
26+
- name: Build python commons
27+
if: steps.commons.outputs.cache-hit != 'true'
28+
run: pip install build &&
29+
python -m build allure-python-commons --outdir dist/ &&
30+
python -m build allure-python-commons-test --outdir dist/
31+
932
linters:
33+
name: Static check
1034
runs-on: ubuntu-latest
35+
needs: [commons]
1136
steps:
1237
- uses: actions/checkout@v3
1338

@@ -16,11 +41,15 @@ jobs:
1641
with:
1742
python-version: "3.10"
1843

44+
- name: Get commons from cache
45+
id: commons
46+
uses: actions/cache@v3
47+
with:
48+
path: dist/
49+
key: commons-${{ hashFiles('allure-python-commons/**', 'allure-python-commons-test/**') }}
50+
1951
- name: Install packages
20-
run: pip install build &&
21-
python -m build allure-python-commons &&
22-
python -m build allure-python-commons-test &&
23-
pip install allure-python-commons*/dist/allure-python-commons*.tar.gz &&
52+
run: pip install dist/allure-python-commons*.tar.gz &&
2453
pip install ./allure-pytest &&
2554
pip install -r allure-pytest/requirements.txt
2655

@@ -29,8 +58,9 @@ jobs:
2958
run: flake8 src/ test/
3059

3160
build:
61+
name: Test allure-pytest
3262
runs-on: ubuntu-latest
33-
needs: [linters]
63+
needs: [linters, commons]
3464
strategy:
3565
matrix:
3666
python-version: ["3.10", 3.9, 3.8, 3.7]
@@ -44,11 +74,15 @@ jobs:
4474
with:
4575
python-version: ${{ matrix.python-version }}
4676

77+
- name: Get commons from cache
78+
id: commons
79+
uses: actions/cache@v3
80+
with:
81+
path: dist/
82+
key: commons-${{ hashFiles('allure-python-commons/**', 'allure-python-commons-test/**') }}
83+
4784
- name: Install packages
48-
run: pip install build &&
49-
python -m build allure-python-commons &&
50-
python -m build allure-python-commons-test &&
51-
pip install allure-python-commons*/dist/allure-python-commons*.tar.gz &&
85+
run: pip install dist/allure-python-commons*.tar.gz &&
5286
pip install ./allure-pytest &&
5387
pip install -r allure-pytest/requirements.txt
5488

0 commit comments

Comments
 (0)