-
Notifications
You must be signed in to change notification settings - Fork 11
214 lines (206 loc) · 7.31 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
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
name: build
on: [push, pull_request]
env:
APT_DEPS: libzstd-dev samtools tabix libhts-dev pigz python3-pip libcurl4-openssl-dev
BREW_DEPS: zstd samtools pigz coreutils sqlite
PIP_DEPS: pytest pytest-xdist
jobs:
lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: deps
run: |
sudo apt-get -qq update
sudo apt-get install -y clang-format cppcheck python3-pip
sudo pip3 install --system pre-commit $PIP_DEPS black flake8 pylint
- name: pre-commit
run: pre-commit run --all-files
- name: mvn spotless:check
run: mvn spotless:check -B -f bindings/jdbc/genomicsqlite-jdbc/pom.xml
- name: rust toolchain
uses: actions-rs/toolchain@v1
with:
components: rustfmt, clippy
toolchain: stable
default: true
- name: rust lint
run: |
cd bindings/rust
./cargo check --no-default-features
./cargo fmt -- --check
test:
runs-on: ubuntu-20.04
strategy:
matrix:
BUILD_TYPE: [Debug, Release]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: deps
run: |
sudo apt-get -qq update
sudo apt-get install -y $APT_DEPS
sudo pip3 install --system $PIP_DEPS
- name: rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
- name: build
run: cmake -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} -B build . && cmake --build build -j $(nproc)
- name: test
run: env -C build SQLITE_WEB_LOG=99 ctest -V
linux-x86-64-so:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: build loaders
run: |
sudo apt-get -qq update
sudo apt-get install -y $APT_DEPS
sudo pip3 install --system $PIP_DEPS
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0' -B build . && cmake --build build -j $(nproc)
rm build/libgenomicsqlite.so
sudo apt-get remove -y libzstd-dev # should be linked into libgenomicsqlite.so
- name: build portable .so in docker
run: docker build -t genomicsqlite . && docker run -v $(pwd):/mnt --rm genomicsqlite cp /usr/local/lib/{libgenomicsqlite.so,libsqlite3.so.0} /mnt/build/
- name: symbols & digests
run: |
readelf -d build/libgenomicsqlite.so
ldd -r build/libgenomicsqlite.so
echo "----"
echo "libgenomicsqlite.so GLIBC version requirements:"
objdump -t build/libgenomicsqlite.so | grep -o 'GLIBC_.*' | sort -Vr | head -n1
objdump -t build/libgenomicsqlite.so | grep -o 'GLIBCXX_.*' | sort -Vr | head -n1
echo "libsqlite3.so.0 GLIBC version requirements:"
objdump -t build/libsqlite3.so.0 | grep -o 'GLIBC_.*' | sort -Vr | head -n1
echo "----"
sha256sum build/libgenomicsqlite.so build/libsqlite3.so.0
sudo cp build/libsqlite3.so.0 /usr/local/lib
sudo ldconfig
- name: rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
- name: test portable .so
run: env -C build SQLITE_WEB_LOG=99 ctest -V
- name: test rust crate
run: |
set -e
cp build/libgenomicsqlite.so bindings/rust
SQLITE_WEB_LOG=99 bindings/rust/cargo test --release
bindings/rust/cargo package --list | grep libgenomicsqlite.so
- name: prepare artifacts
run: cp build/{libgenomicsqlite.so,libsqlite3.so.0} .
- uses: actions/upload-artifact@v2
with:
name: libgenomicsqlite.so
path: libgenomicsqlite.so
- uses: actions/upload-artifact@v2
with:
name: libsqlite3.so.0
path: libsqlite3.so.0
macOS-x86-64-dylib:
runs-on: macOS-11
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: dependencies
run: |
rm -f /usr/local/bin/2to3 # https://github.com/pypa/pipenv/issues/3831
brew update || (sleep 2; brew update)
for dep in $BREW_DEPS ; do
brew install $dep || brew upgrade $dep
done
pip install $PIP_DEPS
- name: rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
- name: build environment
run: |
echo "PATH=$(brew --prefix)/bin:$(brew --prefix)/opt/sqlite/bin:${PATH}" >> $GITHUB_ENV
echo "CFLAGS=-I$(brew --prefix)/include -I$(brew --prefix)/opt/sqlite/include -march=ivybridge" >> $GITHUB_ENV
echo "CXXFLAGS=-I$(brew --prefix)/include -I$(brew --prefix)/opt/sqlite/include -march=ivybridge" >> $GITHUB_ENV
echo "LDFLAGS=-L$(brew --prefix)/lib -L$(brew --prefix)/opt/sqlite/lib" >> $GITHUB_ENV
# used by rusqlite:
echo "SQLITE3_INCLUDE_DIR=$(brew --prefix)/opt/sqlite/include" >> $GITHUB_ENV
echo "SQLITE3_LIB_DIR=$(brew --prefix)/opt/sqlite/lib" >> $GITHUB_ENV
- name: build
run: |
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=$(brew --prefix)/opt/sqlite \
-B build .
cmake --build build -j 4
- name: symbols & digests
run: |
otool -L build/libgenomicsqlite.dylib
sha256sum build/libgenomicsqlite.dylib
- name: ctest
run: |
cd build
otool -L test/capi_smoke_test
SQLITE_WEB_LOG=99 ctest -V
- name: test rust crate
run: |
set -e
cp build/libgenomicsqlite.dylib bindings/rust
SQLITE_WEB_LOG=99 bindings/rust/cargo test --release
bindings/rust/cargo package --list | grep libgenomicsqlite.dylib
- name: prepare artifacts
run: cp build/libgenomicsqlite.dylib include/genomicsqlite.h .
- uses: actions/upload-artifact@v2
with:
name: libgenomicsqlite.dylib
path: libgenomicsqlite.dylib
artifacts:
runs-on: ubuntu-20.04
needs: [linux-x86-64-so, macOS-x86-64-dylib]
steps:
- uses: actions/checkout@v2
- name: fetch libgenomicsqlite.so
uses: actions/[email protected]
with:
name: libgenomicsqlite.so
- name: fetch libsqlite3.so.0
uses: actions/[email protected]
with:
name: libsqlite3.so.0
- name: fetch libgenomicsqlite.dylib
uses: actions/[email protected]
with:
name: libgenomicsqlite.dylib
- name: detect GIT_REVISION
run: |
cp include/genomicsqlite.h .
echo "GIT_REVISION=$(git describe --tags --always)" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
with:
name: GenomicSQLite-${{ env.GIT_REVISION }}
path: |
LICENSE
genomicsqlite.h
libgenomicsqlite.so
libgenomicsqlite.dylib
- name: build jar
run: |
cp libgenomicsqlite.so libgenomicsqlite.dylib bindings/jdbc/genomicsqlite-jdbc/src/main/resources/
mvn deploy -Drevision=${{ env.GIT_REVISION }} -B -f bindings/jdbc/genomicsqlite-jdbc/pom.xml
- name: digests
run: sha256sum *genomicsqlite* bindings/jdbc/genomicsqlite-jdbc/target/genomicsqlite*.jar libsqlite3.so.0
- uses: actions/upload-artifact@v2
with:
name: genomicsqlite-jdbc-${{ env.GIT_REVISION }}
path: bindings/jdbc/genomicsqlite-jdbc/target/mvn-repo