Skip to content

[FIX] Fix Errors in README #42

[FIX] Fix Errors in README

[FIX] Fix Errors in README #42

name: "[CI] Build and Test"
on:
pull_request:
branches: [ "main" ]
jobs:
build_and_test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release]
c_compiler: [gcc, clang, cl]
# [TODO] Enable CUDA test
project_type: [0, 1]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl
steps:
- name: Checkout PR source branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: "[Linux] Install Ninja"
if: runner.os == 'Linux'
run: sudo apt-get install ninja-build
- name: "[Linux] Install VCPKG"
if: runner.os == 'Linux'
shell: bash
run: |
git clone https://github.com/microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh
echo "VCPKG_ROOT=$(pwd)/vcpkg" >> $GITHUB_ENV
- name: "[Windows] Install VCPKG"
if: runner.os == 'Windows'
shell: powershell
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
echo "VCPKG_ROOT=$(pwd)/vcpkg" >> $GITHUB_ENV
- name: "[Linux|Clang] Install libomp-dev"
if: runner.os == 'Linux' && matrix.c_compiler == 'clang'
run: sudo apt-get install libomp-dev
- name: "[Windows] Install Ninja"
if: runner.os == 'Windows'
run: choco install ninja
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
# [BUG] Not enough space to install CUDA
- name: Setup CUDA
if: matrix.project_type == 3 || matrix.project_type == 4
uses: Jimver/cuda-toolkit@v0.2.19
id: cuda-toolkit
with:
cuda: '12.5.0'
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "CC=${{ matrix.c_compiler }}" >> "$GITHUB_ENV"
echo "CXX=${{ matrix.cpp_compiler }}" >> "$GITHUB_ENV"
echo "CUDA_HOME=$CUDA_PATH" >> "$GITHUB_ENV"
- name: Gernate Project
run: python ./.templates/gen_project.py -n test -t ${{ matrix.project_type }}
- name: "[Linux] Configure CMake and Build"
if: runner.os == 'Linux'
shell: bash
run: >
bash scripts/build.sh
- name: "[Windows] Configure CMake and Build"
if: runner.os == 'Windows'
shell: powershell
run: >
.\scripts\msvc-bash.bat .\scripts\build.sh --prune-env-path