Skip to content

Commit 97e09f2

Browse files
committed
share setup
1 parent 4fda762 commit 97e09f2

File tree

2 files changed

+38
-20
lines changed

2 files changed

+38
-20
lines changed

.github/actions/setup.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
python-version:
5+
required: true
6+
type: string
7+
os:
8+
required: true
9+
type: string
10+
jobs:
11+
setup:
12+
name: Setup poetry
13+
steps:
14+
15+
- uses: actions/checkout@v3
16+
17+
- name: Set up Python ${{ inputs.python-version }}
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: ${{ inputs.python-version }}
21+
22+
- name: Install Poetry
23+
run: python -m pip install poetry
24+
25+
- name: Determine poetry version
26+
run: echo "::set-output name=VERSION::$(poetry --version)"
27+
id: poetry_version
28+
29+
- name: Cache poetry.lock
30+
uses: actions/cache@v3
31+
with:
32+
path: poetry.lock
33+
key: ${{ inputs.os }}-${{ inputs.python-version }}-poetry-${{ steps.poetry_version.outputs.VERSION }}-${{ hashFiles('pyproject.toml') }}
34+
35+
- name: Install project dependencies
36+
run: poetry install -vvv --no-root

.github/workflows/test.yml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,11 @@ jobs:
1414

1515
steps:
1616

17-
- uses: actions/checkout@v3
18-
19-
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v4
17+
- uses: .github/actions/setup.yaml
2118
with:
19+
os: ${{ matrix.os }}
2220
python-version: ${{ matrix.python-version }}
2321

24-
- name: Install Poetry
25-
run: pip install poetry
26-
27-
- name: Determine poetry version
28-
run: echo "::set-output name=VERSION::$(poetry --version)"
29-
id: poetry_version
30-
31-
- name: Cache poetry.lock
32-
uses: actions/cache@v3
33-
with:
34-
path: poetry.lock
35-
key: ${{ matrix.os }}-${{ matrix.python-version }}-poetry-${{ steps.poetry_version.outputs.VERSION }}-${{ hashFiles('pyproject.toml') }}
36-
37-
- name: Install project dependencies
38-
run: poetry install -vvv --no-root
39-
4022
- name: Show poetry python location (Windows)
4123
shell: pwsh
4224
run: |

0 commit comments

Comments
 (0)