fix: MSVC compatibility for Windows CI #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: macOS (Clang) | |
| os: macos-latest | |
| cmake_args: "" | |
| build_args: "" | |
| - name: Linux (GCC) | |
| os: ubuntu-latest | |
| cmake_args: "-DGGML_METAL=OFF -DSAM3_METAL=OFF" | |
| build_args: "" | |
| - name: Windows (MSVC) | |
| os: windows-latest | |
| cmake_args: "-DGGML_METAL=OFF -DSAM3_METAL=OFF -A x64" | |
| build_args: "--config Release" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Ninja (Linux) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y ninja-build | |
| - name: Install Ninja (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install ninja | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@v1 | |
| with: | |
| key: ci-${{ matrix.os }} | |
| - name: Configure | |
| run: > | |
| cmake -B build | |
| ${{ runner.os != 'Windows' && '-G Ninja' || '' }} | |
| ${{ matrix.cmake_args }} | |
| ${{ runner.os != 'Windows' && '-DCMAKE_BUILD_TYPE=Release' || '' }} | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| - name: Build | |
| run: cmake --build build ${{ matrix.build_args }} --parallel | |
| - name: Verify library | |
| shell: bash | |
| run: | | |
| if [ -f build/libsam3.a ]; then | |
| echo "Found build/libsam3.a" | |
| elif [ -f build/Release/sam3.lib ]; then | |
| echo "Found build/Release/sam3.lib" | |
| elif [ -f build/sam3.lib ]; then | |
| echo "Found build/sam3.lib" | |
| else | |
| echo "ERROR: sam3 library not found" | |
| exit 1 | |
| fi |