|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: [ push, pull_request, workflow_dispatch ] |
| 4 | + |
| 5 | +jobs: |
| 6 | + build: |
| 7 | + runs-on: ${{ matrix.os }} |
| 8 | + strategy: |
| 9 | + fail-fast: false |
| 10 | + matrix: |
| 11 | + os: [ ubuntu-20.04, windows-latest ] |
| 12 | + buildType: [ RelWithDebInfo ] |
| 13 | + include: |
| 14 | + - os: ubuntu-20.04 |
| 15 | + # QPID-8606: we don't support swig 4.0, it produces runtime errors when used |
| 16 | + cmake_extra: '-DSWIG_EXECUTABLE="/usr/bin/swig3.0" -DRUBY_EXECUTABLE="/usr/bin/ruby2.6"' |
| 17 | + - os: windows-latest |
| 18 | + cmake_extra: '-DBUILD_BINDING_DOTNET=OFF -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake' |
| 19 | + env: |
| 20 | + BuildType: ${{matrix.buildType}} |
| 21 | + BuildDir: ${{github.workspace}}/BLD |
| 22 | + InstallPrefix: ${{github.workspace}}/INSTALL |
| 23 | + PKG_CONFIG_PATH: ${{matrix.pkg_config_path}} |
| 24 | + VCPKG_DEFAULT_TRIPLET: x64-windows |
| 25 | + VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite' |
| 26 | + SCCACHE_DIR: ${{github.workspace}}/SCCACHE |
| 27 | + |
| 28 | + steps: |
| 29 | + |
| 30 | + - uses: actions/checkout@v3 |
| 31 | + |
| 32 | + - name: Setup python |
| 33 | + uses: actions/setup-python@v4 |
| 34 | + with: |
| 35 | + python-version: 2.7 |
| 36 | + architecture: x64 |
| 37 | + |
| 38 | + - name: Setup Developer Command Prompt (on Windows) |
| 39 | + uses: ilammy/msvc-dev-cmd@v1 |
| 40 | + if: runner.os == 'Windows' |
| 41 | + with: |
| 42 | + arch: x64 |
| 43 | + |
| 44 | + # it's weird that it needs qpid-python for tests; one would guess this is built in this repo, but it is not |
| 45 | + - name: Install python dependencies |
| 46 | + run: | |
| 47 | + python -m pip install --upgrade pip |
| 48 | + python -m pip install setuptools qpid-python |
| 49 | +
|
| 50 | + - name: Install Linux dependencies |
| 51 | + if: runner.os == 'Linux' |
| 52 | + run: | |
| 53 | + # ubuntu packages (https://packages.ubuntu.com/source/focal/qpid-proton) don't carry ProtonConfig.cmake |
| 54 | + # the `testing` ppa is less likely to be out-of-date |
| 55 | + sudo add-apt-repository ppa:qpid/testing && sudo apt-get update |
| 56 | +
|
| 57 | + # https://github.com/swig/swig/issues/1689 |
| 58 | + # swig3.0 in focal does not work well with ruby2.7 |
| 59 | + sudo apt-add-repository ppa:brightbox/ruby-ng && sudo apt-get update |
| 60 | +
|
| 61 | + sudo apt-get -yq --no-install-suggests --no-install-recommends install \ |
| 62 | + cmake ninja-build \ |
| 63 | + libboost-dev libboost-program-options-dev libboost-system-dev libboost-test-dev \ |
| 64 | + libxqilla-dev libxerces-c-dev \ |
| 65 | + libibverbs-dev librdmacm-dev \ |
| 66 | + libdb++-dev libaio-dev \ |
| 67 | + libqpid-proton11-dev libqpid-proton-core10 libqpid-proton-proactor1 \ |
| 68 | + swig3.0 python-dev ruby2.6 ruby2.6-dev \ |
| 69 | + uuid-dev libnss3-dev libnss3-tools libsasl2-dev sasl2-bin \ |
| 70 | + valgrind |
| 71 | +
|
| 72 | + sccache_version=v0.4.1 |
| 73 | + wget -q https://github.com/mozilla/sccache/releases/download/${sccache_version}/sccache-${sccache_version}-x86_64-unknown-linux-musl.tar.gz |
| 74 | + tar -xf sccache-${sccache_version}-x86_64-unknown-linux-musl.tar.gz sccache-${sccache_version}-x86_64-unknown-linux-musl/sccache |
| 75 | + sudo mv sccache-${sccache_version}-x86_64-unknown-linux-musl/sccache /usr/bin/sccache |
| 76 | + sudo chmod +x /usr/bin/sccache |
| 77 | + shell: bash |
| 78 | + |
| 79 | + - name: Cache scoop (on Windows) |
| 80 | + uses: actions/cache@v3 |
| 81 | + if: runner.os == 'Windows' |
| 82 | + with: |
| 83 | + path: ~\scoop |
| 84 | + key: ${{ runner.os }}-scoop-${{ env.OS_VER }}-${{ hashFiles('.github/workflows/build.yml') }} |
| 85 | + restore-keys: | |
| 86 | + ${{ runner.os }}-scoop-${{ env.OS_VER }}- |
| 87 | + ${{ runner.os }}-scoop- |
| 88 | +
|
| 89 | + - name: Cache vcpkg/downloads (on Windows) |
| 90 | + uses: actions/cache@v3 |
| 91 | + if: runner.os == 'Windows' |
| 92 | + with: |
| 93 | + path: C:\vcpkg\downloads |
| 94 | + key: ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}-${{ hashFiles('.github/workflows/build.yml') }} |
| 95 | + restore-keys: | |
| 96 | + ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}- |
| 97 | + ${{ runner.os }}-vcpkg-download- |
| 98 | + - name: Cache vcpkg/installed (on Windows) |
| 99 | + uses: actions/cache@v3 |
| 100 | + if: runner.os == 'Windows' |
| 101 | + with: |
| 102 | + path: C:\vcpkg\installed |
| 103 | + key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}-${{ hashFiles('.github/workflows/build.yml') }} |
| 104 | + restore-keys: | |
| 105 | + ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}- |
| 106 | + ${{ runner.os }}-vcpkg-installed- |
| 107 | +
|
| 108 | + - name: Cache SCCACHE_DIR |
| 109 | + uses: actions/cache@v3 |
| 110 | + with: |
| 111 | + path: "${{ env.SCCACHE_DIR }}" |
| 112 | + key: ${{ runner.os }}-sccache-${{ matrix.os }}-${{ github.sha }} |
| 113 | + restore-keys: | |
| 114 | + ${{ runner.os }}-sccache-${{ matrix.os }}- |
| 115 | + ${{ runner.os }}-sccache- |
| 116 | +
|
| 117 | + - name: Install Windows dependencies |
| 118 | + if: runner.os == 'Windows' |
| 119 | + run: | |
| 120 | + Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional: Needed to run a remote script the first time |
| 121 | + iex "& {$(irm get.scoop.sh)} -RunAsAdmin" |
| 122 | + scoop install sccache |
| 123 | +
|
| 124 | + vcpkg install boost-program-options boost-system boost-test boost-date-time boost-thread boost-chrono boost-format boost-ptr-container boost-assign boost-parameter boost-foreach boost-utility |
| 125 | + vcpkg integrate install |
| 126 | +
|
| 127 | + # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#add-a-system-path-add-path |
| 128 | + Add-Content ${env:GITHUB_PATH} "${HOME}/scoop/shims" |
| 129 | + |
| 130 | + # work around assumptions in our build scripts about boost libs layout |
| 131 | + Copy-Item -Path C:/vcpkg/installed/x64-windows/debug/bin/* -Include *.dll -Destination C:/vcpkg/installed/x64-windows/debug/lib |
| 132 | + Get-Item C:/vcpkg/installed/x64-windows/debug/lib/*.dll | Rename-Item -NewName { $_.Name -replace '-vc14.-mt-gd-x64-1_81.dll','-vc140-mt-gd.dll' } |
| 133 | + # display results of this hard work |
| 134 | + ls C:/vcpkg/installed/x64-windows/debug/bin/ |
| 135 | + ls C:/vcpkg/installed/x64-windows/debug/lib/ |
| 136 | + # now do the same for release |
| 137 | + Copy-Item -Path C:/vcpkg/installed/x64-windows/bin/* -Include *.dll -Destination C:/vcpkg/installed/x64-windows/lib |
| 138 | + Get-Item C:/vcpkg/installed/x64-windows/lib/*.dll | Rename-Item -NewName { $_.Name -replace '-vc14.-mt-x64-1_81.dll','-vc140-mt.dll' } |
| 139 | + # display results of this hard work |
| 140 | + ls C:/vcpkg/installed/x64-windows/bin/ |
| 141 | + ls C:/vcpkg/installed/x64-windows/lib/ |
| 142 | + shell: pwsh |
| 143 | + |
| 144 | + # Windows build should ideally use something like '-G "Visual Studio 16 2019" -A x64', |
| 145 | + # but -DCMAKE_C_COMPILER_LAUNCHER is only supported by make and ninja generators |
| 146 | + # https://devblogs.microsoft.com/scripting/powertip-line-continuation-in-powershell/ |
| 147 | + - name: cmake configure |
| 148 | + run: | |
| 149 | + cmake -S "${{github.workspace}}" -B "${{env.BuildDir}}" -G Ninja ` |
| 150 | + -DCMAKE_C_COMPILER_LAUNCHER="sccache" -DCMAKE_CXX_COMPILER_LAUNCHER="sccache" ` |
| 151 | + "-DCMAKE_BUILD_TYPE=${{env.BuildType}}" ` |
| 152 | + "-DCMAKE_INSTALL_PREFIX=${{env.InstallPrefix}}" ` |
| 153 | + ${{matrix.cmake_extra}} |
| 154 | + shell: pwsh |
| 155 | + |
| 156 | + # https://stackoverflow.com/a/46187862/1047788 |
| 157 | + # https://github.com/jiridanek/qpid-cpp/actions/runs/3314156604/jobs/5473066487#step:12:1472 |
| 158 | + - name: cmake build/install |
| 159 | + run: | |
| 160 | + cmake --build "${{env.BuildDir}}" --config ${{env.BuildType}} -- -v |
| 161 | + cmake --install "${{env.BuildDir}}" --config ${{env.BuildType}} |
| 162 | + shell: pwsh |
| 163 | + |
| 164 | + - id: ctest |
| 165 | + name: ctest |
| 166 | + working-directory: ${{env.BuildDir}} |
| 167 | + run: PYTHONPATH=${InstallPrefix}/lib/python2.7/site-packages ctest -C ${BuildType} -V -T Test --no-compress-output ${{matrix.ctest_extra}} |
| 168 | + shell: bash |
| 169 | + |
| 170 | + - name: Upload Test results |
| 171 | + if: always() && (steps.ctest.outcome == 'failure' || steps.ctest.outcome == 'success') |
| 172 | + uses: actions/upload-artifact@v3 |
| 173 | + with: |
| 174 | + name: Test_Results_${{matrix.os}}_${{matrix.buildType}} |
| 175 | + path: ${{env.BuildDir}}/Testing/**/*.xml |
| 176 | + |
| 177 | + - name: Environment |
| 178 | + if: always() |
| 179 | + run: env -0 | sort -z | tr '\0' '\n' |
| 180 | + shell: bash |
0 commit comments