-
Notifications
You must be signed in to change notification settings - Fork 55
149 lines (131 loc) · 4.47 KB
/
build.yml
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Build
on:
push:
branches: [master, release/*, develop]
pull_request:
branches: [master, release/*, develop]
workflow_dispatch:
jobs:
lint:
name: Check format
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Run clang-format
uses: ./.github/actions/clang_format
build:
name: Build
needs: lint
strategy:
fail-fast: false
matrix:
configuration:
- Debug
- Release
include:
- os: Linux
container:
image: rippleci/clio_ci:latest
- os: macOS
runs-on: [self-hosted, "${{ matrix.os }}"]
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare runner
uses: ./.github/actions/prepare_runner
with:
disable_ccache: false
- name: Setup conan
uses: ./.github/actions/setup_conan
id: conan
- name: Restore cache
uses: ./.github/actions/restore_cache
id: restore_cache
with:
conan_dir: ${{ env.CONAN_USER_HOME }}/.conan
ccache_dir: ${{ env.CCACHE_DIR }}
- name: Run conan and cmake Release
if: ${{ matrix.configuration == 'Release' }}
uses: ./.github/actions/generate
with:
conan_profile: ${{ steps.conan.outputs.conan_profile }}
conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }}
build_type: ${{ matrix.configuration }}
- name: Run conan and cmake Debug
if: ${{ matrix.configuration == 'Debug' }}
uses: ./.github/actions/generate
with:
conan_profile: ${{ steps.conan.outputs.conan_profile }}
conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }}
build_type: ${{ matrix.configuration }}
extra_cmake_args: >-
-Dcoverage=ON
-DCODE_COVERAGE_TEST_ARGS="--gtest_filter=-BackendCassandra*"
-CODE_COVERAGE_REPORT_FORMAT=xml
- name: Build Clio
if: ${{ matrix.configuration == 'Release' }}
uses: ./.github/actions/build_clio
- name: Run tests and coverage report
if: ${{ matrix.configuration == 'Debug' }}
uses: ./.github/actions/build_clio
with:
target: coverage_report
- name: Show ccache's statistics
if: ${{ matrix.configuration == 'Release' }}
shell: bash
id: ccache_stats
run: |
ccache -s > /tmp/ccache.stats
miss_rate=$(cat /tmp/ccache.stats | grep 'Misses' | head -n1 | sed 's/.*(\(.*\)%).*/\1/')
echo "miss_rate=${miss_rate}" >> $GITHUB_OUTPUT
cat /tmp/ccache.stats
- name: Strip tests
if: ${{ matrix.configuration == 'Release' }}
run: strip build/clio_tests
- name: Upload clio_tests
if: ${{ matrix.configuration == 'Release' }}
uses: actions/upload-artifact@v3
with:
name: clio_tests_${{ runner.os }}
path: build/clio_tests
- name: Upload compile_commans
if: ${{ matrix.configuration == 'Release' && runner.os == 'macOS' }}
uses: actions/upload-artifact@v3
with:
name: compile_commans_${{ runner.os }}
path: build/compile_commands.json
- name: Save cache
if: ${{ matrix.configuration == 'Release' }}
uses: ./.github/actions/save_cache
with:
conan_dir: ${{ env.CONAN_USER_HOME }}/.conan
conan_hash: ${{ steps.restore_cache.outputs.conan_hash }}
conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }}
ccache_dir: ${{ env.CCACHE_DIR }}
ccache_cache_hit: ${{ steps.restore_cache.outputs.ccache_cache_hit }}
ccache_cache_miss_rate: ${{ steps.ccache_stats.outputs.miss_rate }}
test:
name: Run Tests
needs: build
strategy:
fail-fast: false
matrix:
configuration:
- Release
include:
- os: Linux
container:
image: rippleci/clio_ci:latest
- os: macOS
runs-on: [self-hosted, "${{ matrix.os }}"]
container: ${{ matrix.container }}
steps:
- uses: actions/download-artifact@v3
with:
name: clio_tests_${{ runner.os }}
- name: Run clio_tests
run: |
chmod +x ./clio_tests
./clio_tests --gtest_filter="-BackendCassandraBaseTest*:BackendCassandraTest*:BackendCassandraFactoryTestWithDB*"