|
| 1 | +name: C++ w/B2 |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + paths: [".github/workflows/cpp_cmake.yml", "cpp/**"] |
| 7 | + pull_request: |
| 8 | + branches: ["main"] |
| 9 | + paths: [".github/workflows/cpp_cmake.yml", "cpp/**"] |
| 10 | + |
| 11 | +jobs: |
| 12 | + cpp-matrix: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + name: Generate Test Matrix |
| 15 | + outputs: |
| 16 | + matrix: ${{ steps.cpp-matrix.outputs.matrix }} |
| 17 | + steps: |
| 18 | + - name: Generate Test Matrix |
| 19 | + uses: alandefreitas/cpp-actions/cpp-matrix@master |
| 20 | + id: cpp-matrix |
| 21 | + with: |
| 22 | + compilers: | |
| 23 | + gcc >= 4.8 |
| 24 | + clang >= 3.9 |
| 25 | + msvc >= 14.0 |
| 26 | + apple-clang * |
| 27 | + mingw * |
| 28 | + clang-cl * |
| 29 | + standards: ">=11" |
| 30 | + latest-factors: | |
| 31 | + gcc Asan TSan UBSan |
| 32 | + clang BoundsSan IntSan |
| 33 | + factors: | |
| 34 | + gcc Shared |
| 35 | + msvc Shared x86 |
| 36 | + mingw Shared |
| 37 | + subrange-policy: | |
| 38 | + msvc: one-per-minor |
| 39 | + trace-commands: true |
| 40 | + |
| 41 | + build: |
| 42 | + needs: cpp-matrix |
| 43 | + strategy: |
| 44 | + fail-fast: false |
| 45 | + matrix: |
| 46 | + include: ${{ fromJSON(needs.cpp-matrix.outputs.matrix) }} |
| 47 | + name: ${{ matrix.name }} |
| 48 | + runs-on: ${{ matrix.runs-on }} |
| 49 | + container: ${{ matrix.container }} |
| 50 | + |
| 51 | + steps: |
| 52 | + # GitHub Actions no longer support older containers. |
| 53 | + # The workaround is to install our own Node.js for the actions. |
| 54 | + - name: Patch Node |
| 55 | + # The containers that need Node.js 20 will have volumes set up so that |
| 56 | + # the Node.js 20 installation can go there. |
| 57 | + if: ${{ matrix.container.volumes }} |
| 58 | + run: | |
| 59 | + set -x |
| 60 | + apt-get update |
| 61 | + apt-get install -y curl xz-utils |
| 62 | + curl -LO https://unofficial-builds.nodejs.org/download/release/v20.9.0/node-v20.9.0-linux-x64-glibc-217.tar.xz |
| 63 | + tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217 |
| 64 | + ldd /__e/node20/bin/node |
| 65 | +
|
| 66 | + - name: Setup C++ Compiler |
| 67 | + uses: alandefreitas/cpp-actions/setup-cpp@master |
| 68 | + id: setup-cpp |
| 69 | + with: |
| 70 | + compiler: ${{ matrix.compiler }} |
| 71 | + version: ${{ matrix.version }} |
| 72 | + |
| 73 | + - name: Install Packages |
| 74 | + if: matrix.install != '' |
| 75 | + uses: alandefreitas/cpp-actions/package-install@master |
| 76 | + id: package-install |
| 77 | + with: |
| 78 | + apt-get: ${{ matrix.install }} |
| 79 | + |
| 80 | + - name: Setup CMake |
| 81 | + uses: alandefreitas/cpp-actions/setup-cmake@master |
| 82 | + id: setup-cmake |
| 83 | + with: |
| 84 | + check-latest: true |
| 85 | + trace-commands: true |
| 86 | + |
| 87 | + - name: Clone Library |
| 88 | + uses: actions/checkout@master |
| 89 | + |
| 90 | + - name: Test |
| 91 | + uses: alandefreitas/cpp-actions/cmake-workflow@master |
| 92 | + with: |
| 93 | + source-dir: cpp |
| 94 | + cmake-path: ${{ steps.setup-cmake.path }} |
| 95 | + generator: ${{ matrix.generator }} |
| 96 | + generator-toolset: ${{ matrix.generator-toolset }} |
| 97 | + build-type: ${{ matrix.build-type }} |
| 98 | + run-tests: true |
| 99 | + cxxstd: ${{ matrix.cxxstd }} |
| 100 | + cc: ${{ steps.setup-cpp.outputs.cc }} |
| 101 | + ccflags: ${{ matrix.ccflags }} |
| 102 | + cxx: ${{ steps.setup-cpp.outputs.cxx }} |
| 103 | + cxxflags: ${{ matrix.cxxflags }} |
| 104 | + shared: ${{ matrix.shared }} |
| 105 | + extra-args: >- |
| 106 | + ${{ ( matrix.no-deps && '-D CPP_ACTIONS_NO_DEPS=ON' ) || '' }} |
| 107 | + export-compile-commands: ${{ matrix.time-trace }} |
| 108 | + package: true |
| 109 | + package-artifact: ${{ matrix.is-main }} |
| 110 | + trace-commands: true |
0 commit comments