-
Notifications
You must be signed in to change notification settings - Fork 3
github: Replace Gr1N/setup-poetry with a composite action that supports caching #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b5c455b
09179af
eceb095
eef36f2
f100c12
5a37e4a
fcf7f56
02cb1b4
0a88184
f22fe43
5982fcc
c2b9ff9
ed44d13
0c8f488
c3b5938
d2cceec
1ce40c1
65cc367
26609d7
7c9d17d
5bec7e4
a2bcfb5
5ba0178
b2193c5
acd69aa
8fdc0ee
e07f84c
6329bd1
c8aabf1
d28e183
b5d2d9c
1834bd3
b5ce074
3e9a167
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| name: Set up Poetry | ||
| description: Install Poetry and cache its installation. | ||
| inputs: | ||
| poetry-version: | ||
| default: 1.8.2 | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Get Python version | ||
| id: get-python-version | ||
| run: | | ||
| if [ ! -d "$pythonLocation" ]; then | ||
| echo "You must use the setup-python action before using this action." | ||
| exit 1 | ||
| fi | ||
| "$pythonLocation/python" -c "import platform; print(f'python-version={platform.python_version()}')" >> "$GITHUB_OUTPUT" | ||
| shell: bash | ||
| - name: Set paths (Linux/Mac) | ||
| if: runner.os != 'Windows' | ||
| run: | | ||
| echo "POETRY_BIN_DIR=$HOME/.local/poetry/bin" >> "$GITHUB_ENV" | ||
| echo "POETRY_HOME=$HOME/.local/poetry/home" >> "$GITHUB_ENV" | ||
| echo "POETRY_HOME_BIN=$HOME/.local/poetry/home/bin" >> "$GITHUB_ENV" | ||
| echo "$HOME/.local/poetry/bin" >> "$GITHUB_PATH" | ||
| shell: bash | ||
| - name: Set paths (Windows) | ||
| if: runner.os == 'Windows' | ||
| run: | | ||
| Add-Content $env:GITHUB_ENV "POETRY_BIN_DIR=$HOME\.local\poetry\bin" | ||
| Add-Content $env:GITHUB_ENV "POETRY_HOME=$HOME\.local\poetry\home" | ||
| Add-Content $env:GITHUB_ENV "POETRY_HOME_BIN=$HOME\.local\poetry\home\Scripts" | ||
| Add-Content $env:GITHUB_PATH "$HOME\.local\poetry\bin" | ||
| shell: pwsh | ||
| - name: Copy paths from $GITHUB_ENV to $GITHUB_OUTPUT | ||
| id: copy-paths | ||
| run: | | ||
| echo "poetry-bin-dir=$POETRY_BIN_DIR" >> "$GITHUB_OUTPUT" | ||
| echo "poetry-home=$POETRY_HOME" >> "$GITHUB_OUTPUT" | ||
| shell: bash | ||
| - name: Cache poetry | ||
| id: cache-poetry | ||
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can Renovate auto-update this?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it can even convert |
||
| with: | ||
| path: | | ||
| ${{ steps.copy-paths.outputs.poetry-bin-dir }}/poetry* | ||
| ${{ steps.copy-paths.outputs.poetry-home }} | ||
| key: poetry${{ inputs.poetry-version }}-${{ runner.os }}-py${{ steps.get-python-version.outputs.python-version }} | ||
| - name: Install Poetry | ||
| if: steps.cache-poetry.outputs.cache-hit != 'true' | ||
| run: | | ||
| "$pythonLocation/python" -m venv "$POETRY_HOME" | ||
| "$POETRY_HOME_BIN/python" -m pip install poetry==${{ inputs.poetry-version }} | ||
| mkdir -p "$POETRY_BIN_DIR" | ||
| ln -s "$POETRY_HOME_BIN/poetry"* "$POETRY_BIN_DIR/" | ||
| shell: bash | ||
| - name: Print Poetry version | ||
| run: poetry --version | ||
| shell: bash | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| name: Set up Python | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. proposal: we move this into a "ni/gh-actions" repo |
||
| description: Set up Python, using an NI-chosen default version. | ||
| inputs: | ||
| python-version: | ||
| default: 3.11.9 | ||
| outputs: | ||
| python-path: | ||
| value: ${{ steps.setup-python.outputs.python-path }} | ||
| python-version: | ||
| value: ${{ steps.setup-python.outputs.python-version }} | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Set up Python | ||
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be possible to have Renovate auto-update this?? |
||
| id: setup-python | ||
| with: | ||
| python-version: ${{ inputs.python-version }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proposal: we move this into a "ni/gh-actions" repo