-
Notifications
You must be signed in to change notification settings - Fork 12
287 lines (286 loc) · 12.8 KB
/
workflow.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
name: bcos-c-sdk GitHub Actions
on:
push:
paths-ignore:
- "docs/**"
- "Changelog.md"
- "README.md"
pull_request:
paths-ignore:
- "docs/**"
- "Changelog.md"
- "README.md"
release:
types: [ published, created, edited ]
env:
CCACHE_DIR: ${{ github.workspace }}/ccache
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
jobs:
build_with_clang:
name: build_with_clang
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-12 ]
# env:
# VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 5
- name: Nightly default
run: rustup default nightly
- uses: actions/cache@v4
id: cache
with:
path: |
/usr/local/share/vcpkg/buildtrees
/usr/local/share/vcpkg/packages
key: vcpkg-clang-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
restore-keys: |
vcpkg-clang-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
vcpkg-clang-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-
vcpkg-clang-v1-notest-${{ runner.temp }}-
- name: install macOS dependencies
run: brew install ccache lcov
- name: configure
run: |
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) && CC=/usr/bin/clang CXX=/usr/bin/clang++
mkdir build && cd build
cmake ../ -DBUILD_JNI=ON -DBUILD_SAMPLE=ON -DTESTS=ON -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: compile
run: export CFLAGS="${CFLAGS} -fPIC";export CXXFLAGS="${CXXFLAGS} -fPIC"; cd build && make -j4
- name: run test
run: cd build && CTEST_OUTPUT_ON_FAILURE=TRUE make test
- name: print link.txt
run: cat build/CMakeFiles/bcos-c-sdk*.dir/link.txt
- name: strip libbcos-c-sdk.dylib
run: strip build/libbcos-c-sdk.dylib || strip -x build/libbcos-c-sdk.dylib
- name: strip libbcos-sdk-jni.dylib
run: |
ls -h bindings/java/jni/src/main/resources/META-INF/native/libbcos-sdk-jni.dylib
strip bindings/java/jni/src/main/resources/META-INF/native/libbcos-sdk-jni.dylib || strip -x bindings/java/jni/src/main/resources/META-INF/native/libbcos-sdk-jni.dylib
ls -h bindings/java/jni/src/main/resources/META-INF/native/libbcos-sdk-jni.dylib
- uses: actions/upload-artifact@v4
with:
name: libbcos-c-sdk.dylib
path: build/libbcos-c-sdk.dylib
- uses: actions/upload-artifact@v4
with:
name: libbcos-sdk-jni.dylib
path: bindings/java/jni/src/main/resources/META-INF/native/libbcos-sdk-jni.dylib
- name: Export GitHub Actions cache environment variables
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 || '');
build_with_gcc:
name: build_with_gcc
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04 ]
# env:
# VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 5
- uses: actions/cache@v4
id: cache
with:
path: |
/usr/local/share/vcpkg/buildtrees
/usr/local/share/vcpkg/packages
key: vcpkg-gcc-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
restore-keys: |
vcpkg-gcc-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
vcpkg-gcc-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-
vcpkg-gcc-v1-notest-${{ runner.temp }}-
- name: install Ubuntu dependencies
run: sudo apt install -y git curl openssl build-essential cmake ccache lcov
- name: configure
run: |
export CC='gcc-10'; export CXX='g++-10'
export CFLAGS="${CFLAGS} -fPIC";export CXXFLAGS="${CXXFLAGS} -fPIC";
mkdir -p build && cd build
cmake ../ -DBUILD_JNI=ON -DBUILD_SAMPLE=ON -DTESTS=ON -DCOVERAGE=ON -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: compile
run: cd build && make -j4
- name: run test
run: cd build && CTEST_OUTPUT_ON_FAILURE=TRUE make test
- name: print link.txt
run: cat build/CMakeFiles/bcos-c-sdk*.dir/link.txt
- name: Export GitHub Actions cache environment variables
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: run coverage
run: cd build && make cov
- name: upload coverage report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/coverage.info
version: "v0.1.15"
flags: unittests
name: c sdk coverage
fail_ci_if_error: false
verbose: true
build_with_centos:
name: build_with_centos
runs-on: ubuntu-latest
container:
image: docker.io/centos:7
volumes:
- /usr/local/share/vcpkg:/usr/local/share/vcpkg
# env:
# VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 5
- name: install rust language
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2021-06-17
override: true
- uses: actions/cache@v3
id: cache
with:
path: |
/usr/local/share/vcpkg/buildtrees
/usr/local/share/vcpkg/packages
key: vcpkg-centos-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
restore-keys: |
vcpkg-centos-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
vcpkg-centos-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-
vcpkg-centos-v1-notest-${{ runner.temp }}-
- name: install CentOS dependencies
run: |
rpm -ivh https://cbs.centos.org/kojifiles/packages/centos-release-scl-rh/2/3.el7.centos/noarch/centos-release-scl-rh-2-3.el7.centos.noarch.rpm
rpm -ivh https://cbs.centos.org/kojifiles/packages/centos-release-scl/2/3.el7.centos/noarch/centos-release-scl-2-3.el7.centos.noarch.rpm
sed -i s/mirror.centos.org/mirrors.aliyun.com/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
cat /etc/yum.repos.d/*.repo
yum clean all
yum makecache
yum update -y
yum install -y epel-release centos-release-scl centos-release-scl-rh
yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
yum install -y java-11-openjdk-devel wget git make gcc gcc-c++ glibc-static glibc-devel openssl openssl-devel ccache devtoolset-11 llvm-toolset-7.0 rh-perl530-perl libzstd-devel zlib-devel flex bison
- name: reinstall cmake
run: |
wget -c https://github.com/Kitware/CMake/releases/download/v3.27.8/cmake-3.27.8-linux-x86_64.tar.gz
tar -zxvf cmake-3.27.8-linux-x86_64.tar.gz && mkdir -p /usr/local/cmake && cd cmake-3.27.8-linux-x86_64 && cp -r * /usr/local/cmake
ln -s /usr/local/cmake/bin/cmake /usr/bin/cmake
cmake --version
git --version
rm -rf cmake-3.27.8-linux-x86_64.tar.gz
- name: configure
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
. /opt/rh/devtoolset-11/enable
. /opt/rh/rh-perl530/enable
export LIBCLANG_PATH=/opt/rh/llvm-toolset-7.0/root/lib64/
. /opt/rh/llvm-toolset-7.0/enable
java -version
export CFLAGS="${CFLAGS} -fPIC"
export CXXFLAGS="${CXXFLAGS} -fPIC"
mkdir -p build && cd build
cmake ../ -DBUILD_JNI=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SAMPLE=ON -DTESTS=ON -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake
make -j4
- name: run test
run: cd build && CTEST_OUTPUT_ON_FAILURE=TRUE make test
- name: print link.txt
run: cat build/CMakeFiles/bcos-c-sdk*.dir/link.txt
- uses: actions/upload-artifact@v3
with:
name: libbcos-c-sdk-WithDebInfo.so
path: build/libbcos-c-sdk.so
- name: strip libbcos-c-sdk.so
run: |
ls -h build/libbcos-c-sdk.so
strip build/libbcos-c-sdk.so || strip -x build/libbcos-c-sdk.so
ls -h build/libbcos-c-sdk.so
- uses: actions/upload-artifact@v3
with:
name: libbcos-sdk-jni-WithDebInfo.so
path: bindings/java/jni/src/main/resources/META-INF/native/libbcos-sdk-jni.so
- name: strip libbcos-sdk-jni.so
run: |
ls -h bindings/java/jni/src/main/resources/META-INF/native/libbcos-sdk-jni.so
strip bindings/java/jni/src/main/resources/META-INF/native/libbcos-sdk-jni.so || strip -x bindings/java/jni/src/main/resources/META-INF/native/libbcos-sdk-jni.so
ls -h bindings/java/jni/src/main/resources/META-INF/native/libbcos-sdk-jni.so
- uses: actions/upload-artifact@v3
with:
name: libbcos-c-sdk.so
path: build/libbcos-c-sdk.so
- uses: actions/upload-artifact@v3
with:
name: libbcos-sdk-jni.so
path: bindings/java/jni/src/main/resources/META-INF/native/libbcos-sdk-jni.so
- name: Export GitHub Actions cache environment variables
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 || '');
build_with_windows:
name: build_with_windows
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-2019 ]
# env:
# VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 5
- uses: actions/cache@v4
id: cache
with:
path: |
C:\vcpkg\buildtrees
C:\vcpkg\packages
key: vcpkg-msvc-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
restore-keys: |
vcpkg-msvc-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
vcpkg-msvc-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-
vcpkg-msvc-v1-notest-${{ runner.temp }}-
- name: Add MSbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: configure
if: runner.os == 'Windows'
run: |
mkdir -p build && cd build
cmake -G "Visual Studio 16 2019" -A x64 ../ -DCMAKE_BUILD_TYPE=Release -DBOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN7 -D_WIN32_WINNT=0x0601 -DTESTS=ON -DBUILD_JNI=ON -DVCPKG_TARGET_TRIPLET='x64-windows-static' -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake || cat C:\vcpkg\buildtrees\fisco-bcos-cpp-sdk\build-x64-windows-static-dbg-out.log
- name: compile
run: cd build && MSBuild bcos-c-sdk.sln /p:Configuration=Release /p:Platform=x64
- uses: actions/upload-artifact@v3
with:
name: bcos-c-sdk.lib
path: D:\a\bcos-c-sdk\bcos-c-sdk\build\Release\bcos-c-sdk.lib
- uses: actions/upload-artifact@v3
with:
name: bcos-c-sdk.dll
path: D:\a\bcos-c-sdk\bcos-c-sdk\build\Release\bcos-c-sdk.dll
- uses: actions/upload-artifact@v3
with:
name: bcos-sdk-jni.lib
path: D:\a\bcos-c-sdk\bcos-c-sdk\bindings\java\jni\src\main\resources\META-INF\native\Release\bcos-sdk-jni.lib
- uses: actions/upload-artifact@v3
with:
name: bcos-sdk-jni.dll
path: D:\a\bcos-c-sdk\bcos-c-sdk\bindings\java\jni\src\main\resources\META-INF\native\Release\bcos-sdk-jni.dll
- name: Export GitHub Actions cache environment variables
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 || '');