Skip to content

Commit bcd8ff9

Browse files
authored
Create cmake.yml (#108)
1 parent 38bfde8 commit bcd8ff9

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

.github/workflows/cmake.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Build Trantor
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
env:
10+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
11+
BUILD_TYPE: Release
12+
13+
jobs:
14+
build:
15+
name: ${{matrix.buildname}}
16+
runs-on: ${{matrix.os}}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- os: ubuntu-20.04
22+
buildname: 'ubuntu-20.04/gcc'
23+
triplet: x64-linux
24+
compiler: gcc_64
25+
- os: ubuntu-16.04
26+
buildname: 'ubuntu-16.04/gcc'
27+
triplet: x64-linux
28+
compiler: gcc_64
29+
- os: macos-latest
30+
buildname: 'macos/clang'
31+
triplet: x64-osx
32+
compiler: clang_64
33+
34+
steps:
35+
- name: Checkout Trantor source code
36+
uses: actions/checkout@v2
37+
with:
38+
submodules: true
39+
fetch-depth: 0
40+
41+
- name: (macOS) Install dependencies
42+
if: runner.os == 'macOS'
43+
run: |
44+
brew install c-ares openssl
45+
46+
- name: (Linux) Install dependencies
47+
if: runner.os == 'Linux'
48+
run: |
49+
# Installing packages might fail as the github image becomes outdated
50+
sudo apt update
51+
# These aren't available or don't work well in vcpkg
52+
sudo apt install openssl libssl-dev
53+
54+
- name: install gtest
55+
run: |
56+
wget https://github.com/google/googletest/archive/release-1.10.0.tar.gz
57+
tar xf release-1.10.0.tar.gz
58+
cd googletest-release-1.10.0
59+
cmake .
60+
make
61+
sudo make install
62+
63+
- name: Create Build Environment & Configure Cmake
64+
# Some projects don't allow in-source building, so create a separate build directory
65+
# We'll use this as our working directory for all subsequent commands
66+
shell: bash
67+
working-directory: ${{env.GITHUB_WORKSPACE}}
68+
run: |
69+
mkdir build
70+
cd build
71+
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTING=on
72+
73+
- name: Build
74+
working-directory: ${{env.GITHUB_WORKSPACE}}
75+
shell: bash
76+
# Execute the build. You can specify a specific target with "--target <NAME>"
77+
run: |
78+
cd build
79+
sudo make && sudo make install
80+
81+
- name: Test
82+
working-directory: ${{env.GITHUB_WORKSPACE}}
83+
shell: bash
84+
# Execute tests defined by the CMake configuration.
85+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
86+
run: |
87+
cd build
88+
make test

0 commit comments

Comments
 (0)