diff --git a/.github/workflows/python_build.yaml b/.github/workflows/python_build.yaml new file mode 100644 index 00000000..dd3f09f7 --- /dev/null +++ b/.github/workflows/python_build.yaml @@ -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 diff --git a/python/pyproject.toml b/python/pyproject.toml index 1010474a..94e49e88 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -22,7 +22,6 @@ keywords = [ ] dependencies = [ "grpcio~=1.13", - "npTDMS~=1.9", "PyYAML~=6.0", "pandas~=2.0", "protobuf>=4.0", @@ -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",