Skip to content

Build wheel files #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 149 additions & 0 deletions .github/workflows/ci-build-release-wheels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

name: Build release wheels
#on:
# push:
# tags:
# - '*'
# branches:
# - '*'
on:
pull_request:
branches: ['main']
push:
branches: ['*']

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

linux-wheel:
name: Wheel ${{matrix.image.name}} - Py ${{matrix.python.version}} - ${{matrix.cpu.platform}}
runs-on: ubuntu-22.04
timeout-minutes: 300

strategy:
fail-fast: false
matrix:
image:
- {name: 'manylinux2014', py_suffix: ''}
- {name: 'manylinux_musl', py_suffix: '-alpine'}
python:
- {version: '3.7', spec: 'cp37-cp37m'}
- {version: '3.8', spec: 'cp38-cp38'}
- {version: '3.9', spec: 'cp39-cp39'}
- {version: '3.10', spec: 'cp310-cp310'}
cpu:
- {arch: 'x86_64', platform: 'x86_64'}
- {arch: 'aarch64', platform: 'arm64'}

steps:
- name: checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- uses: docker/setup-buildx-action@v2
- run: build-support/copy-deps-versionfile.sh

- name: Build Manylinux Docker image
uses: docker/build-push-action@v3
with:
context: ./pkg/${{matrix.image.name}}
load: true
tags: build:latest
platforms: linux/${{matrix.cpu.arch}}
build-args: |
PLATFORM=${{matrix.cpu.platform}}
ARCH=${{matrix.cpu.arch}}
PYTHON_VERSION=${{matrix.python.version}}
PYTHON_SPEC=${{matrix.python.spec}}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build wheel file
run: |
docker run -i -v $PWD:/pulsar-client-python build:latest \
/pulsar-client-python/pkg/build-wheel-inside-docker.sh

- name: Test wheel file
run: |
docker run -i -v $PWD:/pulsar-client-python \
--platform linux/${{matrix.cpu.arch}} \
python:${{matrix.python.version}}${{matrix.image.py_suffix}} \
/pulsar-client-python/pkg/test-wheel.sh

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: wheel-${{matrix.image.name}}-py${{matrix.python.version}}-${{matrix.cpu.platform}}
path: wheelhouse/*.whl

mac-wheels:
name: Wheel MacOS Universal2 - Py ${{matrix.py.version}}
runs-on: macos-latest
timeout-minutes: 300

strategy:
fail-fast: false
matrix:
py:
- {version: '3.7', version_long: '3.7.14'}
- {version: '3.8', version_long: '3.8.13'}
- {version: '3.9', version_long: '3.9.14'}
- {version: '3.10', version_long: '3.10.7'}

steps:
- name: checkout
uses: actions/checkout@v3

- name: Dependencies cache
uses: actions/cache@v3
id: cache-deps
with:
path: .pulsar-mac-build/deps/install
key: ${{matrix.py.version_long}}-${{ hashFiles('dependencies.yaml') }}-${{ hashFiles('pkg/mac/*') }}

- name: Build dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: pkg/mac/build-dependencies.sh ${{matrix.py.version}} ${{matrix.py.version_long}}

- name: Pulsar C++ cache
uses: actions/cache@v3
id: cache-cpp
with:
path: .pulsar-mac-build/cpp/install
key: ${{ hashFiles('dependencies.yaml') }}-${{ hashFiles('pulsar-client-cpp-version.txt') }}-${{ hashFiles('pkg/mac/*') }}

- name: Build Pulsar C++ client
if: steps.cache-cpp.outputs.cache-hit != 'true'
run: pkg/mac/build-pulsar-cpp.sh

- name: Build and test Mac wheels
run: pkg/mac/build-mac-wheels.sh ${{matrix.py.version}}

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: wheel-mac-py${{matrix.py.version}}
path: dist/*.whl
94 changes: 93 additions & 1 deletion .github/workflows/ci-pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ name: PR validation
on:
pull_request:
branches: ['main']
push:
branches: ['*']

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -30,7 +32,7 @@ jobs:

unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 120

steps:
Expand Down Expand Up @@ -64,3 +66,93 @@ jobs:
- name: Stop Pulsar service
run: ./build-support/pulsar-test-service-stop.sh


linux-wheel:
name: Wheel ${{matrix.image.name}} - Py ${{matrix.python.version}} - ${{matrix.cpu.platform}}
runs-on: ubuntu-22.04
timeout-minutes: 300

strategy:
fail-fast: false
matrix:
image:
- {name: 'manylinux2014', py_suffix: ''}
- {name: 'manylinux_musl', py_suffix: '-alpine'}
python:
- {version: '3.10', spec: 'cp310-cp310'}
cpu:
- {arch: 'x86_64', platform: 'x86_64'}

steps:
- name: checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- uses: docker/setup-buildx-action@v2
- run: build-support/copy-deps-versionfile.sh

- name: Build Manylinux Docker image
uses: docker/build-push-action@v3
with:
context: ./pkg/${{matrix.image.name}}
load: true
tags: build:latest
platforms: linux/${{matrix.cpu.arch}}
build-args: |
PLATFORM=${{matrix.cpu.platform}}
ARCH=${{matrix.cpu.arch}}
PYTHON_VERSION=${{matrix.python.version}}
PYTHON_SPEC=${{matrix.python.spec}}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build wheel file
run: |
docker run -i -v $PWD:/pulsar-client-python build:latest \
/pulsar-client-python/pkg/build-wheel-inside-docker.sh

- name: Test wheel file
run: |
docker run -i -v $PWD:/pulsar-client-python python:${{matrix.python.version}}${{matrix.image.py_suffix}} \
/pulsar-client-python/pkg/test-wheel.sh

mac-wheels:
name: Wheel MacOS Universal2 - Py ${{matrix.py.version}}
runs-on: macos-latest
timeout-minutes: 300

strategy:
matrix:
py:
- {version: '3.10', version_long: '3.10.7'}

steps:
- name: checkout
uses: actions/checkout@v3

- name: Dependencies cache
uses: actions/cache@v3
id: cache-deps
with:
path: .pulsar-mac-build/deps/install
key: ${{matrix.py.version_long}}-${{ hashFiles('dependencies.yaml') }}-${{ hashFiles('pkg/mac/*') }}

- name: Build dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: pkg/mac/build-dependencies.sh ${{matrix.py.version}} ${{matrix.py.version_long}}

- name: Pulsar C++ cache
uses: actions/cache@v3
id: cache-cpp
with:
path: .pulsar-mac-build/cpp/install
key: ${{ hashFiles('dependencies.yaml') }}-${{ hashFiles('pulsar-client-cpp-version.txt') }}-${{ hashFiles('pkg/mac/*') }}

- name: Build Pulsar C++ client
if: steps.cache-cpp.outputs.cache-hit != 'true'
run: pkg/mac/build-pulsar-cpp.sh

- name: Build and test Mac wheels
run: pkg/mac/build-mac-wheels.sh ${{matrix.py.version}}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ cmake_install.cmake
__pycache__
.build
.pulsar-mac-wheels-cache
.DS_Store
.DS_Store
wheelhouse
.pulsar-mac-build
Loading