From 9222a4eb0a6db86b71b5b6e65b0fbeffec4af4a1 Mon Sep 17 00:00:00 2001 From: Alex Turner Date: Mon, 7 Oct 2024 15:01:59 -0700 Subject: [PATCH] Add python source build --- .github/actions/build-python-from-source/action.yml | 12 +++++------- .github/workflows/build.yml | 12 +++++++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/actions/build-python-from-source/action.yml b/.github/actions/build-python-from-source/action.yml index 2c6580c..d7c94de 100644 --- a/.github/actions/build-python-from-source/action.yml +++ b/.github/actions/build-python-from-source/action.yml @@ -93,17 +93,15 @@ runs: echo "C:/Python/${{ inputs.python-version }}" >> $GITHUB_PATH fi + # Make sure we use our version of python. + - name: Set LOCAL_PYTHON envvar + run: echo "LOCAL_PYTHON=$prefix/bin/python3" >> $GITHUB_ENV + # Ensure python is in the path and log out the version to help with debug. - name: Verify Python Installation run: | - python --version - shell: bash - - # Set the output variable 'python-path' to the path of the installed Python executable. - - name: Set output path - id: set-path + $LOCAL_PYTHON --version shell: bash - run: echo "::set-output name=python-path::$prefix/bin/python3" # Example of how to use this action in a workflow: # diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8423efb..fc86b13 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,6 +79,12 @@ jobs: python-version: ${{ matrix.python-version }} nogil: ${{ matrix.nogil }} + # Make sure we use our version of python, this is set in the build-from-source + # action os set it here for consistency if not building from source. + - name: Set LOCAL_PYTHON envvar + if: matrix.build-from-source == false + run: echo "LOCAL_PYTHON=python" >> $GITHUB_ENV + # Upgrade pip to the latest version. - name: Upgrade pip run: | @@ -98,9 +104,9 @@ jobs: - name: Build run: | if [ "${{ matrix.build-from-source }}" = "true" ]; then - python -P setup.py bdist_wheel --wheel-suffix=_nogil + $LOCAL_PYTHON -P setup.py bdist_wheel --wheel-suffix=_nogil else - python -P setup.py bdist_wheel + $LOCAL_PYTHON -P setup.py bdist_wheel fi shell: bash @@ -116,5 +122,5 @@ jobs: run: | mkdir test_dir cd test_dir - python -m ft_utils.tests.test_run_all + $LOCAL_PYTHON -m ft_utils.tests.test_run_all working-directory: ${{github.workspace}}