From b5c455bde4b5b2993851705e6108eff54e31d0bc Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 10 May 2025 12:29:37 -0500 Subject: [PATCH 01/34] github: Try replacing Gr1N/setup-poetry with pipx --- .github/workflows/check_docs.yml | 4 +--- .github/workflows/check_nitypes.yml | 4 +--- .github/workflows/run_unit_tests.yml | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml index 2b7ca182..a1f6c881 100644 --- a/.github/workflows/check_docs.yml +++ b/.github/workflows/check_docs.yml @@ -21,9 +21,7 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - name: Set up Poetry - uses: Gr1N/setup-poetry@v9 - with: - poetry-version: ${{ env.POETRY_VERSION }} + run: pipx install poetry==${{ env.POETRY_VERSION }} --python python${{ steps.setup-python.outputs.python-version }} - name: Check for lock changes run: poetry check --lock - name: Cache virtualenv (with docs) diff --git a/.github/workflows/check_nitypes.yml b/.github/workflows/check_nitypes.yml index 38373d35..93fceb98 100644 --- a/.github/workflows/check_nitypes.yml +++ b/.github/workflows/check_nitypes.yml @@ -21,9 +21,7 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - name: Set up Poetry - uses: Gr1N/setup-poetry@v9 - with: - poetry-version: ${{ env.POETRY_VERSION }} + run: pipx install poetry==${{ env.POETRY_VERSION }} --python python${{ steps.setup-python.outputs.python-version }} - name: Check for lock changes run: poetry check --lock - name: Cache virtualenv diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index e165cbf2..e3c3f28d 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -27,9 +27,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Set up Poetry - uses: Gr1N/setup-poetry@v9 - with: - poetry-version: ${{ env.POETRY_VERSION }} + run: pipx install poetry==${{ env.POETRY_VERSION }} --python python${{ steps.setup-python.outputs.python-version }} - name: Cache virtualenv uses: actions/cache@v4 with: From 09179afae9457aecb3fb7fe69e88a7276fdfa6c1 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 10 May 2025 12:58:30 -0500 Subject: [PATCH 02/34] github: Use python-path because there is no command alias for pythonX.Y.Z --- .github/workflows/check_docs.yml | 2 +- .github/workflows/check_nitypes.yml | 2 +- .github/workflows/run_unit_tests.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml index a1f6c881..eefae8ec 100644 --- a/.github/workflows/check_docs.yml +++ b/.github/workflows/check_docs.yml @@ -21,7 +21,7 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - name: Set up Poetry - run: pipx install poetry==${{ env.POETRY_VERSION }} --python python${{ steps.setup-python.outputs.python-version }} + run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Check for lock changes run: poetry check --lock - name: Cache virtualenv (with docs) diff --git a/.github/workflows/check_nitypes.yml b/.github/workflows/check_nitypes.yml index 93fceb98..4974bf1d 100644 --- a/.github/workflows/check_nitypes.yml +++ b/.github/workflows/check_nitypes.yml @@ -21,7 +21,7 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - name: Set up Poetry - run: pipx install poetry==${{ env.POETRY_VERSION }} --python python${{ steps.setup-python.outputs.python-version }} + run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Check for lock changes run: poetry check --lock - name: Cache virtualenv diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index e3c3f28d..3b61202f 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -27,7 +27,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Set up Poetry - run: pipx install poetry==${{ env.POETRY_VERSION }} --python python${{ steps.setup-python.outputs.python-version }} + run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Cache virtualenv uses: actions/cache@v4 with: From eceb09513a3fabc0421e08b9ab5a93e4d9e3c398 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 10 May 2025 13:06:54 -0500 Subject: [PATCH 03/34] github: Try caching the pipx dirs --- .github/workflows/check_nitypes.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/check_nitypes.yml b/.github/workflows/check_nitypes.yml index 4974bf1d..9a185c82 100644 --- a/.github/workflows/check_nitypes.yml +++ b/.github/workflows/check_nitypes.yml @@ -20,6 +20,13 @@ jobs: id: setup-python with: python-version: ${{ env.PYTHON_VERSION }} + - name: Cache pipx + uses: actions/cache@v4 + with: + path: | + ${{ env.PIPX_HOME }} + ${{ env.PIPX_BIN_DIR }} + key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Check for lock changes From eef36f203404df21b718b6053d54f8d5c1e89482 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 10 May 2025 13:12:24 -0500 Subject: [PATCH 04/34] github: Try overriding PIPX_HOME and PIPX_BIN_DIR --- .github/workflows/check_nitypes.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check_nitypes.yml b/.github/workflows/check_nitypes.yml index 9a185c82..f7e82cd7 100644 --- a/.github/workflows/check_nitypes.yml +++ b/.github/workflows/check_nitypes.yml @@ -7,6 +7,8 @@ on: env: POETRY_VERSION: 1.8.2 PYTHON_VERSION: 3.11.9 + PIPX_HOME: ~/.local/pipx + PIPX_BIN_DIR: ~/.local/bin jobs: check_nitypes: From f100c12d8f13872cac0de4e63ea8019eb320b729 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 10 May 2025 13:15:50 -0500 Subject: [PATCH 05/34] github: Enable pipx caching for all workflows --- .github/workflows/check_docs.yml | 9 +++++++++ .github/workflows/check_nitypes.yml | 4 ++-- .github/workflows/run_unit_tests.yml | 9 +++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml index eefae8ec..784de4ec 100644 --- a/.github/workflows/check_docs.yml +++ b/.github/workflows/check_docs.yml @@ -5,6 +5,8 @@ on: workflow_dispatch: env: + PIPX_BIN_DIR: ~/.local/bin + PIPX_HOME: ~/.local/pipx POETRY_VERSION: 1.8.2 PYTHON_VERSION: 3.11.9 @@ -20,6 +22,13 @@ jobs: id: setup-python with: python-version: ${{ env.PYTHON_VERSION }} + - name: Cache pipx + uses: actions/cache@v4 + with: + path: | + ${{ env.PIPX_HOME }} + ${{ env.PIPX_BIN_DIR }} + key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Check for lock changes diff --git a/.github/workflows/check_nitypes.yml b/.github/workflows/check_nitypes.yml index f7e82cd7..965527af 100644 --- a/.github/workflows/check_nitypes.yml +++ b/.github/workflows/check_nitypes.yml @@ -5,10 +5,10 @@ on: workflow_dispatch: env: + PIPX_BIN_DIR: ~/.local/bin + PIPX_HOME: ~/.local/pipx POETRY_VERSION: 1.8.2 PYTHON_VERSION: 3.11.9 - PIPX_HOME: ~/.local/pipx - PIPX_BIN_DIR: ~/.local/bin jobs: check_nitypes: diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 3b61202f..8644ea03 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -5,6 +5,8 @@ on: workflow_dispatch: env: + PIPX_BIN_DIR: ~/.local/bin + PIPX_HOME: ~/.local/pipx POETRY_VERSION: 1.8.2 jobs: @@ -26,6 +28,13 @@ jobs: id: setup-python with: python-version: ${{ matrix.python-version }} + - name: Cache pipx + uses: actions/cache@v4 + with: + path: | + ${{ env.PIPX_HOME }} + ${{ env.PIPX_BIN_DIR }} + key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Cache virtualenv From 5a37e4a6b44d2875a8591e310b16e19f2a179b6d Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 10 May 2025 13:22:25 -0500 Subject: [PATCH 06/34] github: Run pipx ensurepath --- .github/workflows/check_docs.yml | 2 ++ .github/workflows/check_nitypes.yml | 2 ++ .github/workflows/run_unit_tests.yml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml index 784de4ec..bdd754eb 100644 --- a/.github/workflows/check_docs.yml +++ b/.github/workflows/check_docs.yml @@ -29,6 +29,8 @@ jobs: ${{ env.PIPX_HOME }} ${{ env.PIPX_BIN_DIR }} key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} + - name: Add pipx to the path + run: pipx ensurepath - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Check for lock changes diff --git a/.github/workflows/check_nitypes.yml b/.github/workflows/check_nitypes.yml index 965527af..39bbaa75 100644 --- a/.github/workflows/check_nitypes.yml +++ b/.github/workflows/check_nitypes.yml @@ -29,6 +29,8 @@ jobs: ${{ env.PIPX_HOME }} ${{ env.PIPX_BIN_DIR }} key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} + - name: Add pipx to the path + run: pipx ensurepath - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Check for lock changes diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 8644ea03..934ca11d 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -35,6 +35,8 @@ jobs: ${{ env.PIPX_HOME }} ${{ env.PIPX_BIN_DIR }} key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} + - name: Add pipx to the path + run: pipx ensurepath - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Cache virtualenv From fcf7f565ac614d2bb378293075d81acee7e64d1a Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 10 May 2025 13:30:46 -0500 Subject: [PATCH 07/34] github: Try adding PIPX_BIN_DIR directly to the path --- .github/workflows/check_docs.yml | 4 ++-- .github/workflows/check_nitypes.yml | 4 ++-- .github/workflows/run_unit_tests.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml index bdd754eb..2defdfc6 100644 --- a/.github/workflows/check_docs.yml +++ b/.github/workflows/check_docs.yml @@ -29,8 +29,8 @@ jobs: ${{ env.PIPX_HOME }} ${{ env.PIPX_BIN_DIR }} key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - - name: Add pipx to the path - run: pipx ensurepath + - name: Add PIPX_BIN_DIR to the path + run: echo "${{ env.PIPX_BIN_DIR }}" >> "$GITHUB_PATH" - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Check for lock changes diff --git a/.github/workflows/check_nitypes.yml b/.github/workflows/check_nitypes.yml index 39bbaa75..4f706097 100644 --- a/.github/workflows/check_nitypes.yml +++ b/.github/workflows/check_nitypes.yml @@ -29,8 +29,8 @@ jobs: ${{ env.PIPX_HOME }} ${{ env.PIPX_BIN_DIR }} key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - - name: Add pipx to the path - run: pipx ensurepath + - name: Add PIPX_BIN_DIR to the path + run: echo "${{ env.PIPX_BIN_DIR }}" >> "$GITHUB_PATH" - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Check for lock changes diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 934ca11d..26936095 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -35,8 +35,8 @@ jobs: ${{ env.PIPX_HOME }} ${{ env.PIPX_BIN_DIR }} key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - - name: Add pipx to the path - run: pipx ensurepath + - name: Add PIPX_BIN_DIR to the path + run: echo "${{ env.PIPX_BIN_DIR }}" >> "$GITHUB_PATH" - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Cache virtualenv From 02cb1b4839b307cb92f13176d52670486362ac84 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 10 May 2025 13:36:32 -0500 Subject: [PATCH 08/34] github: Use bash to interpret ~ --- .github/workflows/check_docs.yml | 1 + .github/workflows/check_nitypes.yml | 1 + .github/workflows/run_unit_tests.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml index 2defdfc6..a026c61e 100644 --- a/.github/workflows/check_docs.yml +++ b/.github/workflows/check_docs.yml @@ -31,6 +31,7 @@ jobs: key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - name: Add PIPX_BIN_DIR to the path run: echo "${{ env.PIPX_BIN_DIR }}" >> "$GITHUB_PATH" + shell: bash - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Check for lock changes diff --git a/.github/workflows/check_nitypes.yml b/.github/workflows/check_nitypes.yml index 4f706097..76f106ed 100644 --- a/.github/workflows/check_nitypes.yml +++ b/.github/workflows/check_nitypes.yml @@ -31,6 +31,7 @@ jobs: key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - name: Add PIPX_BIN_DIR to the path run: echo "${{ env.PIPX_BIN_DIR }}" >> "$GITHUB_PATH" + shell: bash - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Check for lock changes diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 26936095..f2af0da7 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -37,6 +37,7 @@ jobs: key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - name: Add PIPX_BIN_DIR to the path run: echo "${{ env.PIPX_BIN_DIR }}" >> "$GITHUB_PATH" + shell: bash - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Cache virtualenv From 0a881844e8f3340bf2cc04d131dd72c79056d3f6 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 10 May 2025 13:42:41 -0500 Subject: [PATCH 09/34] github: Try $HOME instead of ~ --- .github/workflows/check_docs.yml | 5 ++--- .github/workflows/check_nitypes.yml | 5 ++--- .github/workflows/run_unit_tests.yml | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml index a026c61e..618417bb 100644 --- a/.github/workflows/check_docs.yml +++ b/.github/workflows/check_docs.yml @@ -5,8 +5,8 @@ on: workflow_dispatch: env: - PIPX_BIN_DIR: ~/.local/bin - PIPX_HOME: ~/.local/pipx + PIPX_BIN_DIR: $HOME/.local/bin + PIPX_HOME: $HOME/.local/pipx POETRY_VERSION: 1.8.2 PYTHON_VERSION: 3.11.9 @@ -31,7 +31,6 @@ jobs: key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - name: Add PIPX_BIN_DIR to the path run: echo "${{ env.PIPX_BIN_DIR }}" >> "$GITHUB_PATH" - shell: bash - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Check for lock changes diff --git a/.github/workflows/check_nitypes.yml b/.github/workflows/check_nitypes.yml index 76f106ed..051f0da5 100644 --- a/.github/workflows/check_nitypes.yml +++ b/.github/workflows/check_nitypes.yml @@ -5,8 +5,8 @@ on: workflow_dispatch: env: - PIPX_BIN_DIR: ~/.local/bin - PIPX_HOME: ~/.local/pipx + PIPX_BIN_DIR: $HOME/.local/bin + PIPX_HOME: $HOME/.local/pipx POETRY_VERSION: 1.8.2 PYTHON_VERSION: 3.11.9 @@ -31,7 +31,6 @@ jobs: key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - name: Add PIPX_BIN_DIR to the path run: echo "${{ env.PIPX_BIN_DIR }}" >> "$GITHUB_PATH" - shell: bash - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Check for lock changes diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index f2af0da7..cef60dba 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -5,8 +5,8 @@ on: workflow_dispatch: env: - PIPX_BIN_DIR: ~/.local/bin - PIPX_HOME: ~/.local/pipx + PIPX_BIN_DIR: $HOME/.local/bin + PIPX_HOME: $HOME/.local/pipx POETRY_VERSION: 1.8.2 jobs: @@ -37,7 +37,6 @@ jobs: key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - name: Add PIPX_BIN_DIR to the path run: echo "${{ env.PIPX_BIN_DIR }}" >> "$GITHUB_PATH" - shell: bash - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Cache virtualenv From f22fe43fa8d6300c78d5802ffda3cddbfd8a5ab0 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 10 May 2025 13:48:34 -0500 Subject: [PATCH 10/34] github: Try using the shell to evaluate $HOME --- .github/workflows/check_docs.yml | 9 +++++---- .github/workflows/check_nitypes.yml | 9 +++++---- .github/workflows/run_unit_tests.yml | 9 +++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml index 618417bb..89d5d22b 100644 --- a/.github/workflows/check_docs.yml +++ b/.github/workflows/check_docs.yml @@ -5,8 +5,6 @@ on: workflow_dispatch: env: - PIPX_BIN_DIR: $HOME/.local/bin - PIPX_HOME: $HOME/.local/pipx POETRY_VERSION: 1.8.2 PYTHON_VERSION: 3.11.9 @@ -22,6 +20,11 @@ jobs: id: setup-python with: python-version: ${{ env.PYTHON_VERSION }} + - name: Override pipx paths + run: | + echo "PIPX_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV" + echo "PIPX_HOME=$HOME/.local/pipx" >> "$GITHUB_ENV" + echo "$HOME/.local/bin" >> "$GITHUB_PATH" - name: Cache pipx uses: actions/cache@v4 with: @@ -29,8 +32,6 @@ jobs: ${{ env.PIPX_HOME }} ${{ env.PIPX_BIN_DIR }} key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - - name: Add PIPX_BIN_DIR to the path - run: echo "${{ env.PIPX_BIN_DIR }}" >> "$GITHUB_PATH" - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Check for lock changes diff --git a/.github/workflows/check_nitypes.yml b/.github/workflows/check_nitypes.yml index 051f0da5..375e31c1 100644 --- a/.github/workflows/check_nitypes.yml +++ b/.github/workflows/check_nitypes.yml @@ -5,8 +5,6 @@ on: workflow_dispatch: env: - PIPX_BIN_DIR: $HOME/.local/bin - PIPX_HOME: $HOME/.local/pipx POETRY_VERSION: 1.8.2 PYTHON_VERSION: 3.11.9 @@ -22,6 +20,11 @@ jobs: id: setup-python with: python-version: ${{ env.PYTHON_VERSION }} + - name: Override pipx paths + run: | + echo "PIPX_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV" + echo "PIPX_HOME=$HOME/.local/pipx" >> "$GITHUB_ENV" + echo "$HOME/.local/bin" >> "$GITHUB_PATH" - name: Cache pipx uses: actions/cache@v4 with: @@ -29,8 +32,6 @@ jobs: ${{ env.PIPX_HOME }} ${{ env.PIPX_BIN_DIR }} key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - - name: Add PIPX_BIN_DIR to the path - run: echo "${{ env.PIPX_BIN_DIR }}" >> "$GITHUB_PATH" - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Check for lock changes diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index cef60dba..9fa4964b 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -5,8 +5,6 @@ on: workflow_dispatch: env: - PIPX_BIN_DIR: $HOME/.local/bin - PIPX_HOME: $HOME/.local/pipx POETRY_VERSION: 1.8.2 jobs: @@ -28,6 +26,11 @@ jobs: id: setup-python with: python-version: ${{ matrix.python-version }} + - name: Override pipx paths + run: | + echo "PIPX_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV" + echo "PIPX_HOME=$HOME/.local/pipx" >> "$GITHUB_ENV" + echo "$HOME/.local/bin" >> "$GITHUB_PATH" - name: Cache pipx uses: actions/cache@v4 with: @@ -35,8 +38,6 @@ jobs: ${{ env.PIPX_HOME }} ${{ env.PIPX_BIN_DIR }} key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - - name: Add PIPX_BIN_DIR to the path - run: echo "${{ env.PIPX_BIN_DIR }}" >> "$GITHUB_PATH" - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Cache virtualenv From 5982fcc782dc6ded36e0f315390817a8d6e6d97a Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 10 May 2025 13:55:18 -0500 Subject: [PATCH 11/34] github: Use step outputs to pass shell-evaluated paths around --- .github/workflows/check_docs.yml | 9 ++++++--- .github/workflows/check_nitypes.yml | 9 ++++++--- .github/workflows/run_unit_tests.yml | 9 ++++++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml index 89d5d22b..eb758308 100644 --- a/.github/workflows/check_docs.yml +++ b/.github/workflows/check_docs.yml @@ -20,17 +20,20 @@ jobs: id: setup-python with: python-version: ${{ env.PYTHON_VERSION }} - - name: Override pipx paths + - name: Set pipx paths + id: set-pipx-paths run: | echo "PIPX_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV" echo "PIPX_HOME=$HOME/.local/pipx" >> "$GITHUB_ENV" echo "$HOME/.local/bin" >> "$GITHUB_PATH" + echo "pipx-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT" + echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT" - name: Cache pipx uses: actions/cache@v4 with: path: | - ${{ env.PIPX_HOME }} - ${{ env.PIPX_BIN_DIR }} + ${{ steps.set-pipx-paths.outputs.pipx-bin-dir }} + ${{ steps.set-pipx-paths.outputs.pipx-home }} key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' diff --git a/.github/workflows/check_nitypes.yml b/.github/workflows/check_nitypes.yml index 375e31c1..f3f39d99 100644 --- a/.github/workflows/check_nitypes.yml +++ b/.github/workflows/check_nitypes.yml @@ -20,17 +20,20 @@ jobs: id: setup-python with: python-version: ${{ env.PYTHON_VERSION }} - - name: Override pipx paths + - name: Set pipx paths + id: set-pipx-paths run: | echo "PIPX_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV" echo "PIPX_HOME=$HOME/.local/pipx" >> "$GITHUB_ENV" echo "$HOME/.local/bin" >> "$GITHUB_PATH" + echo "pipx-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT" + echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT" - name: Cache pipx uses: actions/cache@v4 with: path: | - ${{ env.PIPX_HOME }} - ${{ env.PIPX_BIN_DIR }} + ${{ steps.set-pipx-paths.outputs.pipx-bin-dir }} + ${{ steps.set-pipx-paths.outputs.pipx-home }} key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 9fa4964b..4c5adcc0 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -26,17 +26,20 @@ jobs: id: setup-python with: python-version: ${{ matrix.python-version }} - - name: Override pipx paths + - name: Set pipx paths + id: set-pipx-paths run: | echo "PIPX_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV" echo "PIPX_HOME=$HOME/.local/pipx" >> "$GITHUB_ENV" echo "$HOME/.local/bin" >> "$GITHUB_PATH" + echo "pipx-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT" + echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT" - name: Cache pipx uses: actions/cache@v4 with: path: | - ${{ env.PIPX_HOME }} - ${{ env.PIPX_BIN_DIR }} + ${{ steps.set-pipx-paths.outputs.pipx-bin-dir }} + ${{ steps.set-pipx-paths.outputs.pipx-home }} key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - name: Set up Poetry run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' From c2b9ff946ff9830ce6dd3d376904809f73113c59 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 10 May 2025 14:00:47 -0500 Subject: [PATCH 12/34] github: Try bash again --- .github/workflows/check_docs.yml | 1 + .github/workflows/check_nitypes.yml | 1 + .github/workflows/run_unit_tests.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml index eb758308..08910ec6 100644 --- a/.github/workflows/check_docs.yml +++ b/.github/workflows/check_docs.yml @@ -28,6 +28,7 @@ jobs: echo "$HOME/.local/bin" >> "$GITHUB_PATH" echo "pipx-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT" echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT" + shell: bash - name: Cache pipx uses: actions/cache@v4 with: diff --git a/.github/workflows/check_nitypes.yml b/.github/workflows/check_nitypes.yml index f3f39d99..71e84afc 100644 --- a/.github/workflows/check_nitypes.yml +++ b/.github/workflows/check_nitypes.yml @@ -28,6 +28,7 @@ jobs: echo "$HOME/.local/bin" >> "$GITHUB_PATH" echo "pipx-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT" echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT" + shell: bash - name: Cache pipx uses: actions/cache@v4 with: diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 4c5adcc0..0b7f774c 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -34,6 +34,7 @@ jobs: echo "$HOME/.local/bin" >> "$GITHUB_PATH" echo "pipx-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT" echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT" + shell: bash - name: Cache pipx uses: actions/cache@v4 with: From ed44d137a6ba04e26181084cbecc05f0b233765a Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 10 May 2025 14:15:57 -0500 Subject: [PATCH 13/34] github: Create a composite action --- .../actions/setup-python-poetry/action.yml | 43 +++++++++++++++++++ .github/workflows/check_docs.yml | 32 ++------------ .github/workflows/check_nitypes.yml | 32 ++------------ .github/workflows/run_unit_tests.yml | 29 ++----------- 4 files changed, 55 insertions(+), 81 deletions(-) create mode 100644 .github/actions/setup-python-poetry/action.yml diff --git a/.github/actions/setup-python-poetry/action.yml b/.github/actions/setup-python-poetry/action.yml new file mode 100644 index 00000000..f238cdc2 --- /dev/null +++ b/.github/actions/setup-python-poetry/action.yml @@ -0,0 +1,43 @@ +name: Set up Python and Poetry +inputs: + python-version: + default: 3.11.9 + poetry-version: + default: 1.8.2 +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@v5 + id: setup-python + with: + python-version: ${{ inputs.python-version }} + # The default pipx paths on GitHub-hosted runners are locations that actions/cache cannot + # write to, like /opt/pipx and "C:\Program Files (x86)\pipx". See + # https://github.com/pypa/pipx/discussions/1051 for more info. + - name: Set pipx paths + id: set-pipx-paths + run: | + echo "PIPX_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV" + echo "PIPX_HOME=$HOME/.local/pipx" >> "$GITHUB_ENV" + echo "$HOME/.local/bin" >> "$GITHUB_PATH" + echo "pipx-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT" + echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT" + # Use bash so that $HOME is evaluated properly. + shell: bash + - name: Cache pipx + id: cache-pipx + uses: actions/cache@v4 + with: + path: | + ${{ steps.set-pipx-paths.outputs.pipx-bin-dir }} + ${{ steps.set-pipx-paths.outputs.pipx-home }} + key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ inputs.poetry-version }} + - name: Set up Poetry + if: steps.cache-pipx.outputs.cache-hit != 'true' + run: pipx install poetry==${{ inputs.poetry-version }} --python '${{ steps.setup-python.outputs.python-path }}' diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml index 08910ec6..8cf835ed 100644 --- a/.github/workflows/check_docs.yml +++ b/.github/workflows/check_docs.yml @@ -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 @@ -15,36 +11,16 @@ jobs: steps: - 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 }} - - name: Set pipx paths - id: set-pipx-paths - run: | - echo "PIPX_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV" - echo "PIPX_HOME=$HOME/.local/pipx" >> "$GITHUB_ENV" - echo "$HOME/.local/bin" >> "$GITHUB_PATH" - echo "pipx-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT" - echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT" - shell: bash - - name: Cache pipx - uses: actions/cache@v4 - with: - path: | - ${{ steps.set-pipx-paths.outputs.pipx-bin-dir }} - ${{ steps.set-pipx-paths.outputs.pipx-home }} - key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - - name: Set up Poetry - run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' + - name: Set up Python and Poetry + id: setup-python-poetry + uses: /.github/actions/setup-python-poetry - name: Check for lock changes run: poetry check --lock - name: Cache virtualenv (with docs) uses: actions/cache@v4 with: path: .venv - key: nitypes-with-docs-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} + key: nitypes-with-docs-${{ runner.os }}-py${{ steps.setup-python-poetry.outputs.python-version }}-${{ hashFiles('poetry.lock') }} - name: Install nitypes (with docs) run: poetry install -v --only main,docs - name: Generate docs diff --git a/.github/workflows/check_nitypes.yml b/.github/workflows/check_nitypes.yml index 71e84afc..a6174eac 100644 --- a/.github/workflows/check_nitypes.yml +++ b/.github/workflows/check_nitypes.yml @@ -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 @@ -15,36 +11,16 @@ jobs: steps: - 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 }} - - name: Set pipx paths - id: set-pipx-paths - run: | - echo "PIPX_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV" - echo "PIPX_HOME=$HOME/.local/pipx" >> "$GITHUB_ENV" - echo "$HOME/.local/bin" >> "$GITHUB_PATH" - echo "pipx-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT" - echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT" - shell: bash - - name: Cache pipx - uses: actions/cache@v4 - with: - path: | - ${{ steps.set-pipx-paths.outputs.pipx-bin-dir }} - ${{ steps.set-pipx-paths.outputs.pipx-home }} - key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - - name: Set up Poetry - run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' + - name: Set up Python and Poetry + id: setup-python-poetry + uses: /.github/actions/setup-python-poetry - name: Check for lock changes run: poetry check --lock - name: Cache virtualenv uses: actions/cache@v4 with: path: .venv - key: nitypes-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} + key: nitypes-${{ runner.os }}-py${{ steps.setup-python-poetry.outputs.python-version }}-${{ hashFiles('poetry.lock') }} - name: Install nitypes run: poetry install -v - name: Lint diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 0b7f774c..436fa7d7 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -4,9 +4,6 @@ on: workflow_call: workflow_dispatch: -env: - POETRY_VERSION: 1.8.2 - jobs: run_unit_tests: name: Run unit tests @@ -21,34 +18,16 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - id: setup-python + - name: Set up Python and Poetry + id: setup-python-poetry + uses: /.github/actions/setup-python-poetry with: python-version: ${{ matrix.python-version }} - - name: Set pipx paths - id: set-pipx-paths - run: | - echo "PIPX_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV" - echo "PIPX_HOME=$HOME/.local/pipx" >> "$GITHUB_ENV" - echo "$HOME/.local/bin" >> "$GITHUB_PATH" - echo "pipx-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT" - echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT" - shell: bash - - name: Cache pipx - uses: actions/cache@v4 - with: - path: | - ${{ steps.set-pipx-paths.outputs.pipx-bin-dir }} - ${{ steps.set-pipx-paths.outputs.pipx-home }} - key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ env.POETRY_VERSION }} - - name: Set up Poetry - run: pipx install poetry==${{ env.POETRY_VERSION }} --python '${{ steps.setup-python.outputs.python-path }}' - name: Cache virtualenv uses: actions/cache@v4 with: path: .venv - key: nitypes-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} + key: nitypes-${{ runner.os }}-py${{ steps.setup-python-poetry.outputs.python-version }}-${{ hashFiles('poetry.lock') }} - name: Install nitypes run: poetry install -v - name: Run unit tests and code coverage From 0c8f488172a726b2cdd9acb94ef7663b01e0c57a Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 10 May 2025 14:21:42 -0500 Subject: [PATCH 14/34] github: Fix path to composite action --- .github/workflows/check_docs.yml | 2 +- .github/workflows/check_nitypes.yml | 2 +- .github/workflows/run_unit_tests.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml index 8cf835ed..88d39466 100644 --- a/.github/workflows/check_docs.yml +++ b/.github/workflows/check_docs.yml @@ -13,7 +13,7 @@ jobs: uses: actions/checkout@v4 - name: Set up Python and Poetry id: setup-python-poetry - uses: /.github/actions/setup-python-poetry + uses: ./.github/actions/setup-python-poetry - name: Check for lock changes run: poetry check --lock - name: Cache virtualenv (with docs) diff --git a/.github/workflows/check_nitypes.yml b/.github/workflows/check_nitypes.yml index a6174eac..6aa1dd5f 100644 --- a/.github/workflows/check_nitypes.yml +++ b/.github/workflows/check_nitypes.yml @@ -13,7 +13,7 @@ jobs: uses: actions/checkout@v4 - name: Set up Python and Poetry id: setup-python-poetry - uses: /.github/actions/setup-python-poetry + uses: ./.github/actions/setup-python-poetry - name: Check for lock changes run: poetry check --lock - name: Cache virtualenv diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 436fa7d7..4b4dba60 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -20,7 +20,7 @@ jobs: uses: actions/checkout@v4 - name: Set up Python and Poetry id: setup-python-poetry - uses: /.github/actions/setup-python-poetry + uses: ./.github/actions/setup-python-poetry with: python-version: ${{ matrix.python-version }} - name: Cache virtualenv From c3b59387c9f3eb2d3d466e569fe524faf3b7710f Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 10 May 2025 14:23:57 -0500 Subject: [PATCH 15/34] github: Specify shell for uses in composite actions --- .github/actions/setup-python-poetry/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/setup-python-poetry/action.yml b/.github/actions/setup-python-poetry/action.yml index f238cdc2..234d7760 100644 --- a/.github/actions/setup-python-poetry/action.yml +++ b/.github/actions/setup-python-poetry/action.yml @@ -41,3 +41,4 @@ runs: - name: Set up Poetry if: steps.cache-pipx.outputs.cache-hit != 'true' run: pipx install poetry==${{ inputs.poetry-version }} --python '${{ steps.setup-python.outputs.python-path }}' + shell: bash \ No newline at end of file From d2cceec7b327a2064503a4e0efd3bc3f1852b62e Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 16:28:17 -0500 Subject: [PATCH 16/34] github: Split setup-python from setup-poetry and use commit hashes for external actions --- .../action.yml | 37 ++++++++++--------- .github/actions/setup-python/action.yml | 18 +++++++++ .github/workflows/check_docs.yml | 10 +++-- .github/workflows/check_nitypes.yml | 10 +++-- .github/workflows/run_unit_tests.yml | 10 +++-- 5 files changed, 56 insertions(+), 29 deletions(-) rename .github/actions/{setup-python-poetry => setup-poetry}/action.yml (52%) create mode 100644 .github/actions/setup-python/action.yml diff --git a/.github/actions/setup-python-poetry/action.yml b/.github/actions/setup-poetry/action.yml similarity index 52% rename from .github/actions/setup-python-poetry/action.yml rename to .github/actions/setup-poetry/action.yml index 234d7760..0a11b459 100644 --- a/.github/actions/setup-python-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -1,22 +1,20 @@ -name: Set up Python and Poetry +name: Set up Poetry +description: Set up Poetry using pipx and cache the pipx installation. inputs: - python-version: - default: 3.11.9 poetry-version: default: 1.8.2 -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@v5 - id: setup-python - with: - python-version: ${{ inputs.python-version }} + - name: Get Python version + id: get-python-version + run: | + if [ ! -x "$env.pythonLocation" ]; then + echo "You must use the setup-python action before using this action." + exit 1 + fi + "$env.pythonLocation" -c "import sys; print(f'python-version={sys.version}')" >> "$GITHUB_OUTPUT" + shell: bash # The default pipx paths on GitHub-hosted runners are locations that actions/cache cannot # write to, like /opt/pipx and "C:\Program Files (x86)\pipx". See # https://github.com/pypa/pipx/discussions/1051 for more info. @@ -30,15 +28,20 @@ runs: echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT" # Use bash so that $HOME is evaluated properly. shell: bash + # This action assumes that pipx is not used to install any packages other than poetry. + # If any other packages are installed, the cache key does not take them into account. - name: Cache pipx id: cache-pipx - uses: actions/cache@v4 + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 with: path: | ${{ steps.set-pipx-paths.outputs.pipx-bin-dir }} ${{ steps.set-pipx-paths.outputs.pipx-home }} - key: pipx-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry${{ inputs.poetry-version }} - - name: Set up Poetry + key: pipx-${{ runner.os }}-py${{ steps.get-python-version.outputs.python-version }}-poetry${{ inputs.poetry-version }} + - name: Install Poetry if: steps.cache-pipx.outputs.cache-hit != 'true' - run: pipx install poetry==${{ inputs.poetry-version }} --python '${{ steps.setup-python.outputs.python-path }}' + run: pipx install poetry==${{ inputs.poetry-version }} --python '${{ $env.pythonLocation }}' + shell: bash + - name: Print Poetry version + run: poetry --version shell: bash \ No newline at end of file diff --git a/.github/actions/setup-python/action.yml b/.github/actions/setup-python/action.yml new file mode 100644 index 00000000..217f857f --- /dev/null +++ b/.github/actions/setup-python/action.yml @@ -0,0 +1,18 @@ +name: Set up Python +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 + id: setup-python + with: + python-version: ${{ inputs.python-version }} diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml index 88d39466..936b7288 100644 --- a/.github/workflows/check_docs.yml +++ b/.github/workflows/check_docs.yml @@ -11,16 +11,18 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v4 - - name: Set up Python and Poetry - id: setup-python-poetry - uses: ./.github/actions/setup-python-poetry + - name: Set up Python + id: setup-python + uses: ./.github/actions/setup-python + - name: Set up Poetry + uses: ./.github/actions/setup-poetry - name: Check for lock changes run: poetry check --lock - name: Cache virtualenv (with docs) uses: actions/cache@v4 with: path: .venv - key: nitypes-with-docs-${{ runner.os }}-py${{ steps.setup-python-poetry.outputs.python-version }}-${{ hashFiles('poetry.lock') }} + key: nitypes-with-docs-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} - name: Install nitypes (with docs) run: poetry install -v --only main,docs - name: Generate docs diff --git a/.github/workflows/check_nitypes.yml b/.github/workflows/check_nitypes.yml index 6aa1dd5f..4be6db76 100644 --- a/.github/workflows/check_nitypes.yml +++ b/.github/workflows/check_nitypes.yml @@ -11,16 +11,18 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v4 - - name: Set up Python and Poetry - id: setup-python-poetry - uses: ./.github/actions/setup-python-poetry + - name: Set up Python + id: setup-python + uses: ./.github/actions/setup-python + - name: Set up Poetry + uses: ./.github/actions/setup-poetry - name: Check for lock changes run: poetry check --lock - name: Cache virtualenv uses: actions/cache@v4 with: path: .venv - key: nitypes-${{ runner.os }}-py${{ steps.setup-python-poetry.outputs.python-version }}-${{ hashFiles('poetry.lock') }} + key: nitypes-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} - name: Install nitypes run: poetry install -v - name: Lint diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 4b4dba60..cce9fac8 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -18,16 +18,18 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v4 - - name: Set up Python and Poetry - id: setup-python-poetry - uses: ./.github/actions/setup-python-poetry + - name: Set up Python + id: setup-python + uses: ./.github/actions/setup-python with: python-version: ${{ matrix.python-version }} + - name: Set up Poetry + uses: ./.github/actions/setup-poetry - name: Cache virtualenv uses: actions/cache@v4 with: path: .venv - key: nitypes-${{ runner.os }}-py${{ steps.setup-python-poetry.outputs.python-version }}-${{ hashFiles('poetry.lock') }} + key: nitypes-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} - name: Install nitypes run: poetry install -v - name: Run unit tests and code coverage From 1ce40c1c70133349248a2537549a50e82da3119d Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 16:35:08 -0500 Subject: [PATCH 17/34] github: Fix environment variable evaluation --- .github/actions/setup-poetry/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index 0a11b459..0033c4d2 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -9,11 +9,11 @@ runs: - name: Get Python version id: get-python-version run: | - if [ ! -x "$env.pythonLocation" ]; then + if [ ! -x "$pythonLocation" ]; then echo "You must use the setup-python action before using this action." exit 1 fi - "$env.pythonLocation" -c "import sys; print(f'python-version={sys.version}')" >> "$GITHUB_OUTPUT" + "$pythonLocation" -c "import sys; print(f'python-version={sys.version}')" >> "$GITHUB_OUTPUT" shell: bash # The default pipx paths on GitHub-hosted runners are locations that actions/cache cannot # write to, like /opt/pipx and "C:\Program Files (x86)\pipx". See @@ -40,7 +40,7 @@ runs: key: pipx-${{ runner.os }}-py${{ steps.get-python-version.outputs.python-version }}-poetry${{ inputs.poetry-version }} - name: Install Poetry if: steps.cache-pipx.outputs.cache-hit != 'true' - run: pipx install poetry==${{ inputs.poetry-version }} --python '${{ $env.pythonLocation }}' + run: pipx install poetry==${{ inputs.poetry-version }} --python "$env.pythonLocation" shell: bash - name: Print Poetry version run: poetry --version From 65cc367b28cc6478696d73c2397ffd6d2470f819 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 16:36:51 -0500 Subject: [PATCH 18/34] github: Fix $pythonLocation usage --- .github/actions/setup-poetry/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index 0033c4d2..425bc77c 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -9,11 +9,11 @@ runs: - name: Get Python version id: get-python-version run: | - if [ ! -x "$pythonLocation" ]; then + if [ ! -d "$pythonLocation" ]; then echo "You must use the setup-python action before using this action." exit 1 fi - "$pythonLocation" -c "import sys; print(f'python-version={sys.version}')" >> "$GITHUB_OUTPUT" + "$pythonLocation/python" -c "import sys; print(f'python-version={sys.version}')" >> "$GITHUB_OUTPUT" shell: bash # The default pipx paths on GitHub-hosted runners are locations that actions/cache cannot # write to, like /opt/pipx and "C:\Program Files (x86)\pipx". See @@ -40,7 +40,7 @@ runs: key: pipx-${{ runner.os }}-py${{ steps.get-python-version.outputs.python-version }}-poetry${{ inputs.poetry-version }} - name: Install Poetry if: steps.cache-pipx.outputs.cache-hit != 'true' - run: pipx install poetry==${{ inputs.poetry-version }} --python "$env.pythonLocation" + run: pipx install poetry==${{ inputs.poetry-version }} --python "$env.pythonLocation/python" shell: bash - name: Print Poetry version run: poetry --version From 26609d7a7a3811bdde2269a4da105db2bd050625 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 16:40:41 -0500 Subject: [PATCH 19/34] github: Fix Python version format --- .github/actions/setup-poetry/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index 425bc77c..1f7564c3 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -13,7 +13,7 @@ runs: echo "You must use the setup-python action before using this action." exit 1 fi - "$pythonLocation/python" -c "import sys; print(f'python-version={sys.version}')" >> "$GITHUB_OUTPUT" + "$pythonLocation/python" -c "import platform; print(f'python-version={platform.python_version()}')" >> "$GITHUB_OUTPUT" shell: bash # The default pipx paths on GitHub-hosted runners are locations that actions/cache cannot # write to, like /opt/pipx and "C:\Program Files (x86)\pipx". See From 7c9d17d62b502653ab72f7e75708a5d32fb9fa85 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 16:44:44 -0500 Subject: [PATCH 20/34] github: Fix one more env var --- .github/actions/setup-poetry/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index 1f7564c3..caf8c0b7 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -40,7 +40,7 @@ runs: key: pipx-${{ runner.os }}-py${{ steps.get-python-version.outputs.python-version }}-poetry${{ inputs.poetry-version }} - name: Install Poetry if: steps.cache-pipx.outputs.cache-hit != 'true' - run: pipx install poetry==${{ inputs.poetry-version }} --python "$env.pythonLocation/python" + run: pipx install poetry==${{ inputs.poetry-version }} --python "$pythonLocation/python" shell: bash - name: Print Poetry version run: poetry --version From 5bec7e4013b699dfbb764ec6b34be3d5fd8030e7 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 17:03:22 -0500 Subject: [PATCH 21/34] github: Let's try installing Poetry manually instead of using pipx --- .github/actions/setup-poetry/action.yml | 43 ++++++++++++++----------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index caf8c0b7..c57387dc 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -1,5 +1,5 @@ name: Set up Poetry -description: Set up Poetry using pipx and cache the pipx installation. +description: Install Poetry and cache its installation. inputs: poetry-version: default: 1.8.2 @@ -15,32 +15,37 @@ runs: fi "$pythonLocation/python" -c "import platform; print(f'python-version={platform.python_version()}')" >> "$GITHUB_OUTPUT" shell: bash - # The default pipx paths on GitHub-hosted runners are locations that actions/cache cannot - # write to, like /opt/pipx and "C:\Program Files (x86)\pipx". See - # https://github.com/pypa/pipx/discussions/1051 for more info. - - name: Set pipx paths - id: set-pipx-paths + - name: Set paths + id: set-paths run: | - echo "PIPX_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV" - echo "PIPX_HOME=$HOME/.local/pipx" >> "$GITHUB_ENV" + echo "POETRY_BIN_DIR=$HOME/.local/poetry_bin" >> "$GITHUB_ENV" + echo "POETRY_HOME=$HOME/.local/poetry" >> "$GITHUB_ENV" + echo "poetry-bin-dir=$HOME/.local/poetry_bin" >> "$GITHUB_OUTPUT" + echo "poetry-home=$HOME/.local/poetry" >> "$GITHUB_OUTPUT" echo "$HOME/.local/bin" >> "$GITHUB_PATH" - echo "pipx-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT" - echo "pipx-home=$HOME/.local/pipx" >> "$GITHUB_OUTPUT" # Use bash so that $HOME is evaluated properly. shell: bash - # This action assumes that pipx is not used to install any packages other than poetry. - # If any other packages are installed, the cache key does not take them into account. - - name: Cache pipx - id: cache-pipx + - name: Cache poetry + id: cache-poetry uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 with: path: | - ${{ steps.set-pipx-paths.outputs.pipx-bin-dir }} - ${{ steps.set-pipx-paths.outputs.pipx-home }} + ${{ steps.set-paths.outputs.poetry-bin-dir }} + ${{ steps.set-paths.outputs.poetry-home }} key: pipx-${{ runner.os }}-py${{ steps.get-python-version.outputs.python-version }}-poetry${{ inputs.poetry-version }} - - name: Install Poetry - if: steps.cache-pipx.outputs.cache-hit != 'true' - run: pipx install poetry==${{ inputs.poetry-version }} --python "$pythonLocation/python" + - name: Install Poetry (Linux/Mac) + if: runner.os != "Windows" && steps.cache-pipx.outputs.cache-hit != 'true' + run: | + "$pythonLocation/python" -m venv "$POETRY_HOME" + "$POETRY_HOME/bin/python" -m pip install poetry==${{ inputs.poetry-version }} + ln -s "$POETRY_HOME/bin/poetry" "$POETRY_BIN_DIR/poetry" + shell: bash + - name: Install Poetry (Windows) + if: runner.os == "Windows" && steps.cache-pipx.outputs.cache-hit != 'true' + run: | + "$pythonLocation/python" -m venv "$POETRY_HOME" + "$POETRY_HOME/Scripts/python" -m pip install poetry==${{ inputs.poetry-version }} + ln -s "$POETRY_HOME/bin/poetry.exe" "$POETRY_BIN_DIR/poetry.exe" shell: bash - name: Print Poetry version run: poetry --version From a2bcfb517dd19728ef84ec25d045ba3ebda5083e Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 17:04:34 -0500 Subject: [PATCH 22/34] github: Fix syntax --- .github/actions/setup-poetry/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index c57387dc..f61584dc 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -34,14 +34,14 @@ runs: ${{ steps.set-paths.outputs.poetry-home }} key: pipx-${{ runner.os }}-py${{ steps.get-python-version.outputs.python-version }}-poetry${{ inputs.poetry-version }} - name: Install Poetry (Linux/Mac) - if: runner.os != "Windows" && steps.cache-pipx.outputs.cache-hit != 'true' + if: runner.os != 'Windows' && steps.cache-pipx.outputs.cache-hit != 'true' run: | "$pythonLocation/python" -m venv "$POETRY_HOME" "$POETRY_HOME/bin/python" -m pip install poetry==${{ inputs.poetry-version }} ln -s "$POETRY_HOME/bin/poetry" "$POETRY_BIN_DIR/poetry" shell: bash - name: Install Poetry (Windows) - if: runner.os == "Windows" && steps.cache-pipx.outputs.cache-hit != 'true' + if: runner.os == 'Windows' && steps.cache-pipx.outputs.cache-hit != 'true' run: | "$pythonLocation/python" -m venv "$POETRY_HOME" "$POETRY_HOME/Scripts/python" -m pip install poetry==${{ inputs.poetry-version }} From 5ba017854699506174511bdca8fc228b5d7819e4 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 17:12:13 -0500 Subject: [PATCH 23/34] github: venv Linux vs. Windows dirs --- .github/actions/setup-poetry/action.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index f61584dc..568df5b7 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -33,19 +33,20 @@ runs: ${{ steps.set-paths.outputs.poetry-bin-dir }} ${{ steps.set-paths.outputs.poetry-home }} key: pipx-${{ runner.os }}-py${{ steps.get-python-version.outputs.python-version }}-poetry${{ inputs.poetry-version }} - - name: Install Poetry (Linux/Mac) - if: runner.os != 'Windows' && steps.cache-pipx.outputs.cache-hit != 'true' + - name: Install Poetry + if: steps.cache-pipx.outputs.cache-hit != 'true' run: | "$pythonLocation/python" -m venv "$POETRY_HOME" - "$POETRY_HOME/bin/python" -m pip install poetry==${{ inputs.poetry-version }} - ln -s "$POETRY_HOME/bin/poetry" "$POETRY_BIN_DIR/poetry" - shell: bash - - name: Install Poetry (Windows) - if: runner.os == 'Windows' && steps.cache-pipx.outputs.cache-hit != 'true' - run: | - "$pythonLocation/python" -m venv "$POETRY_HOME" - "$POETRY_HOME/Scripts/python" -m pip install poetry==${{ inputs.poetry-version }} - ln -s "$POETRY_HOME/bin/poetry.exe" "$POETRY_BIN_DIR/poetry.exe" + if [ -d "$POETRY_HOME/Scripts" ]; then + export POETRY_HOME_BIN="$POETRY_HOME/Scripts" + export EXE=".exe" + else + export POETRY_HOME_BIN="$POETRY_HOME/bin" + export EXE="" + fi + "$POETRY_HOME_BIN/python" -m pip install poetry==${{ inputs.poetry-version }} + mkdir -p "$POETRY_BIN_DIR" + ln -s "$POETRY_HOME_BIN/poetry$EXE" "$POETRY_BIN_DIR/poetry$EXE" shell: bash - name: Print Poetry version run: poetry --version From b2193c554a0c5f6b874c996647b8da63d0a59129 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 17:15:42 -0500 Subject: [PATCH 24/34] github: Fix paths --- .github/actions/setup-poetry/action.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index 568df5b7..b2d7631d 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -18,12 +18,11 @@ runs: - name: Set paths id: set-paths run: | - echo "POETRY_BIN_DIR=$HOME/.local/poetry_bin" >> "$GITHUB_ENV" - echo "POETRY_HOME=$HOME/.local/poetry" >> "$GITHUB_ENV" - echo "poetry-bin-dir=$HOME/.local/poetry_bin" >> "$GITHUB_OUTPUT" - echo "poetry-home=$HOME/.local/poetry" >> "$GITHUB_OUTPUT" - echo "$HOME/.local/bin" >> "$GITHUB_PATH" - # Use bash so that $HOME is evaluated properly. + echo "POETRY_BIN_DIR=$HOME/.local/poetry/bin" >> "$GITHUB_ENV" + echo "POETRY_HOME=$HOME/.local/poetry/venv" >> "$GITHUB_ENV" + echo "poetry-bin-dir=$HOME/.local/poetry/bin" >> "$GITHUB_OUTPUT" + echo "poetry-home=$HOME/.local/poetry/home" >> "$GITHUB_OUTPUT" + echo "$HOME/.local/poetry/bin" >> "$GITHUB_PATH" shell: bash - name: Cache poetry id: cache-poetry @@ -32,7 +31,7 @@ runs: path: | ${{ steps.set-paths.outputs.poetry-bin-dir }} ${{ steps.set-paths.outputs.poetry-home }} - key: pipx-${{ runner.os }}-py${{ steps.get-python-version.outputs.python-version }}-poetry${{ inputs.poetry-version }} + key: poetry${{ inputs.poetry-version }}-${{ runner.os }}-py${{ steps.get-python-version.outputs.python-version }} - name: Install Poetry if: steps.cache-pipx.outputs.cache-hit != 'true' run: | From acd69aa3474b2e6484bc91af25ede638e74585f7 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 17:24:45 -0500 Subject: [PATCH 25/34] github: Copy instead of symlink on Windows --- .github/actions/setup-poetry/action.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index b2d7631d..1ae17528 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -38,14 +38,16 @@ runs: "$pythonLocation/python" -m venv "$POETRY_HOME" if [ -d "$POETRY_HOME/Scripts" ]; then export POETRY_HOME_BIN="$POETRY_HOME/Scripts" - export EXE=".exe" else export POETRY_HOME_BIN="$POETRY_HOME/bin" - export EXE="" fi "$POETRY_HOME_BIN/python" -m pip install poetry==${{ inputs.poetry-version }} mkdir -p "$POETRY_BIN_DIR" - ln -s "$POETRY_HOME_BIN/poetry$EXE" "$POETRY_BIN_DIR/poetry$EXE" + if [ -d "$POETRY_HOME/Scripts" ]; then + cp "$POETRY_HOME_BIN/poetry.exe" "$POETRY_BIN_DIR/poetry.exe" + else + ln -s "$POETRY_HOME_BIN/poetry" "$POETRY_BIN_DIR/poetry" + fi shell: bash - name: Print Poetry version run: poetry --version From 8fdc0ee3af4c50615fea03284861016d32a01da8 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 17:25:19 -0500 Subject: [PATCH 26/34] github: Fix cache step name --- .github/actions/setup-poetry/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index 1ae17528..0d36c98e 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -33,7 +33,7 @@ runs: ${{ steps.set-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-pipx.outputs.cache-hit != 'true' + if: steps.cache-poetry.outputs.cache-hit != 'true' run: | "$pythonLocation/python" -m venv "$POETRY_HOME" if [ -d "$POETRY_HOME/Scripts" ]; then From e07f84c985340d5fddee64acca151bb8ac1f9323 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 17:27:57 -0500 Subject: [PATCH 27/34] github: Fix poetry home path --- .github/actions/setup-poetry/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index 0d36c98e..590cee2a 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -19,7 +19,7 @@ runs: id: set-paths run: | echo "POETRY_BIN_DIR=$HOME/.local/poetry/bin" >> "$GITHUB_ENV" - echo "POETRY_HOME=$HOME/.local/poetry/venv" >> "$GITHUB_ENV" + echo "POETRY_HOME=$HOME/.local/poetry/home" >> "$GITHUB_ENV" echo "poetry-bin-dir=$HOME/.local/poetry/bin" >> "$GITHUB_OUTPUT" echo "poetry-home=$HOME/.local/poetry/home" >> "$GITHUB_OUTPUT" echo "$HOME/.local/poetry/bin" >> "$GITHUB_PATH" From 6329bd10624942d416c290adf23b3e5046983d91 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 17:38:04 -0500 Subject: [PATCH 28/34] github: Try going back to ~/.local/bin since it may already be in the path --- .github/actions/setup-poetry/action.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index 590cee2a..5d859e03 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -18,18 +18,18 @@ runs: - name: Set paths id: set-paths run: | - echo "POETRY_BIN_DIR=$HOME/.local/poetry/bin" >> "$GITHUB_ENV" - echo "POETRY_HOME=$HOME/.local/poetry/home" >> "$GITHUB_ENV" - echo "poetry-bin-dir=$HOME/.local/poetry/bin" >> "$GITHUB_OUTPUT" - echo "poetry-home=$HOME/.local/poetry/home" >> "$GITHUB_OUTPUT" - echo "$HOME/.local/poetry/bin" >> "$GITHUB_PATH" + echo "LOCAL_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV" + echo "local-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT" + echo "POETRY_HOME=$HOME/.local/poetry" >> "$GITHUB_ENV" + echo "poetry-home=$HOME/.local/poetry" >> "$GITHUB_OUTPUT" + echo "$HOME/.local/bin" >> "$GITHUB_PATH" shell: bash - name: Cache poetry id: cache-poetry uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 with: path: | - ${{ steps.set-paths.outputs.poetry-bin-dir }} + ${{ steps.set-paths.outputs.local-bin-dir }}/poetry* ${{ steps.set-paths.outputs.poetry-home }} key: poetry${{ inputs.poetry-version }}-${{ runner.os }}-py${{ steps.get-python-version.outputs.python-version }} - name: Install Poetry @@ -38,16 +38,14 @@ runs: "$pythonLocation/python" -m venv "$POETRY_HOME" if [ -d "$POETRY_HOME/Scripts" ]; then export POETRY_HOME_BIN="$POETRY_HOME/Scripts" + export EXE=".exe" else export POETRY_HOME_BIN="$POETRY_HOME/bin" + export EXE="" fi "$POETRY_HOME_BIN/python" -m pip install poetry==${{ inputs.poetry-version }} - mkdir -p "$POETRY_BIN_DIR" - if [ -d "$POETRY_HOME/Scripts" ]; then - cp "$POETRY_HOME_BIN/poetry.exe" "$POETRY_BIN_DIR/poetry.exe" - else - ln -s "$POETRY_HOME_BIN/poetry" "$POETRY_BIN_DIR/poetry" - fi + mkdir -p "$LOCAL_BIN_DIR" + ln -s "$POETRY_HOME_BIN/poetry$EXE" "$LOCAL_BIN_DIR/poetry$EXE" shell: bash - name: Print Poetry version run: poetry --version From c8aabf1bed29b7ae648c9e4dbcbdf1258c954dac Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 17:42:23 -0500 Subject: [PATCH 29/34] github: Try copy on Windows again --- .github/actions/setup-poetry/action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index 5d859e03..baac1f21 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -45,7 +45,11 @@ runs: fi "$POETRY_HOME_BIN/python" -m pip install poetry==${{ inputs.poetry-version }} mkdir -p "$LOCAL_BIN_DIR" - ln -s "$POETRY_HOME_BIN/poetry$EXE" "$LOCAL_BIN_DIR/poetry$EXE" + if [ x"$EXE" == x".exe" ]; then + cp "$POETRY_HOME_BIN/poetry$EXE" "$LOCAL_BIN_DIR/poetry$EXE" + else + ln -s "$POETRY_HOME_BIN/poetry$EXE" "$LOCAL_BIN_DIR/poetry$EXE" + fi shell: bash - name: Print Poetry version run: poetry --version From d28e1836163eeb31506f2d3fbcb279a5a1187670 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 17:45:34 -0500 Subject: [PATCH 30/34] github: Display path --- .github/workflows/run_unit_tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index cce9fac8..98e6e9e9 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -30,6 +30,9 @@ jobs: with: path: .venv key: nitypes-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} + - run: echo $PATH + shell: bash + - run: echo $env:PATH - name: Install nitypes run: poetry install -v - name: Run unit tests and code coverage From b5d2d9c49055f4922b8df130a6156ef747caddce Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 18:07:04 -0500 Subject: [PATCH 31/34] github: The value add of pipx is that it keeps you from writing Powershell --- .github/actions/setup-poetry/action.yml | 45 ++++++++++++------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index baac1f21..cbffedc9 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -15,41 +15,40 @@ runs: fi "$pythonLocation/python" -c "import platform; print(f'python-version={platform.python_version()}')" >> "$GITHUB_OUTPUT" shell: bash - - name: Set paths - id: set-paths + - name: Set paths (Linux/Mac) + if: runner.os != 'Windows' run: | - echo "LOCAL_BIN_DIR=$HOME/.local/bin" >> "$GITHUB_ENV" - echo "local-bin-dir=$HOME/.local/bin" >> "$GITHUB_OUTPUT" - echo "POETRY_HOME=$HOME/.local/poetry" >> "$GITHUB_ENV" - echo "poetry-home=$HOME/.local/poetry" >> "$GITHUB_OUTPUT" - echo "$HOME/.local/bin" >> "$GITHUB_PATH" + 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: powershell + - name: Get paths + id: get-paths + run: | + echo "poetry-paths=$POETRY_EXE $POETRY_HOME" >> "$GITHUB_OUTPUT" shell: bash - name: Cache poetry id: cache-poetry uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 with: - path: | - ${{ steps.set-paths.outputs.local-bin-dir }}/poetry* - ${{ steps.set-paths.outputs.poetry-home }} + path: ${{ steps.get-paths.outputs.poetry-paths }} 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" - if [ -d "$POETRY_HOME/Scripts" ]; then - export POETRY_HOME_BIN="$POETRY_HOME/Scripts" - export EXE=".exe" - else - export POETRY_HOME_BIN="$POETRY_HOME/bin" - export EXE="" - fi "$POETRY_HOME_BIN/python" -m pip install poetry==${{ inputs.poetry-version }} - mkdir -p "$LOCAL_BIN_DIR" - if [ x"$EXE" == x".exe" ]; then - cp "$POETRY_HOME_BIN/poetry$EXE" "$LOCAL_BIN_DIR/poetry$EXE" - else - ln -s "$POETRY_HOME_BIN/poetry$EXE" "$LOCAL_BIN_DIR/poetry$EXE" - fi + mkdir -p "$POETRY_BIN_DIR" + ln -s "$POETRY_HOME_BIN/poetry"* "$POETRY_BIN_DIR/" shell: bash - name: Print Poetry version run: poetry --version From 1834bd3c488feb281ecd31dbb2c438f5890921ef Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 18:08:53 -0500 Subject: [PATCH 32/34] github: Use pwsh not powershell --- .github/actions/setup-poetry/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index cbffedc9..802e6ecf 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -30,7 +30,7 @@ runs: 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: powershell + shell: pwsh - name: Get paths id: get-paths run: | From b5ce0742536ba483907b06c596dd957b6a36a3d8 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 18:13:50 -0500 Subject: [PATCH 33/34] github: Delete debug echos --- .github/workflows/run_unit_tests.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 98e6e9e9..cce9fac8 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -30,9 +30,6 @@ jobs: with: path: .venv key: nitypes-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} - - run: echo $PATH - shell: bash - - run: echo $env:PATH - name: Install nitypes run: poetry install -v - name: Run unit tests and code coverage From 3e9a167e954615837c7c7d18a721c1926779d877 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sun, 11 May 2025 18:23:13 -0500 Subject: [PATCH 34/34] github: Fix cache paths --- .github/actions/setup-poetry/action.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index 802e6ecf..41953c78 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -31,16 +31,19 @@ runs: 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: Get paths - id: get-paths + - name: Copy paths from $GITHUB_ENV to $GITHUB_OUTPUT + id: copy-paths run: | - echo "poetry-paths=$POETRY_EXE $POETRY_HOME" >> "$GITHUB_OUTPUT" + 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 with: - path: ${{ steps.get-paths.outputs.poetry-paths }} + 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'