Skip to content

Commit 3564311

Browse files
committed
Adding Guthub Actions compilations and unit tests
1 parent c9c6f15 commit 3564311

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 0 1 * *' # This line schedules the workflow to run at 00:00 on the first day of every month
8+
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
jobs:
14+
build:
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
include:
19+
- os: ubuntu-latest
20+
compiler: gcc
21+
- os: ubuntu-latest
22+
compiler: clang
23+
- os: windows-latest
24+
compiler: msvc
25+
- os: macos-latest
26+
compiler:
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
with:
32+
submodules: true
33+
34+
- name: Cache
35+
uses: actions/cache@v4
36+
with:
37+
path: |
38+
~/vcpkg
39+
./build/vcpkg_installed
40+
${{ env.HOME }}/.cache/vcpkg/archives
41+
${{ env.XDG_CACHE_HOME }}/vcpkg/archives
42+
${{ env.LOCALAPPDATA }}\vcpkg\archives
43+
${{ env.APPDATA }}\vcpkg\archives
44+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./vcpkg.json')}}
45+
restore-keys: |
46+
${{ runner.os }}-${{ env.BUILD_TYPE }}-
47+
48+
- name: Setup Cpp
49+
uses: aminya/setup-cpp@v1
50+
with:
51+
compiler: ${{ matrix.compiler }}
52+
vcvarsall: ${{ contains(matrix.os, 'windows') }}
53+
cmake: true
54+
ninja: true
55+
vcpkg: true
56+
cppcheck: false
57+
58+
- name: Install compiler for Macos
59+
if: startsWith(matrix.os, 'macos')
60+
run: |
61+
brew install llvm
62+
63+
- name: Prepare the PATH
64+
run: |
65+
if [[ "${{ runner.os }}" == "Windows" ]]; then
66+
echo "$env:USERPROFILE\vcpkg" >> $GITHUB_PATH
67+
echo "$env:USERPROFILE\ninja" >> $GITHUB_PATH
68+
else
69+
echo "$HOME/vcpkg" >> $GITHUB_PATH
70+
echo "$HOME/ninja" >> $GITHUB_PATH
71+
fi
72+
73+
- name: Install dependencies
74+
run: |
75+
cd ci/vcpkg
76+
vcpkg install
77+
78+
- name: Build project
79+
run: |
80+
if [ -d build ]; then
81+
echo "Build dir exists"
82+
ls -la build
83+
else
84+
mkdir build
85+
fi
86+
pushd build
87+
cmake .. -DRESTC_CPP_THREADED_CTX=ON -DCMAKE_BUILD_TYPE=Release -G "Ninja" -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake
88+
cmake --build .
89+
popd
90+
91+
- name: Run Unit Tests
92+
run: |
93+
pushd build
94+
ctest -R UNITTESTS . -C Release
95+
popd

ci/vcpkg/vcpkg.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "restc-cpp",
3+
"license": "MIT",
4+
"dependencies": [
5+
"boost-system",
6+
"boost-context",
7+
"boost-coroutine",
8+
"boost-filesystem",
9+
"boost-asio",
10+
"boost-chrono",
11+
"boost-date-time",
12+
"boost-log",
13+
"boost-uuid",
14+
"boost-program-options",
15+
"boost-functional",
16+
"zlib",
17+
"openssl",
18+
"gtest",
19+
"rapidjson",
20+
]
21+
}

0 commit comments

Comments
 (0)