Skip to content

Commit

Permalink
Add python source build
Browse files Browse the repository at this point in the history
  • Loading branch information
SonicField committed Oct 15, 2024
1 parent 2ca7265 commit 8ba1992
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .github/actions/build-python-from-source/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ runs:
git checkout ${{ inputs.python-version }}
fi
# Do not rebuild python is we do not need to.
- name: Cache Python built artifacts
if: "!contains(inputs.python-version, 'alpha')"
uses: actions/cache@v3
id: python-cache
with:
Expand Down Expand Up @@ -133,6 +135,8 @@ runs:
# This example shows how to use the Build Python from Source action in a GitHub workflow.
# Replace 'your-workflow.yml' with the name of your actual workflow file.
#
# Note: if the python version has alpha in it then we clone the tip of main and do not cache.
#
# .github/workflows/your-workflow.yml
# jobs:
# build:
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ jobs:
# 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
shell: bash
run: echo "LOCAL_PYTHON=python" >> $GITHUB_ENV

# Upgrade pip to the latest version.
- name: Upgrade pip
shell: bash
run: |
$LOCAL_PYTHON -m pip install --upgrade pip
Expand All @@ -98,11 +99,13 @@ jobs:

# Install dependencies required for building and testing.
- name: Install dependencies
shell: bash
run: |
$LOCAL_PYTHON -m pip install --upgrade setuptools wheel
# Build the wheel package with or without nogil suffix.
- name: Build
shell: bash
run: |
$LOCAL_PYTHON -P setup.py bdist_wheel
#if [ "${{ matrix.build-from-source }}" = "true" ]; then
Expand All @@ -112,17 +115,17 @@ jobs:
# mv "$file" "${file%.whl}_nogil.whl"
#done
#fi
shell: bash
# Install the built wheel package so we can test it.
- name: Install wheel
shell: bash
run: |
$LOCAL_PYTHON -m pip install build/dist/*.whl
shell: bash
working-directory: ${{github.workspace}}

# Run all the tests and benchmarks.
- name: Test
shell: bash
run: |
mkdir test_dir
cd test_dir
Expand Down

0 comments on commit 8ba1992

Please sign in to comment.