Boost, Eigen, and pybind11 with GitHub Actions

I am trying to add GitHub Actions to a repo that uses Boost, Eigen, and pybind11. A CMakeLists.txt and .yml sample files are below.

When I try to run the action I get two errors: On Linux CMake cannot find Boost and on Windows the installed version of Boost is 64 bits and so it fails on 32 bits Windows. The macOS version works fine.

So my questions are:

  1. How should I install Boost? I tried using the GitHub actions commented out on the .yml file and using Conda. On Linux I also tried with apt-get. What is your recommendations on how I should install Boost?

  2. How do I get CMake to be able to find Boost on Linux? I assume I have to set some environment variable to help CMake find Boost. How do I do that?

  3. On Windows how do I install a 64 bit Boost when running on 64 best and a 32 bits Boost when running on 32 bits?

cmake_minimum_required(VERSION 3.12)


cmake_policy(SET CMP0054 NEW)

  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /permissive-")


find_package(Boost COMPONENTS chrono thread serialization REQUIRED)

include_directories (

link_directories (

pybind11_add_module(_test test.cpp)

target_link_libraries (
  _test PRIVATE
  Boost::serialization )
name: Build wheels

      - master

  # Build wheels for macOS, Linux, and Windows
    name: Wheel for ${{ matrix.os }}-cp${{ matrix.python }}
    runs-on: ${{ matrix.os }}

      fail-fast: false
        os: [windows-latest, ubuntu-latest, macos-latest]
        python: [36, 37, 38, 39]

      # - name: Install boost
      #   uses: MarkusJx/install-boost@v2.0.0
      #   id: install-boost
      #   with:
      #     boost_version: 1.71.0
      #   if: runner.os == 'Windows'

      - name: Set up conda environment
        uses: conda-incubator/setup-miniconda@v2
          miniconda-version: "latest"
          auto-update-conda: true
          activate-environment: conda-env
        if: runner.os == 'Windows' || runner.os == 'Linux'

      - name: Install libraries for Windows
        run: |
          conda install -c conda-forge boost
          conda install -c conda-forge eigen
        shell: pwsh
        if: runner.os == 'Windows'

      - name: Install libraries for Linux
        run: |
          conda install -c conda-forge boost
          conda install -c conda-forge eigen
          # sudo apt-get update
          # sudo apt-get install libboost-all-dev
        shell: bash
        if: runner.os == 'Linux'

      - name: Install libraries for macOS
        run: |
          brew upgrade
          brew install boost
          brew install eigen
        shell: bash
        if: runner.os == 'macOS'

      - name: Checkout repository and submodules
        uses: actions/checkout@v2
          submodules: true

      - name: Set up Python
        uses: actions/setup-python@v2

      - name: Install cibuildwheel
        run: python -m pip install cibuildwheel

      - name: Build wheel
          python -m cibuildwheel --output-dir wheelhouse
          CIBW_BUILD: cp${{ matrix.python }}-*

      - name: Show files
        run: ls -lh wheelhouse
        shell: bash

      - name: Verify clean directory
        run: git diff --exit-code
        shell: bash

      - name: Upload artifacts
        uses: actions/upload-artifact@v2
          path: wheelhouse/*.whl