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