Skip to content

CMake Linux Build

CMake Linux Build #13

Workflow file for this run

# 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: CMake Linux Build
on:
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
workflow_dispatch:
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:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download and Install CMake
run: |
curl -LO https://github.com/Kitware/CMake/releases/download/v3.21.3/cmake-3.21.3-linux-x86_64.tar.gz
tar -xzvf cmake-3.21.3-linux-x86_64.tar.gz
sudo mv cmake-3.21.3-linux-x86_64 /usr/local/cmake
echo 'export PATH="/usr/local/cmake/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev libprotobuf-dev protobuf-compiler libmysqlclient-dev # 安装依赖
- name: Install GCC 13
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update
sudo apt-get install g++-13 -y
- name: Set GCC 13 as default compiler
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100
- name: Verify GCC version
run: |
gcc --version
- name: Install Boost.Interprocess
run: |
sudo apt update
sudo apt install libboost-all-dev
dpkg-query -L libboost-all-dev
- name: Install MySQL Connector/C
run: sudo apt-get update && sudo apt-get install -y libmysqlclient-dev && dpkg-query -L libmysqlclient-dev
- name: Download and build hiredis
run: |
git clone https://github.com/redis/hiredis.git
cd hiredis
make
sudo make install
- name: Download and install Protobuf
run: |
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.13.0/protobuf-all-3.13.0.tar.gz
tar -xzvf protobuf-all-3.13.0.tar.gz
cd protobuf-3.13.0
./configure
make
sudo make install
- name: Download and build curl
run: |
sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev && dpkg-query -L libcurl4-openssl-dev
- 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: |
mkdir build
cd build
cmake ..
make