Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b5c455b
github: Try replacing Gr1N/setup-poetry with pipx
bkeryan May 10, 2025
09179af
github: Use python-path because there is no command alias for pythonX…
bkeryan May 10, 2025
eceb095
github: Try caching the pipx dirs
bkeryan May 10, 2025
eef36f2
github: Try overriding PIPX_HOME and PIPX_BIN_DIR
bkeryan May 10, 2025
f100c12
github: Enable pipx caching for all workflows
bkeryan May 10, 2025
5a37e4a
github: Run pipx ensurepath
bkeryan May 10, 2025
fcf7f56
github: Try adding PIPX_BIN_DIR directly to the path
bkeryan May 10, 2025
02cb1b4
github: Use bash to interpret ~
bkeryan May 10, 2025
0a88184
github: Try $HOME instead of ~
bkeryan May 10, 2025
f22fe43
github: Try using the shell to evaluate $HOME
bkeryan May 10, 2025
5982fcc
github: Use step outputs to pass shell-evaluated paths around
bkeryan May 10, 2025
c2b9ff9
github: Try bash again
bkeryan May 10, 2025
ed44d13
github: Create a composite action
bkeryan May 10, 2025
0c8f488
github: Fix path to composite action
bkeryan May 10, 2025
c3b5938
github: Specify shell for uses in composite actions
bkeryan May 10, 2025
d2cceec
github: Split setup-python from setup-poetry and use commit hashes fo…
bkeryan May 11, 2025
1ce40c1
github: Fix environment variable evaluation
bkeryan May 11, 2025
65cc367
github: Fix $pythonLocation usage
bkeryan May 11, 2025
26609d7
github: Fix Python version format
bkeryan May 11, 2025
7c9d17d
github: Fix one more env var
bkeryan May 11, 2025
5bec7e4
github: Let's try installing Poetry manually instead of using pipx
bkeryan May 11, 2025
a2bcfb5
github: Fix syntax
bkeryan May 11, 2025
5ba0178
github: venv Linux vs. Windows dirs
bkeryan May 11, 2025
b2193c5
github: Fix paths
bkeryan May 11, 2025
acd69aa
github: Copy instead of symlink on Windows
bkeryan May 11, 2025
8fdc0ee
github: Fix cache step name
bkeryan May 11, 2025
e07f84c
github: Fix poetry home path
bkeryan May 11, 2025
6329bd1
github: Try going back to ~/.local/bin since it may already be in the…
bkeryan May 11, 2025
c8aabf1
github: Try copy on Windows again
bkeryan May 11, 2025
d28e183
github: Display path
bkeryan May 11, 2025
b5d2d9c
github: The value add of pipx is that it keeps you from writing Power…
bkeryan May 11, 2025
1834bd3
github: Use pwsh not powershell
bkeryan May 11, 2025
b5ce074
github: Delete debug echos
bkeryan May 11, 2025
3e9a167
github: Fix cache paths
bkeryan May 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/actions/setup-poetry/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Set up Poetry
Copy link
Collaborator

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

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can Renovate auto-update this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
18 changes: 18 additions & 0 deletions .github/actions/setup-python/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Set up Python
Copy link
Collaborator

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

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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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 }}
12 changes: 2 additions & 10 deletions .github/workflows/check_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ on:
workflow_call:
workflow_dispatch:

env:
POETRY_VERSION: 1.8.2
PYTHON_VERSION: 3.11.9

jobs:
check_docs:
name: Check docs
Expand All @@ -16,14 +12,10 @@ jobs:
- name: Check out repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ env.PYTHON_VERSION }}
uses: ./.github/actions/setup-python
- name: Set up Poetry
uses: Gr1N/setup-poetry@v9
with:
poetry-version: ${{ env.POETRY_VERSION }}
uses: ./.github/actions/setup-poetry
- name: Check for lock changes
run: poetry check --lock
- name: Cache virtualenv (with docs)
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/check_nitypes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ on:
workflow_call:
workflow_dispatch:

env:
POETRY_VERSION: 1.8.2
PYTHON_VERSION: 3.11.9

jobs:
check_nitypes:
name: Check nitypes
Expand All @@ -16,14 +12,10 @@ jobs:
- name: Check out repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ env.PYTHON_VERSION }}
uses: ./.github/actions/setup-python
- name: Set up Poetry
uses: Gr1N/setup-poetry@v9
with:
poetry-version: ${{ env.POETRY_VERSION }}
uses: ./.github/actions/setup-poetry
- name: Check for lock changes
run: poetry check --lock
- name: Cache virtualenv
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
workflow_call:
workflow_dispatch:

env:
POETRY_VERSION: 1.8.2

jobs:
run_unit_tests:
name: Run unit tests
Expand All @@ -22,14 +19,12 @@ jobs:
- name: Check out repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
id: setup-python
uses: ./.github/actions/setup-python
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: Gr1N/setup-poetry@v9
with:
poetry-version: ${{ env.POETRY_VERSION }}
uses: ./.github/actions/setup-poetry
- name: Cache virtualenv
uses: actions/cache@v4
with:
Expand Down