From c185c8aaea6f78951bf17f678d4af64d7b760b51 Mon Sep 17 00:00:00 2001 From: tbeu Date: Wed, 7 Feb 2024 21:29:03 +0100 Subject: [PATCH] Build with CMake via GitHub Actions [ci skip] --- .github/workflows/cmake.yml | 81 +++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/cmake.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 00000000..554a768c --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,81 @@ +name: "Build with CMake" + +on: + push: + pull_request: + workflow_dispatch: + +defaults: + run: + shell: bash + +jobs: + build: + name: ${{ matrix.toolchain }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + toolchain: + - linux-gcc + - macos-clang + - windows-msvc + - windows-mingw + configuration: + - Release + python-version: + - 3.11 + include: + - toolchain: linux-gcc + os: ubuntu-latest + compiler: gcc + - toolchain: macos-clang + os: macos-latest + compiler: clang + - toolchain: windows-msvc + os: windows-latest + compiler: msvc + - toolchain: windows-mingw + os: windows-latest + compiler: mingw + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 5 + - name: Setup python environment + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install python packages + run: | + if [ "${{ matrix.os }}" == "macos-latest" ]; then + echo "/Users/runner/Library/Python/${{ matrix.python-version }}/bin" >> $GITHUB_PATH + fi + pip install --disable-pip-version-check --user "conan>=1.62.0,<2" + - name: Configure (${{ matrix.configuration }}) + run: | + if [ "${{ matrix.os }}" == "macos-latest" ]; then + echo "/Users/runner/Library/Python/${{ matrix.python-version }}/bin" >> $GITHUB_PATH + fi + if [ "${{ matrix.compiler }}" == "msvc" ]; then + cmake -S . -B build -DMATIO_USE_CONAN=ON -DMATIO_SHARED=OFF + elif [ "${{ matrix.compiler }}" == "mingw" ]; then + cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DMATIO_USE_CONAN=ON -DMATIO_SHARED=OFF -G "MinGW Makefiles" + else + cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DMATIO_USE_CONAN=ON -DMATIO_SHARED=OFF + fi + - name: Build libraries with ${{ matrix.compiler }} + run: | + if [ "${{ matrix.compiler }}" == "msvc" ]; then + cmake --build build --config ${{ matrix.configuration }} + else + cmake --build build -- -j8 + fi + - name: Test + run: | + ./build/bin/matdump -v -H + ./build/bin/matdump -V + ./build/bin/matdump -d ./share/test_file.mat structure + ./build/bin/matdump -v ./share/test_file.mat + ./build/bin/matdump -v -f whos ./share/test_file.mat