Skip to content

build: fix multiple definition issue (#256) #818

build: fix multiple definition issue (#256)

build: fix multiple definition issue (#256) #818

Workflow file for this run

name: Build and test
on:
push:
paths:
- "src/**"
- "third_party/**"
- "cmake/**"
- "scalellm/**/*.cpp"
- "scalellm/**/*.h"
- "**/CMakeLists.txt"
- ".github/workflows/build.yml"
- "vcpkg.json"
branches:
- main
pull_request:
paths:
- "src/**"
- "third_party/**"
- "cmake/**"
- "scalellm/**/*.cpp"
- "scalellm/**/*.h"
- "**/CMakeLists.txt"
- ".github/workflows/build.yml"
- "vcpkg.json"
branches:
- main
workflow_dispatch:
jobs:
linux-gcc:
strategy:
matrix:
os: [ubuntu-22.04]
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
build_type: [Release]
runs-on: [self-hosted, linux, x64, build]
env:
BUILD_TYPE: ${{ matrix.build_type }}
# Tells vcpkg where binary packages are stored.
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/../../ci_cache/.vcpkg/bincache
# Tells ccache where to store its cache.
CCACHE_DIR: ${{ github.workspace }}/../../ci_cache/.ccache
# Tells where to store the dependencies.
DEPENDENCES_ROOT: ${{ github.workspace }}/../../ci_cache/.deps
steps:
- name: Install toolkits
run: |
sudo apt-get install -y build-essential ninja-build bison gcc-12 g++-12 libunwind-dev python3-dev libboost-all-dev ccache
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10 --slave /usr/bin/g++ g++ /usr/bin/g++-12
- name: Show gcc version
run: gcc --version
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Create cache directory
run: |
mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
mkdir -p $CCACHE_DIR
mkdir -p $DEPENDENCES_ROOT
- name: Zero out ccache statistics
run: ccache -z
# Restore vcpkg bincache from the newest or latest cache available.
# TODO: use a distribute storage for bincache by following the instruction here:
# https://learn.microsoft.com/en-us/vcpkg/users/binarycaching#aws
# - name: Restore vcpkg and its artifacts.
# uses: actions/cache@v3
# with:
# path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
# key: |
# scalellm-${{ matrix.os }}-gcc-x64-linux-${{env.BUILD_TYPE}}-${{ hashFiles( 'vcpkg.json' ) }}
# restore-keys: |
# scalellm-${{ matrix.os }}-gcc-x64-linux-${{env.BUILD_TYPE}}
# - name: Restore ccache and its artifacts.
# uses: actions/cache@v3
# with:
# path: ${{ env.CCACHE_DIR }}
# key: |
# scalellm-${{ matrix.os }}-gcc-x64-linux-ccache-${{env.BUILD_TYPE}}-${{ github.sha }}
# restore-keys: |
# scalellm-${{ matrix.os }}-gcc-x64-linux-ccache-${{env.BUILD_TYPE}}
- name: CMake Build in the 'build' subdirectory
run: |
cmake -G Ninja -S . -B build -DCMAKE_CUDA_ARCHITECTURES=80 -DUSE_CCACHE=ON
cmake --build build --config ${{env.BUILD_TYPE}} --target all
# - name: benchmark
# if: ${{ env.BUILD_TYPE == 'Release' }}
# run: ./build/src/benchmark/micro_benchmark
- name: Run unit tests
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
run: ctest --output-on-failure -C ${{env.BUILD_TYPE}}
- name: Show ccache statistics
run: ccache -s