|
| 1 | +name: C++ w/B2 |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + paths: [".github/workflows/cpp_b2.yml", "cpp/**"] |
| 7 | + pull_request: |
| 8 | + branches: ["main"] |
| 9 | + paths: [".github/workflows/cpp_b2.yml", "cpp/**"] |
| 10 | + |
| 11 | +env: |
| 12 | + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + # debug: |
| 16 | + # runs-on: ubuntu-latest |
| 17 | + # name: Debug Information |
| 18 | + # steps: |
| 19 | + # - name: Information |
| 20 | + # run: | |
| 21 | + # set -x |
| 22 | + # uname -a |
| 23 | + # docker ps |
| 24 | + |
| 25 | + cpp-matrix: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + name: Generate Test Matrix |
| 28 | + outputs: |
| 29 | + matrix: ${{ steps.cpp-matrix.outputs.matrix }} |
| 30 | + steps: |
| 31 | + - name: Generate Test Matrix |
| 32 | + uses: grafikrobot/cpp-actions/cpp-matrix@patch-1 |
| 33 | + id: cpp-matrix |
| 34 | + with: |
| 35 | + compilers: | |
| 36 | + gcc >= 4.8 |
| 37 | + clang >= 3.9 |
| 38 | + msvc >= 14.0 |
| 39 | + apple-clang * |
| 40 | + mingw * |
| 41 | + clang-cl * |
| 42 | + standards: ">=11" |
| 43 | + max-standards: 6 |
| 44 | + latest-factors: | |
| 45 | + gcc Asan TSan UBSan |
| 46 | + clang BoundsSan IntSan |
| 47 | + factors: | |
| 48 | + gcc Shared |
| 49 | + msvc Shared x86 |
| 50 | + mingw Shared |
| 51 | + subrange-policy: | |
| 52 | + msvc: one-per-minor |
| 53 | + trace-commands: true |
| 54 | + |
| 55 | + build: |
| 56 | + needs: cpp-matrix |
| 57 | + strategy: |
| 58 | + fail-fast: false |
| 59 | + matrix: |
| 60 | + include: ${{ fromJSON(needs.cpp-matrix.outputs.matrix) }} |
| 61 | + name: ${{ matrix.name }} |
| 62 | + runs-on: ${{ matrix.runs-on }} |
| 63 | + container: ${{ matrix.container }} |
| 64 | + |
| 65 | + steps: |
| 66 | + # GitHub Actions no longer support older containers. |
| 67 | + # The workaround is to install our own Node.js for the actions. |
| 68 | + - name: Patch Node |
| 69 | + # The containers that need Node.js 24 will have volumes set up so that |
| 70 | + # the Node.js 24 installation can go there. |
| 71 | + if: ${{ matrix.container.volumes }} |
| 72 | + run: | |
| 73 | + set -x |
| 74 | + apt-get update |
| 75 | + apt-get install -y curl xz-utils musl |
| 76 | + ln /lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1 |
| 77 | + curl -LO https://unofficial-builds.nodejs.org/download/release/v24.14.0/node-v24.14.0-linux-x64-musl.tar.xz |
| 78 | + ls -laF / |
| 79 | + tar -xf node-v24.14.0-linux-x64-musl.tar.xz --strip-components 1 -C /node24 |
| 80 | + ldd -v /node24/bin/node |
| 81 | + ldd -v /__e/node24/bin/node |
| 82 | +
|
| 83 | + - name: Setup C++ Compiler |
| 84 | + uses: alandefreitas/cpp-actions/setup-cpp@master |
| 85 | + id: setup-cpp |
| 86 | + with: |
| 87 | + compiler: ${{ matrix.compiler }} |
| 88 | + version: ${{ matrix.version }} |
| 89 | + |
| 90 | + - name: Install Packages |
| 91 | + if: matrix.install != '' |
| 92 | + uses: alandefreitas/cpp-actions/package-install@master |
| 93 | + id: package-install |
| 94 | + with: |
| 95 | + apt-get: ${{ matrix.install }} unzip wget |
| 96 | + |
| 97 | + - name: Setup B2 |
| 98 | + if: runner.os != 'Windows' |
| 99 | + env: |
| 100 | + B2_TOOLSET: ${{ matrix.b2-toolset }} |
| 101 | + CXX_PATH: ${{ steps.setup-cpp.outputs.cxx || '' }} |
| 102 | + shell: bash |
| 103 | + run: | |
| 104 | + set -e |
| 105 | + cd $HOME |
| 106 | + wget "https://github.com/bfgroup/b2/archive/release.zip" -O b2.zip |
| 107 | + unzip b2.zip |
| 108 | + cd b2-release |
| 109 | + ./bootstrap.sh |
| 110 | + ./b2 -d+2 install b2-install-layout=portable --prefix=/usr/local/bin |
| 111 | + echo "using ${B2_TOOLSET} : : ${CXX_PATH} ;" > ${HOME}/user-config.jam |
| 112 | +
|
| 113 | + - name: Setup B2 |
| 114 | + if: runner.os == 'Windows' |
| 115 | + env: |
| 116 | + B2_TOOLSET: ${{ matrix.b2-toolset }} |
| 117 | + CXX_PATH: ${{ steps.setup-cpp.outputs.cxx || '' }} |
| 118 | + shell: cmd |
| 119 | + run: | |
| 120 | + cd %HOME% |
| 121 | + git clone --branch=release --depth=1 https://github.com/bfgroup/b2.git |
| 122 | + cd b2 |
| 123 | + cmd.exe /c bootstrap.bat |
| 124 | + .\b2.exe -d+2 install b2-install-layout=portable |
| 125 | + echo "using %B2_TOOLSET% : : %CXX_PATH% ;" > %HOME%/user-config.jam |
| 126 | +
|
| 127 | + - name: Clone Library |
| 128 | + uses: actions/checkout@master |
| 129 | + |
| 130 | + - name: Test |
| 131 | + if: runner.os != 'Windows' |
| 132 | + env: |
| 133 | + B2_ARGS: >- |
| 134 | + ${{ matrix.b2-toolset && format('toolset={0}',matrix.b2-toolset) || '' }} |
| 135 | + ${{ matrix.build_dir && format('--build-dir={0}',matrix.build_dir) || '' }} |
| 136 | + ${{ matrix.address_model && format('address-model={0}',matrix.address_model) || '' }} |
| 137 | + ${{ matrix.cxxstd && format('cxxstd={0}',matrix.cxxstd) || '' }} |
| 138 | + ${{ matrix.build_type && format('variant={0}',matrix.build_type) || '' }} |
| 139 | + ${{ matrix.extra_args || '' }} |
| 140 | + ${{ matrix.threading && format('threading={0}',matrix.threading) || '' }} |
| 141 | + ${{ matrix.asan == true && 'address-sanitizer=on' || '' }} |
| 142 | + ${{ matrix.ubsan == true && 'undefined-sanitizer=on' || '' }} |
| 143 | + ${{ matrix.tsan == true && 'thread-sanitizer=on' || '' }} |
| 144 | + ${{ matrix.shared == true && 'link=shared' || 'link=static' }} |
| 145 | + ${{ matrix.runtime_link == true && 'runtime-link=shared' || 'link=static' }} |
| 146 | + shell: bash |
| 147 | + run: | |
| 148 | + set -e |
| 149 | + cd cpp |
| 150 | + b2 -d+2 --debug-configuration ${B2_ARGS} test |
| 151 | +
|
| 152 | + - name: Test |
| 153 | + if: runner.os == 'Windows' |
| 154 | + env: |
| 155 | + B2_ARGS: >- |
| 156 | + ${{ matrix.b2-toolset && format('toolset={0}',matrix.b2-toolset) || '' }} |
| 157 | + ${{ matrix.build_dir && format('--build-dir={0}',matrix.build_dir) || '' }} |
| 158 | + ${{ matrix.address_model && format('address-model={0}',matrix.address_model) || '' }} |
| 159 | + ${{ matrix.cxxstd && format('cxxstd={0}',matrix.cxxstd) || '' }} |
| 160 | + ${{ matrix.build_type && format('variant={0}',matrix.build_type) || '' }} |
| 161 | + ${{ matrix.extra_args || '' }} |
| 162 | + ${{ matrix.threading && format('threading={0}',matrix.threading) || '' }} |
| 163 | + ${{ matrix.asan == true && 'address-sanitizer=on' || '' }} |
| 164 | + ${{ matrix.ubsan == true && 'undefined-sanitizer=on' || '' }} |
| 165 | + ${{ matrix.tsan == true && 'thread-sanitizer=on' || '' }} |
| 166 | + ${{ matrix.shared == true && 'link=shared' || 'link=static' }} |
| 167 | + ${{ matrix.runtime_link == true && 'runtime-link=shared' || 'link=static' }} |
| 168 | + shell: cmd |
| 169 | + run: | |
| 170 | + cd cpp |
| 171 | + C:\b2\b2.exe -d+2 --debug-configuration %B2_ARGS% test |
0 commit comments