blob: e507e5a5decabaa142f88ce268c16c080b80a719 [file] [log] [blame]
name: Build
on: [ push, pull_request, workflow_dispatch ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, windows-latest ]
# https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
python-version: [ "2.7", "3.8" ]
buildType: [ RelWithDebInfo ]
include:
- os: ubuntu-20.04
# QPID-8606: we don't support swig 4.0, it produces runtime errors when used
cmake_extra: '-DSWIG_EXECUTABLE="/usr/bin/swig3.0" -DRUBY_EXECUTABLE="/usr/bin/ruby2.6"'
- os: windows-latest
cmake_extra: '-DBUILD_BINDING_DOTNET=OFF -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake'
env:
BuildType: ${{matrix.buildType}}
BuildDir: ${{github.workspace}}/BLD
InstallPrefix: ${{github.workspace}}/INSTALL
PKG_CONFIG_PATH: ${{matrix.pkg_config_path}}
VCPKG_DEFAULT_TRIPLET: x64-windows
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
SCCACHE_DIR: ${{github.workspace}}/SCCACHE
steps:
- uses: actions/checkout@v3
# Python 2.7 was removed from actions/setup-python https://github.com/actions/setup-python/issues/672
- name: Set up Python ${{ matrix.python-version }}
if: matrix.python-version != '2.7'
uses: actions/setup-python@v4
id: setup-python
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Set up Python ${{ matrix.python-version }}
if: matrix.python-version == '2.7' && matrix.os == 'ubuntu-20.04'
run: |
sudo apt install -y python2
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo python2 get-pip.py
id: apt-install-python
- name: Set up Python ${{ matrix.python-version }}
if: matrix.python-version == '2.7' && matrix.os == 'windows-latest'
run: |
choco install python2
id: choco-install-python
shell: pwsh
- name: Configure steps.python.outputs
run: |
if (Test-Path "${{ steps.setup-python.outputs.python-path }}") {
"python-path=${{ steps.setup-python.outputs.python-path }}" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
} elseif (Test-Path C:/Python27/python.exe) {
"python-path=C:/Python27/python.exe" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
} else {
"python-path=/usr/bin/python2.7" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
}
id: python
shell: pwsh
# Cannot use https://github.com/ilammy/msvc-dev-cmd/blob/a742a854f54111d83b78e97091b5d85ccdaa3e89/index.js#L163
# as (unapproved) 3rd party GitHub Actions are forbidden on Apache org projects
# https://github.com/microsoft/vswhere
# https://github.com/microsoft/vswhere/blob/c7a417bfb46cd6a1c3e31a91ba51193d7659b6f8/src/vswhere.lib/vswhere.lib.rc#L77
# https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt#using-powershell
# https://renenyffenegger.ch/notes/Windows/dirs/Program-Files-x86/Microsoft-Visual-Studio/version/edition/Common7/Tools/VsDevCmd_bat
# https://renenyffenegger.ch/notes/Windows/dirs/Program-Files-x86/Microsoft-Visual-Studio/version/edition/VC/Auxiliary/Build/vcvarsall_bat
- name: Setup Developer Command Prompt environment (on Windows)
if: runner.os == 'Windows'
run: |
$installationPath = vswhere.exe -prerelease -latest -property installationPath
if ($installationPath -and (test-path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -no_logo -arch=x64 && set" | foreach-object {
$name, $value = $_ -split '=', 2
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
Add-Content ${env:GITHUB_ENV} "${name}=${value}"
}
}
shell: pwsh
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
# ubuntu packages (https://packages.ubuntu.com/source/focal/qpid-proton) don't carry ProtonConfig.cmake
# the `testing` ppa is less likely to be out-of-date
sudo add-apt-repository ppa:qpid/testing && sudo apt-get update
# https://github.com/swig/swig/issues/1689
# swig3.0 in focal does not work well with ruby2.7
sudo apt-add-repository ppa:brightbox/ruby-ng && sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends install \
cmake ninja-build \
libboost-dev libboost-program-options-dev libboost-system-dev libboost-test-dev \
libxqilla-dev libxerces-c-dev \
libibverbs-dev librdmacm-dev \
libdb++-dev libaio-dev \
libqpid-proton11-dev libqpid-proton-core10 libqpid-proton-proactor1 \
swig3.0 ruby2.6 ruby2.6-dev \
uuid-dev libnss3-dev libnss3-tools libsasl2-dev sasl2-bin \
valgrind
sccache_version=v0.4.1
wget -q https://github.com/mozilla/sccache/releases/download/${sccache_version}/sccache-${sccache_version}-x86_64-unknown-linux-musl.tar.gz
tar -xf sccache-${sccache_version}-x86_64-unknown-linux-musl.tar.gz sccache-${sccache_version}-x86_64-unknown-linux-musl/sccache
sudo mv sccache-${sccache_version}-x86_64-unknown-linux-musl/sccache /usr/bin/sccache
sudo chmod +x /usr/bin/sccache
shell: bash
- name: Install python dependencies
run: |
${{ steps.python.outputs.python-path }} -m pip install --upgrade pip
${{ steps.python.outputs.python-path }} -m pip install setuptools
- name: Fetch qpid-python from git
if: matrix.python-version != '2.7'
uses: actions/checkout@v3
with:
repository: apache/qpid-python
ref: main
path: qpid-python
# We require qpid-python, which is a python2-only library, to run broker tests
- name: Install qpid-python (released version)
if: matrix.python-version == '2.7'
run: |
${{ steps.python.outputs.python-path }} -m pip install qpid-python
- name: Install qpid-python (git version)
if: matrix.python-version != '2.7'
run: |
cd qpid-python
${{ steps.python.outputs.python-path }} setup.py install
- name: Cache scoop (restore) (on Windows)
uses: actions/cache/restore@v3
id: restore-scoop-cache
if: runner.os == 'Windows'
with:
path: ~\scoop
key: ${{ runner.os }}-scoop-${{ env.OS_VER }}-${{ hashFiles('.github/workflows/build.yml') }}
restore-keys: |
${{ runner.os }}-scoop-${{ env.OS_VER }}-
${{ runner.os }}-scoop-
- name: Cache vcpkg/downloads and vcpkg/installed (restore) (on Windows)
uses: actions/cache/restore@v3
id: restore-vcpkg-cache
if: runner.os == 'Windows'
with:
path: |
C:\vcpkg\downloads
C:\vcpkg\installed
key: ${{ runner.os }}-vcpkg-${{ env.OS_VER }}-${{ hashFiles('.github/workflows/build.yml') }}
restore-keys: |
${{ runner.os }}-vcpkg-${{ env.OS_VER }}-
${{ runner.os }}-vcpkg-
- name: Install Windows dependencies
if: runner.os == 'Windows'
run: |
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional: Needed to run a remote script the first time
iex "& {$(irm get.scoop.sh)} -RunAsAdmin"
scoop install sccache
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
vcpkg integrate install
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#add-a-system-path-add-path
Add-Content ${env:GITHUB_PATH} "${HOME}/scoop/shims"
shell: pwsh
- name: Cache scoop (save) (on Windows)
uses: actions/cache/save@v3
if: runner.os == 'Windows'
with:
path: ~\scoop
key: ${{ steps.restore-scoop-cache.outputs.cache-primary-key }}
- name: Cache vcpkg/downloads and vcpkg/installed (save) (on Windows)
uses: actions/cache/save@v3
if: runner.os == 'Windows'
with:
path: |
C:\vcpkg\downloads
C:\vcpkg\installed
key: ${{ steps.restore-vcpkg-cache.outputs.cache-primary-key }}
# don't save this into the vcpkg cache
- name: Copy over Boost DLLs to where we expect them
if: runner.os == 'Windows'
run: |
# work around assumptions in our build scripts about boost libs layout
Copy-Item -Path C:/vcpkg/installed/x64-windows/debug/bin/* -Include *.dll -Destination C:/vcpkg/installed/x64-windows/debug/lib
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' }
# display results of this hard work
ls C:/vcpkg/installed/x64-windows/debug/bin/
ls C:/vcpkg/installed/x64-windows/debug/lib/
# now do the same for release
Copy-Item -Path C:/vcpkg/installed/x64-windows/bin/* -Include *.dll -Destination C:/vcpkg/installed/x64-windows/lib
Get-Item C:/vcpkg/installed/x64-windows/lib/*.dll | Rename-Item -NewName { $_.Name -replace '-vc14.-mt-x64-1_81.dll','-vc140-mt.dll' }
# display results of this hard work
ls C:/vcpkg/installed/x64-windows/bin/
ls C:/vcpkg/installed/x64-windows/lib/
shell: pwsh
- name: Cache SCCACHE_DIR (restore)
uses: actions/cache/restore@v3
id: restore-sccache-cache
with:
path: "${{ env.SCCACHE_DIR }}"
key: ${{ runner.os }}-sccache-${{ matrix.os }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-sccache-${{ matrix.os }}-
${{ runner.os }}-sccache-
# Windows build should ideally use something like '-G "Visual Studio 16 2019" -A x64',
# but -DCMAKE_C_COMPILER_LAUNCHER is only supported by make and ninja generators
# https://devblogs.microsoft.com/scripting/powertip-line-continuation-in-powershell/
- name: cmake configure
run: |
cmake -S "${{github.workspace}}" -B "${{env.BuildDir}}" -G Ninja `
-DCMAKE_C_COMPILER_LAUNCHER="sccache" -DCMAKE_CXX_COMPILER_LAUNCHER="sccache" `
"-DCMAKE_BUILD_TYPE=${{env.BuildType}}" `
"-DCMAKE_INSTALL_PREFIX=${{env.InstallPrefix}}" `
"-DPYTHON_EXECUTABLE=${{ steps.python.outputs.python-path }}" `
${{matrix.cmake_extra}}
shell: pwsh
# https://stackoverflow.com/a/46187862/1047788
# https://github.com/jiridanek/qpid-cpp/actions/runs/3314156604/jobs/5473066487#step:12:1472
- name: cmake build/install
run: |
cmake --build "${{env.BuildDir}}" --config ${{env.BuildType}} -- -v
cmake --install "${{env.BuildDir}}" --config ${{env.BuildType}}
shell: pwsh
- name: Cache SCCACHE_DIR (save)
uses: actions/cache/save@v3
with:
path: "${{ env.SCCACHE_DIR }}"
key: ${{ steps.restore-sccache-cache.outputs.cache-primary-key }}
- id: ctest
name: ctest
working-directory: ${{env.BuildDir}}
run: PYTHONPATH=${InstallPrefix}/lib/python${{ matrix.python-version }}/site-packages ctest -C ${BuildType} -V -T Test --no-compress-output ${{matrix.ctest_extra}}
shell: bash
- name: Upload Test results
if: always() && (steps.ctest.outcome == 'failure' || steps.ctest.outcome == 'success')
uses: actions/upload-artifact@v3
with:
name: Test_Results_${{matrix.os}}_${{matrix.buildType}}
path: ${{env.BuildDir}}/Testing/**/*.xml
- name: Environment
if: always()
run: env -0 | sort -z | tr '\0' '\n'
shell: bash