Test C++17 build on x86-windows #184
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # 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: PR validation | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| cpp-build-windows: | |
| timeout-minutes: 120 | |
| name: Build CPP Client on ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| VCPKG_ROOT: '${{ github.workspace }}/vcpkg' | |
| INSTALL_DIR: 'C:\\pulsar-cpp' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: 'Windows x86' | |
| os: windows-2022 | |
| triplet: x86-windows-static | |
| suffix: 'windows-win32' | |
| generator: 'Visual Studio 17 2022' | |
| arch: '-A Win32' | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v3 | |
| - name: Restore vcpkg and its artifacts. | |
| uses: actions/cache@v3 | |
| id: vcpkg-cache | |
| with: | |
| path: | | |
| ${{ env.VCPKG_ROOT }} | |
| vcpkg_installed | |
| !${{ env.VCPKG_ROOT }}/.git | |
| !${{ env.VCPKG_ROOT }}/buildtrees | |
| !${{ env.VCPKG_ROOT }}/packages | |
| !${{ env.VCPKG_ROOT }}/downloads | |
| key: | | |
| ${{ runner.os }}-${{ matrix.triplet}}-${{ hashFiles( '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: | | |
| ${{ env.VCPKG_ROOT }}\vcpkg.exe install --triplet ${{ matrix.triplet }} | |
| - name: Configure | |
| shell: bash | |
| run: | | |
| if [ "$RUNNER_OS" == "Windows" ]; then | |
| cmake \ | |
| -B ./build-1 \ | |
| -G "${{ matrix.generator }}" ${{ matrix.arch }} \ | |
| -DUSE_ASIO=ON \ | |
| -DBUILD_TESTS=OFF \ | |
| -DVCPKG_TRIPLET="${{ matrix.triplet }}" \ | |
| -DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_DIR }}" \ | |
| -S . | |
| fi | |
| - name: Install | |
| shell: bash | |
| run: | | |
| if [ "$RUNNER_OS" == "Windows" ]; then | |
| cmake --build ./build-1 --config Release | |
| cmake --install ./build-1 | |
| fi | |
| - name: Test examples | |
| shell: bash | |
| run: | | |
| if [ "$RUNNER_OS" == "Windows" ]; then | |
| cd win-examples | |
| cmake \ | |
| -G "${{ matrix.generator }}" ${{ matrix.arch }} \ | |
| -DLINK_STATIC=OFF \ | |
| -DCMAKE_PREFIX_PATH=${{ env.INSTALL_DIR }} \ | |
| -B build-dynamic | |
| cmake --build build-dynamic --config Release | |
| cmake \ | |
| -G "${{ matrix.generator }}" ${{ matrix.arch }} \ | |
| -DLINK_STATIC=ON \ | |
| -DCMAKE_PREFIX_PATH=${{ env.INSTALL_DIR }} \ | |
| -B build-static | |
| cmake --build build-static --config Release | |
| ./build-static/Release/win-example.exe | |
| fi | |
| # Job that will be required to complete and depends on all the other jobs | |
| check-completion: | |
| name: Check Completion | |
| runs-on: ubuntu-latest | |
| needs: [cpp-build-windows] | |
| steps: | |
| - run: true |