-
Notifications
You must be signed in to change notification settings - Fork 983
180 lines (157 loc) · 5.91 KB
/
ci.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: ci-tests
on:
# push:
# branches: [ main ]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
python -m pip install pre-commit
python -m pip freeze --local
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit checks
run: pre-commit run --show-diff-on-failure --color=always --from-ref HEAD^ --to-ref HEAD
shell: bash
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
strategy:
matrix:
# Test of these containers
container: ["ubuntu-dev:20", "alpine-dev:latest"]
build-type: [Debug, Release]
compiler: [{ cxx: g++, c: gcc }]
cxx_flags: ["-Werror"]
include:
- container: "alpine-dev:latest"
build-type: Debug
compiler: { cxx: clang++, c: clang }
cxx_flags: ""
timeout-minutes: 60
env:
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_SIZE: 6G
SCCACHE_ERROR_LOG: /tmp/sccache_log.txt
# SCCACHE_LOG: debug
container:
image: ghcr.io/romange/${{ matrix.container }}
volumes:
- /:/hostroot
options: --sysctl "net.ipv6.conf.all.disable_ipv6=0"
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Prepare Environment
run: |
uname -a
cmake --version
mkdir -p ${GITHUB_WORKSPACE}/build
echo "===================Before freeing up space ============================================"
df -h
rm -rf /hostroot/usr/share/dotnet
rm -rf /hostroot/usr/local/share/boost
rm -rf /hostroot/usr/local/lib/android
rm -rf /hostroot/opt/ghc
echo "===================After freeing up space ============================================"
df -h
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Configure Cache Env
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '')
- 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: |
cmake -B ${GITHUB_WORKSPACE}/build \
-DCMAKE_BUILD_TYPE=${{matrix.build-type}} \
-GNinja \
-DCMAKE_C_COMPILER="${{matrix.compiler.c}}" \
-DCMAKE_CXX_COMPILER="${{matrix.compiler.cxx}}" \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_FLAGS="${{matrix.cxx_flags}}" \
-L
cd ${GITHUB_WORKSPACE}/build && pwd
du -hcs _deps/
- name: Build
run: |
cd ${GITHUB_WORKSPACE}/build
ninja search_family_test
df -h
echo "-----------------------------"
ninja src/all
- name: PostFail
if: failure()
run: |
echo "disk space is:"
df -h
- name: C++ Unit Tests
run: |
cd ${GITHUB_WORKSPACE}/build
echo Run ctest -V -L DFLY
GLOG_alsologtostderr=1 GLOG_vmodule=rdb_load=1,rdb_save=1,snapshot=1 ctest -V -L DFLY
echo "Running tests with --force_epoll"
# Create a rule that automatically prints stacktrace upon segfault
cat > ./init.gdb <<EOF
catch signal SIGSEGV
command
bt
end
EOF
gdb -ix ./init.gdb --batch -ex r --args ./dragonfly_test --force_epoll
FLAGS_force_epoll=true GLOG_vmodule=rdb_load=1,rdb_save=1,snapshot=1 ctest -V -L DFLY
echo "Finished running tests with --force_epoll"
echo "Running tests with --cluster_mode=emulated"
FLAGS_cluster_mode=emulated ctest -V -L DFLY
echo "Running tests with both --cluster_mode=emulated & --lock_on_hashtags"
FLAGS_cluster_mode=emulated FLAGS_lock_on_hashtags=true ctest -V -L DFLY
./dragonfly_test
./multi_test --multi_exec_mode=1
./multi_test --multi_exec_mode=3
- name: Upload unit logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: unit_logs
path: /tmp/*INFO*
- name: Run regression tests
if: matrix.container == 'ubuntu-dev:20'
uses: ./.github/actions/regression-tests
with:
dfly-executable: dragonfly
run-only-on-ubuntu-latest: true
build-folder-name: build
filter: ${{ matrix.build-type == 'Release' && 'not slow' || '(not slow) and (not opt_only)' }}
- name: Upload regression logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: regression_logs
path: /tmp/failed/*
lint-test-chart:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/lint-test-chart