MarkusJx / install-boost

Install boost on Github actions
MIT License
62 stars 3 forks source link

question: how to use this action when you have an OS matrix? #30

Closed Ravenwater closed 1 year ago

Ravenwater commented 1 year ago

My actions cover the os matrix [windows-latest, macos-latest, ubuntu-latest]

how do I use this action to support such a matrix OS workflow?

MarkusJx commented 1 year ago

The easiest way to accomplish this would be to use multiple matrix configurations:

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - os: ubuntu-22.04 # You should explicitly set the os version
            toolset: gcc     # The default toolset (this is explained in the readme)
            version: 22.04   # The reason why you should set the os version
          - os: windows-latest
            toolset: msvc
            version: 2022
          - os: macos-11
            toolset: clang
            version: 11

    steps:
      - uses: actions/checkout@v3
      - name: Install boost
        uses: MarkusJx/install-boost@v2
        id: install-boost
        with:
          boost_version: 1.79.0
          platform_version: ${{matrix.version}}
          toolset: ${{matrix.toolset}}
      # Now you can continue as usual

You can also check my test-cmake workflow, which works in the same way.

Ravenwater commented 1 year ago

What am I doing wrong here? image

MarkusJx commented 1 year ago

So this doesn't work as I thought, interesting. Just replace the version with the latest:

- name: Install boost
  uses: MarkusJx/install-boost@v2.4.3
Ravenwater commented 1 year ago

ok, that is looking good: image

Now I am getting an error that cmake findpackage can't find boost because of a missing environment var: image

This is code I am trying to revive after half a decade of neglect so this could be entirely my fault, but what is the design of 'install-boost' with respect to using findpackage to pick it up?

MarkusJx commented 1 year ago

As documented in the Readme, just pass the boost root environment variable to the cmake configure step:

- name: Configure CMake
  run: cmake . -DCMAKE_BUILD_TYPE=$BUILD_TYPE -B build
  env:
      BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}

If that doesn't work, pass the path to the include and library directories:

- name: Configure CMake
  run: |
      cmake . -DCMAKE_BUILD_TYPE=$BUILD_TYPE -B build\
      -DBoost_INCLUDE_DIR=${{steps.install-boost.outputs.BOOST_ROOT}}/include\
      -DBoost_LIBRARY_DIRS=${{steps.install-boost.outputs.BOOST_ROOT}}/lib
  env:
      BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
Ravenwater commented 1 year ago

@MarkusJx thank you, thank you, thank you.

I still have a configuration issue on my side, so can't claim victory yet, but wanted to let you know that I am over the hump. Thank you for your amazing customer orientation both in anticipating the need and the knowledge shared. This work is inspirational.

Ravenwater commented 1 year ago

yay, success!

image

MarkusJx commented 1 year ago

Great to hear!

And if you encounter any (further) issues with this action, feel free to open another issue :)