-
Notifications
You must be signed in to change notification settings - Fork 12
243 lines (242 loc) · 9.77 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
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
jobs:
build_with_clang:
name: build_with_clang
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 5
- name: Nightly default
run: rustup default nightly
- uses: actions/cache@v2
id: cache
with:
path: |
/home/runner/.hunter
/github/home/.hunter
/Users/runner/.hunter
/home/runner/.hunter/_Base/Download/
/github/home/.hunter/_Base/Download/
/Users/runner/.hunter/_Base/Download/
ccache
key: hunter-clang-v3-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
restore-keys: |
hunter-clang-v3-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
hunter-clang-v3-notest-${{ runner.temp }}-${{ github.base_ref }}-
hunter-clang-v3-notest-${{ runner.temp }}-
- name: install macOS dependencies
if: runner.os == 'macOS'
run: brew install ccache lcov
- name: install Ubuntu dependencies
if: runner.os == 'Linux'
run: sudo apt install -y git curl openssl build-essential clang cmake ccache lcov
- name: configure
if: runner.os == 'macOS'
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 -DCOVERAGE=ON
- name: configure
if: runner.os == 'Linux'
run: CC=/usr/bin/clang CXX=/usr/bin/clang++ mkdir build && cd build && cmake ../ -DBUILD_JNI=ON -DBUILD_SAMPLE=ON -DTESTS=ON -DCOVERAGE=ON
- 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: run coverage
run: cd build && make cov
- uses: actions/upload-artifact@v2
with:
name: libbcos-c-sdk.dylib.zip
path: build/libbcos-c-sdk.dylib
- uses: actions/upload-artifact@v2
with:
name: libbcos-sdk-jni.dylib.zip
path: bindings/java/jni/src/main/resources/META-INF/native/libbcos-sdk-jni.dylib
build_with_gcc:
name: build_with_gcc
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 5
- uses: actions/cache@v2
id: cache
with:
path: |
/home/runner/.hunter
/github/home/.hunter
/Users/runner/.hunter
/home/runner/.hunter/_Base/Download/
/github/home/.hunter/_Base/Download/
/Users/runner/.hunter/_Base/Download/
deps/src
ccache
key: hunter-gcc-v2-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
restore-keys: |
hunter-gcc-v2-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
hunter-gcc-v2-notest-${{ runner.temp }}-${{ github.base_ref }}-
hunter-gcc-v2-notest-${{ runner.temp }}-
- uses: actions/cache@v2
id: ccache
with:
path: ccache
key: cache-gcc-v2-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
restore-keys: |
ccache-gcc-v2-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
cache-gcc-v2-notest-${{ runner.temp }}-${{ github.base_ref }}-
cache-gcc-v2-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
- name: compile
run: cd build && make -j4
- name: run test
run: cd build && CTEST_OUTPUT_ON_FAILURE=TRUE make test
- 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: true
verbose: true
build_with_centos:
name: build_with_centos
runs-on: ubuntu-latest
container:
image: docker.io/centos:7
volumes:
- /github/home/.hunter:/github/home/.hunter
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 5
- name: install rust language
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2021-06-17
override: true
- uses: actions/cache@v2
id: cache
with:
path: |
/home/runner/.hunter
/github/home/.hunter
/Users/runner/.hunter
/home/runner/.hunter/_Base/Download/
/github/home/.hunter/_Base/Download/
/Users/runner/.hunter/_Base/Download/
ccache
deps/src
ccache
key: hunter-centos-v2-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
restore-keys: |
hunter-centos-v2-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
hunter-centos-v2-notest-${{ runner.temp }}-${{ github.base_ref }}-
hunter-centos-v2-notest-${{ runner.temp }}-
- name: install CentOS dependencies
run: |
yum install -y epel-release centos-release-scl
yum install -y java-11-openjdk-devel git make gcc gcc-c++ glibc-static glibc-devel openssl cmake3 ccache devtoolset-11 llvm-toolset-7.0 rh-perl530-perl libzstd-devel zlib-devel flex bison python-devel python3-devel
- 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
alias cmake='cmake3'
java -version
export CFLAGS="${CFLAGS} -fPIC"
export CXXFLAGS="${CXXFLAGS} -fPIC"
mkdir -p build && cd build
cmake3 ../ -DHUNTER_STATUS_DEBUG=ON -DBUILD_JNI=ON -DBUILD_SAMPLE=ON -DTESTS=ON
make -j4
- name: run test
run: cd build && CTEST_OUTPUT_ON_FAILURE=TRUE make test
- uses: actions/upload-artifact@v2
with:
name: libbcos-c-sdk.so.zip
path: build/libbcos-c-sdk.so
- uses: actions/upload-artifact@v2
with:
name: libbcos-sdk-jni.so.zip
path: bindings/java/jni/src/main/resources/META-INF/native/libbcos-sdk-jni.so
build_with_windows:
name: build_with_windows
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 5
- uses: actions/cache@v2
id: cache
with:
path: |
/home/runner/.hunter
/github/home/.hunter
/Users/runner/.hunter
/home/runner/.hunter/_Base/Download/
/github/home/.hunter/_Base/Download/
/Users/runner/.hunter/_Base/Download/
C:/.hunter/
C:/.hunter/_Base/Download/
ccache
key: hunter-msvc-v3-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
restore-keys: |
hunter-msvc-v3-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
hunter-msvc-v3-notest-${{ runner.temp }}-${{ github.base_ref }}-
hunter-msvc-v3-notest-${{ runner.temp }}-
- name: Add MSbuild to PATH
uses: microsoft/[email protected]
- name: configure
if: runner.os == 'Windows'
run: mkdir -p build && cd build && cmake -G "Visual Studio 16 2019" -A x64 ../ -DHUNTER_CONFIGURATION_TYPES=Release -DHUNTER_STATUS_DEBUG=ON -DTESTS=ON -DBUILD_JNI=ON
- name: compile
run: cd build && MSBuild bcos-c-sdk.sln /p:Configuration=Release /p:Platform=x64
- uses: actions/upload-artifact@v2
with:
name: bcos-c-sdk.lib.zip
path: D:\a\bcos-c-sdk\bcos-c-sdk\build\Release\bcos-c-sdk.lib
- uses: actions/upload-artifact@v2
with:
name: bcos-c-sdk.dll.zip
path: D:\a\bcos-c-sdk\bcos-c-sdk\build\Release\bcos-c-sdk.dll
- uses: actions/upload-artifact@v2
with:
name: bcos-sdk-jni.lib.zip
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@v2
with:
name: bcos-sdk-jni.dll.zip
path: D:\a\bcos-c-sdk\bcos-c-sdk\bindings\java\jni\src\main\resources\META-INF\native\Release\bcos-sdk-jni.dll