From d8d5d0b769e9f85e21d6bf6ca81d2db348056417 Mon Sep 17 00:00:00 2001 From: Ciao Date: Sun, 10 Nov 2024 19:27:00 +0800 Subject: [PATCH] ci: add ci pipeline (#2) * ci: add ci pipeline and don't specify build type in CMake * ci: use sudo for apt --- .devcontainer/Dockerfile | 2 +- .github/workflows/ci.yml | 32 +++++++++++++++++++++ CMakeLists.txt | 4 --- {.devcontainer => build_support}/package.sh | 4 +-- 4 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ci.yml rename {.devcontainer => build_support}/package.sh (92%) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9e45f5b..dc8304a 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,7 +1,7 @@ FROM mcr.microsoft.com/devcontainers/cpp:1-ubuntu-22.04 # Optionally install the cmake for vcpkg -COPY ./package.sh /tmp/ +COPY ./build_support/package.sh /tmp/ RUN chmod +x /tmp/package.sh \ && /tmp/package.sh \ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fc028a8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: CI Pipeline + +on: + push: + branches: [ main ] + pull_request: + types: [opened, synchronize] + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install Dependencies + run: | + chmod +x ./build_support/package.sh + ./build_support/package.sh + + - name: Configure CMake + run: cmake -B build -DCMAKE_BUILD_TYPE=Release + + - name: Check Format + run: cmake --build build --target check-format + + - name: Build + run: cmake --build build + + - name: Test + run: cmake --build build -t test-lib \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index b92b27c..55a91ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,15 +30,11 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/src) if(HAS_BENCHES) include(3rdParty) include_googletest() - set(CMAKE_BUILD_TYPE Release) include_benchmark() message(STATUS "Building benches") add_subdirectory(benches) endif(HAS_BENCHES) -# The below needs to be built in Debug mode -set(CMAKE_BUILD_TYPE Debug) - if(HAS_MSAN) include(Sanitizers) message(STATUS "Building Sanitizers") diff --git a/.devcontainer/package.sh b/build_support/package.sh similarity index 92% rename from .devcontainer/package.sh rename to build_support/package.sh index 68fb17c..809f444 100644 --- a/.devcontainer/package.sh +++ b/build_support/package.sh @@ -6,9 +6,9 @@ # set -e -apt-get -y update +sudo apt-get -y update -apt-get -y install \ +sudo apt-get -y install \ build-essential \ clang-12 \ clang-format-12 \