-
Notifications
You must be signed in to change notification settings - Fork 15
193 lines (175 loc) · 5.57 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
181
182
183
184
185
186
187
188
189
190
191
192
193
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: '${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}'
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-registry-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-registry-${{ runner.os }}-
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: cargo-build-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-build-${{ runner.os }}-
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
working-directory: cxx-async
run: cargo clippy -- -D warnings
build_and_test_with_folly:
runs-on: ubuntu-latest
strategy:
matrix:
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
git \
cmake \
make \
gcc \
g++ \
clang \
autoconf \
automake \
libtool \
python3-pip \
ninja-build \
libgflags-dev \
libdouble-conversion-dev \
libevent-dev \
libgoogle-glog-dev \
libboost-all-dev \
libssl-dev \
libunwind-dev \
liblz4-dev \
liblzma-dev \
zlib1g-dev \
libsnappy-dev \
binutils-dev \
libjemalloc-dev \
libiberty-dev
- name: Add environment variables
run: |
echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=$HOME/.local:$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
echo "C_INCLUDE_PATH=$HOME/.local/include:$C_INCLUDE_PATH" >> $GITHUB_ENV
echo "CPLUS_INCLUDE_PATH=$HOME/.local/include:$CPLUS_INCLUDE_PATH" >> $GITHUB_ENV
echo "LIBRARY_PATH=$HOME/.local/lib:$LIBRARY_PATH" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
# Cache fmt
- name: Cache fmt
id: cache-fmt
uses: actions/cache@v4
with:
path: |
~/.local/include/fmt/**
~/.local/lib/libfmt*
key: fmt-${{ runner.os }}-v10.1.1
- name: Build fmt if not cached
if: steps.cache-fmt.outputs.cache-hit != 'true'
run: |
cd /tmp/
git clone https://github.com/fmtlib/fmt.git
cd fmt
mkdir -p _build && cd _build
cmake .. \
-DFMT_TEST=OFF \
-DCMAKE_INSTALL_PREFIX=$HOME/.local \
-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE
make -j$(nproc)
make install
sudo ldconfig
cd ../../
rm -rf /tmp/fmt
# Cache fast_float
- name: Cache fast_float
id: cache-fast_float
uses: actions/cache@v4
with:
path: |
~/.local/lib/libfast_float*
~/.local/include/fast_float/**
key: fast_float-${{ runner.os }}-v3.9.0
- name: Build fast_float if not cached
if: steps.cache-fast_float.outputs.cache-hit != 'true'
run: |
cd /tmp
git clone https://github.com/fastfloat/fast_float.git && cd fast_float
rm -rf _build; mkdir -p _build && cd _build
cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
-DCMAKE_C_COMPILER=/usr/bin/clang \
-DCMAKE_INSTALL_PREFIX=$HOME/.local \
-DCMAKE_CXX_FLAGS="-O3" \
-DBUILD_SHARED_LIBS=TRUE \
-DBUILD_BENCHMARKS=OFF
make -j$(nproc)
make install
sudo ldconfig
cd ../../
rm -rf /tmp/fast_float
# Cache Folly
- name: Cache Folly
id: cache-folly
uses: actions/cache@v4
with:
path: |
~/.local/lib/libfolly**
~/.local/include/folly/**
key: folly-${{ runner.os }}-20241104
- name: Build Folly if not cached
if: steps.cache-folly.outputs.cache-hit != 'true'
run: |
cd /tmp
git clone https://github.com/facebook/folly.git && cd folly
git checkout v2024.11.04.00
rm -rf _build; mkdir _build && cd _build
cmake .. \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX=$HOME/.local \
-DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
-DCMAKE_C_COMPILER=/usr/bin/clang \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DBUILD_TESTS=OFF \
-DBUILD_BENCHMARKS=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_CXX_STANDARD_REQUIRED=ON
make -j$(nproc)
make install
sudo ldconfig
cd ../
rm -rf /tmp/folly/
- name: Copy dependencies to sys
run: |
sudo cp -r $HOME/.local/include/* /usr/include/
sudo cp -r $HOME/.local/lib/* /usr/lib/
sudo ldconfig
- name: Build
working-directory: cxx-async
run: |
cargo build