Skip to content

Commit

Permalink
Add job to build wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
marcsiftstack authored and kevin-sift committed Dec 9, 2024
1 parent e42fb8d commit 6557f09
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 1 deletion.
85 changes: 85 additions & 0 deletions .github/workflows/python_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Build Wheels

on:
workflow_dispatch:

jobs:
python-ci:
if: github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags')
uses: ./.github/workflows/python_ci.yaml

build_matrix:
strategy:
matrix:
python_version: [3.9, 3.11]

name: Build Python ${{ matrix.python_version }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: python
permissions:
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get build metadata
id: metadata
run: |
export VERSION="$(basename ${{ github.ref_name }})"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Create builds directory
working-directory: python
run: |
mkdir builds
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "${{ matrix.python_version }}"

- name: Pip install
run: |
python -m pip install --upgrade pip
pip install pip-tools
- name: Compile requirements
working-directory: python
run: |
pip-compile pyproject.toml --output-file requirements.txt
- name: Build Windows
working-directory: python
env:
PLATFORM: win_amd64
ARTIFACT_NAME: sift_stack_py-${{ steps.metadata.outputs.version }}-py${{ matrix.python_version }}-win_amd64
run: |
pip download -r requirements.txt -d dist --platform=${PLATFORM} --only-binary=:all: --python-version=${{ matrix.python_version }}
python setup.py bdist_wheel
zip ${ARTIFACT_NAME}.zip dist -r
sha1sum ${ARTIFACT_NAME}.zip | cut -f1 -d' ' > ${ARTIFACT_NAME}.sha1
mv ${ARTIFACT_NAME}.zip builds
mv ${ARTIFACT_NAME}.sha1 builds
rm -rf dist
- name: Build Linux
working-directory: python
env:
PLATFORM: manylinux_2_17_x86_64
ARTIFACT_NAME: sift_stack_py-${{ steps.metadata.outputs.version }}-py${{ matrix.python_version }}-manylinux_2_17_x86_64
run: |
pip download -r requirements.txt -d dist --platform=${PLATFORM} --only-binary=:all: --python-version=${{ matrix.python_version }}
python setup.py bdist_wheel
zip ${ARTIFACT_NAME}.zip dist -r
sha1sum ${ARTIFACT_NAME}.zip | cut -f1 -d' ' > ${ARTIFACT_NAME}.sha1
mv ${ARTIFACT_NAME}.zip builds
mv ${ARTIFACT_NAME}.sha1 builds
rm -rf dist
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sift_stack_py-${{ steps.metadata.outputs.version }}-py${{ matrix.python_version }}
path: python/builds
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ keywords = [
]
dependencies = [
"grpcio~=1.13",
"npTDMS~=1.9",
"PyYAML~=6.0",
"pandas~=2.0",
"protobuf>=4.0",
Expand All @@ -48,6 +47,7 @@ Changelog = "https://github.com/sift-stack/sift/tree/main/python/CHANGELOG.md"
[project.optional-dependencies]
development = [
"grpcio-testing==1.13",
"npTDMS~=1.9",
"mypy==1.10.0",
"pyright==1.1.386",
"pytest==8.2.2",
Expand Down

0 comments on commit 6557f09

Please sign in to comment.