Skip to content

Commit

Permalink
add unit test in workflow (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
ling0322 authored Dec 19, 2023
1 parent 6ba215a commit 4033a48
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
14 changes: 2 additions & 12 deletions .github/workflows/cmake-linux.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: Linux

on:
Expand All @@ -9,24 +7,16 @@ on:
branches: [ "main" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
run: ctest --verbose -C ${{env.BUILD_TYPE}} --test-dir ${{github.workspace}}/build/src/llm
5 changes: 2 additions & 3 deletions .github/workflows/cmake-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ env:
jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
run: ctest --verbose -C ${{env.BUILD_TYPE}} --test-dir ${{github.workspace}}/build/src/llm
3 changes: 3 additions & 0 deletions src/llm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ target_include_directories(unittest PRIVATE ${libllm_INCDIRS})
target_link_directories(unittest PUBLIC "${CUDNN_ROOT}/lib/" "${CUDNN_ROOT}/lib/x64")
target_link_libraries(unittest ${libllm_LIBADD})
target_link_options(unittest PUBLIC "-fopenmp")

enable_testing()
add_test(NAME unittest COMMAND $<TARGET_FILE:unittest>)

0 comments on commit 4033a48

Please sign in to comment.