blob: 0d16a1b4cd14a50496f19cc935963bffe1b843f1 [file] [log] [blame]
#
# 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: CI - CPP build
on:
pull_request:
branches:
- master
- branch-2.11
paths:
- '.github/workflows/**'
- 'pulsar-client-cpp/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changed_files_job:
name: Preconditions
runs-on: ubuntu-20.04
outputs:
docs_only: ${{ needs.changed_files_job.outputs.docs_only }}
cpp_only: ${{ needs.changed_files_job.outputs.cpp_only }}
steps:
- name: checkout
uses: actions/checkout@v2
- name: Detect changed files
id: changes
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv
- name: Check changed files
id: check_changes
run: |
echo "::set-output name=docs_only::${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.docs_count) && fromJSON(steps.changes.outputs.docs_count) > 0 }}"
- name: Check if the PR has been approved for testing
if: ${{ steps.check_changes.outputs.docs_only != 'true' && github.repository == 'apache/pulsar' && github.event_name == 'pull_request' }}
env:
GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }}
GITHUB_TOKEN: ${{ github.token }}
run: |
build/pulsar_ci_tool.sh check_ready_to_test
cpp-build-centos7:
needs: changed_files_job
name: Build CPP Client on CentOS7
runs-on: ubuntu-20.04
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
timeout-minutes: 120
steps:
- name: checkout
uses: actions/checkout@v2
- name: Tune Runner VM
uses: ./.github/actions/tune-runner-vm
- name: build cpp client on centos 7
run: |
echo "Build C++ client library on CentOS 7"
pulsar-client-cpp/docker-build-centos7.sh
cpp-build-windows:
needs: changed_files_job
timeout-minutes: 120
name: Build CPP Client on ${{ matrix.name }}
runs-on: ${{ matrix.os }}
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
env:
VCPKG_ROOT: '${{ github.workspace }}/vcpkg'
strategy:
fail-fast: false
matrix:
include:
- name: 'Windows x64'
os: windows-2022
triplet: x64-windows
vcpkg_dir: 'C:\vcpkg'
suffix: 'windows-win64'
generator: 'Visual Studio 17 2022'
arch: '-A x64'
- name: 'Windows x86'
os: windows-2022
triplet: x86-windows
vcpkg_dir: 'C:\vcpkg'
suffix: 'windows-win32'
generator: 'Visual Studio 17 2022'
arch: '-A Win32'
steps:
- name: checkout
uses: actions/checkout@v2
- name: Restore vcpkg and its artifacts.
uses: actions/cache@v2
id: vcpkg-cache
with:
path: |
${{ env.VCPKG_ROOT }}
pulsar-client-cpp/vcpkg_installed
!${{ env.VCPKG_ROOT }}/.git
!${{ env.VCPKG_ROOT }}/buildtrees
!${{ env.VCPKG_ROOT }}/packages
!${{ env.VCPKG_ROOT }}/downloads
key: |
${{ runner.os }}-${{ matrix.triplet}}-${{ hashFiles( 'pulsar-client-cpp/vcpkg.json' ) }}
- name: Get vcpkg(windows)
if: ${{ runner.os == 'Windows' && steps.vcpkg-cache.outputs.cache-hit != 'true' }}
run: |
cd ${{ github.workspace }}
mkdir build -force
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
- name: remove system vcpkg(windows)
if: runner.os == 'Windows'
run: rm -rf "$VCPKG_INSTALLATION_ROOT"
shell: bash
- name: Install vcpkg packages
run: |
cd pulsar-client-cpp && ${{ env.VCPKG_ROOT }}\vcpkg.exe install --triplet ${{ matrix.triplet }}
- name: Configure (default)
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cd pulsar-client-cpp && \
cmake \
-B ./build-0 \
-G "${{ matrix.generator }}" ${{ matrix.arch }} \
-DBUILD_PYTHON_WRAPPER=OFF -DBUILD_TESTS=OFF \
-DVCPKG_TRIPLET=${{ matrix.triplet }} \
-DCMAKE_BUILD_TYPE=Release \
-S .
fi
- name: Compile
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cd pulsar-client-cpp && \
cmake --build ./build-0 --parallel --config Release
fi
- name: Configure (dynamic library only)
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cd pulsar-client-cpp && \
cmake \
-B ./build-1 \
-G "${{ matrix.generator }}" ${{ matrix.arch }} \
-DBUILD_PYTHON_WRAPPER=OFF -DBUILD_TESTS=OFF \
-DVCPKG_TRIPLET=${{ matrix.triplet }} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_STATIC_LIB=OFF \
-S .
fi
- name: Compile
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cd pulsar-client-cpp && \
cmake --build ./build-1 --parallel --config Release
fi
cpp-deb-rpm-packaging:
needs: changed_files_job
name: Build CPP Client on RPM
runs-on: ubuntu-20.04
timeout-minutes: 120
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
steps:
- name: checkout
uses: actions/checkout@v2
- name: Tune Runner VM
uses: ./.github/actions/tune-runner-vm
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/pulsar
key: ${{ runner.os }}-m2-dependencies-core-modules-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17
- name: clean disk
run: |
sudo apt clean
docker rmi $(docker images -q) -f
df -h
- name: Package Pulsar source
run: mvn -B -ntp -q clean package -pl pulsar-client-api -am -DskipTests
- name: Build Debian packages
run: |
echo "Build Debian packages"
BUILD_IMAGE=1 pulsar-client-cpp/pkg/deb/docker-build-deb.sh
- name: Build RPM packages
run: |
echo "Build RPM packages"
BUILD_IMAGE=1 pulsar-client-cpp/pkg/rpm/docker-build-rpm.sh
build-python-wheel:
needs: changed_files_job
name: Build Python Client
runs-on: ubuntu-20.04
timeout-minutes: 120
if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }}
steps:
- name: checkout
uses: actions/checkout@v2
- name: Tune Runner VM
uses: ./.github/actions/tune-runner-vm
- name: build python3.9 client
run: |
echo "Build Python3.9 client library"
pulsar-client-cpp/docker-build-python3.9.sh