|
1 | | -name: CI setup |
2 | | - |
| 1 | +name: Setup Python and Poetry |
| 2 | +author: Renumics GmbH |
| 3 | +description: Set up Python and Poetry environment, cache/restore dependencies |
3 | 4 | inputs: |
4 | 5 | os: |
5 | 6 | description: "OS" |
6 | 7 | required: true |
7 | 8 | python-version: |
8 | | - description: "The python version to install and setup" |
| 9 | + description: "Python version to set up" |
9 | 10 | required: true |
10 | 11 | poetry-version: |
11 | | - description: "The poetry version to install and setup" |
| 12 | + description: "Poetry version to set up" |
12 | 13 | default: "2.2.1" |
13 | | - |
14 | 14 | runs: |
15 | 15 | using: composite |
16 | 16 | steps: |
| 17 | + - name: Set up Poetry ${{ inputs.poetry-version }} |
| 18 | + run: | |
| 19 | + pipx install 'poetry==${{ inputs.poetry-version }}' |
| 20 | + pipx inject poetry poetry-dynamic-versioning |
| 21 | + shell: bash |
17 | 22 | - name: Set up Python ${{ inputs.python-version }} |
| 23 | + id: setup-python |
18 | 24 | uses: actions/setup-python@v6 |
19 | 25 | with: |
20 | 26 | python-version: ${{ inputs.python-version }} |
21 | | - - name: Install Poetry ${{ inputs.poetry-version }} |
22 | | - uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a |
23 | | - with: |
24 | | - virtualenvs-create: true |
25 | | - virtualenvs-in-project: true |
26 | | - version: ${{ inputs.poetry-version }} |
27 | | - - name: add poetry to windows path |
28 | | - if: runner.os == 'Windows' |
29 | | - run: echo "C:/Users/runneradmin/.local/bin" >> $GITHUB_PATH |
30 | | - shell: bash |
31 | | - - name: add dynamic versioning |
32 | | - run: poetry self add "poetry-dynamic-versioning[plugin]" |
33 | | - shell: bash |
34 | | - - name: Cache Packages |
35 | | - id: poetry-cache |
36 | | - uses: actions/cache@v4 |
37 | | - with: |
38 | | - path: | |
39 | | - .venv |
40 | | - poetry.lock |
41 | | - key: poetry-${{ inputs.os }}-${{ inputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }} |
| 27 | + cache: poetry |
| 28 | + # - name: Install Poetry ${{ inputs.poetry-version }} |
| 29 | + # uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a |
| 30 | + # with: |
| 31 | + # virtualenvs-create: true |
| 32 | + # virtualenvs-in-project: true |
| 33 | + # version: ${{ inputs.poetry-version }} |
| 34 | + # - name: add poetry to windows path |
| 35 | + # if: runner.os == 'Windows' |
| 36 | + # run: echo "C:/Users/runneradmin/.local/bin" >> $GITHUB_PATH |
| 37 | + # shell: bash |
| 38 | + # - name: add dynamic versioning |
| 39 | + # run: poetry self add "poetry-dynamic-versioning[plugin]" |
| 40 | + # shell: bash |
| 41 | + # - name: Cache Packages |
| 42 | + # id: poetry-cache |
| 43 | + # uses: actions/cache@v4 |
| 44 | + # with: |
| 45 | + # path: | |
| 46 | + # .venv |
| 47 | + # poetry.lock |
| 48 | + # key: poetry-${{ inputs.os }}-${{ inputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }} |
| 49 | + # - name: Install dependencies |
| 50 | + # if: steps.poetry-cache.outputs.cache-hit != 'true' |
| 51 | + # run: poetry sync --no-interaction |
| 52 | + # shell: bash |
42 | 53 | - name: Install dependencies |
43 | | - if: steps.poetry-cache.outputs.cache-hit != 'true' |
| 54 | + if: steps.setup-python.outputs.cache-hit != 'true' |
44 | 55 | run: poetry sync --no-interaction |
45 | 56 | shell: bash |
0 commit comments