Skip to content

Commit b07aa3d

Browse files
committed
Add boringssl to CI
* BoringSSL does not use the bindgen feature, since it generates the crate separately. * BoringSSL shouldn't run the systest tests (maintained out of tree) or the openssl-errors tests (BoringSSL doesn't support external errors) * Adds both master and a known-working revision to CI. The master build should be made non-blocking.
1 parent 84a5154 commit b07aa3d

File tree

1 file changed

+46
-8
lines changed

1 file changed

+46
-8
lines changed

.github/workflows/ci.yml

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ jobs:
149149
- true
150150
- false
151151
library:
152+
- name: boringssl
153+
version: master
154+
- name: boringssl
155+
version: 5697a9202615925696f8dc7f4e286d44d474769e
152156
- name: openssl
153157
version: vendored
154158
- name: openssl
@@ -197,6 +201,10 @@ jobs:
197201
library:
198202
name: libressl
199203
version: 3.5.2
204+
exclude:
205+
- library:
206+
name: boringssl
207+
bindgen: true
200208
name: ${{ matrix.target }}-${{ matrix.library.name }}-${{ matrix.library.version }}-${{ matrix.bindgen }}
201209
runs-on: ubuntu-latest
202210
env:
@@ -217,10 +225,10 @@ jobs:
217225
exit 0
218226
;;
219227
"i686-unknown-linux-gnu")
220-
packages="gcc-multilib"
228+
packages="gcc-multilib g++-multilib"
221229
;;
222230
"arm-unknown-linux-gnueabihf")
223-
packages="gcc-arm-linux-gnueabihf qemu-user"
231+
packages="gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf qemu-user"
224232
;;
225233
esac
226234
@@ -233,14 +241,24 @@ jobs:
233241
key: openssl-${{ matrix.target }}-${{ matrix.library.name }}-${{ matrix.library.version }}-2
234242
if: matrix.library.version != 'vendored'
235243
id: openssl-cache
244+
- run: |
245+
echo "RUST_TEST_THREADS=1" >> $GITHUB_ENV
246+
echo BINDGEN_EXTRA_CLANG_ARGS="--sysroot /usr/arm-linux-gnueabihf" >> $GITHUB_ENV
247+
if: matrix.target == 'arm-unknown-linux-gnueabihf'
236248
- name: Build OpenSSL
237249
run: |
238250
case "${{ matrix.library.name }}" in
239251
"openssl")
240252
url="https://openssl.org/source${{ matrix.library.dl-path }}/openssl-${{ matrix.library.version }}.tar.gz"
253+
tar_flags="--strip-components=1"
241254
;;
242255
"libressl")
243256
url="https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${{ matrix.library.version }}.tar.gz"
257+
tar_flags="--strip-components=1"
258+
;;
259+
"boringssl")
260+
url="https://boringssl.googlesource.com/boringssl/+archive/${{ matrix.library.version }}.tar.gz"
261+
tar_flags=""
244262
;;
245263
esac
246264
@@ -258,30 +276,45 @@ jobs:
258276
OS_FLAGS=""
259277
export AR=arm-linux-gnueabihf-ar
260278
export CC=arm-linux-gnueabihf-gcc
279+
export CXX=arm-linux-gnueabihf-g++
261280
;;
262281
esac
263282
264283
mkdir /tmp/build
265284
cd /tmp/build
266285
267-
curl -L $url | tar --strip-components=1 -xzf -
286+
curl -L $url | tar $tar_flags -xzf -
268287
269288
case "${{ matrix.library.name }}" in
270289
"openssl")
271290
./Configure --prefix=$OPENSSL_DIR --libdir=lib $OS_COMPILER -fPIC -g $OS_FLAGS no-shared
291+
make
292+
make install_sw
272293
;;
273294
"libressl")
274295
./configure --prefix=$OPENSSL_DIR --disable-shared --with-pic
296+
make
297+
make install_sw
275298
;;
299+
"boringssl")
300+
sed -i rust/CMakeLists.txt -e '1s%^%include_directories(../include)\n%'
301+
cpu=`echo ${{ matrix.target }} | cut -d - -f 1`
302+
echo "set(CMAKE_SYSTEM_NAME Linux)" > toolchain.cmake
303+
echo "set(CMAKE_SYSTEM_PROCESSOR $cpu)" >> toolchain.cmake
304+
echo "set(triple ${{ matrix.target }})" >> toolchain.cmake
305+
echo 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} '$OS_FLAGS '" CACHE STRING "c++ flags")' >> toolchain.cmake
306+
echo 'set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} '$OS_FLAGS '" CACHE STRING "c flags")' >> toolchain.cmake
307+
echo 'set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} '$OS_FLAGS '" CACHE STRING "asm flags")' >> toolchain.cmake
308+
cmake -DRUST_BINDINGS="${{ matrix.target }}" -B $OPENSSL_DIR -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake
309+
make -C $OPENSSL_DIR
276310
esac
277311
278-
make
279-
make install_sw
280312
if: matrix.library.version != 'vendored' && !steps.openssl-cache.outputs.cache-hit
281313
- run: |
282-
echo "RUST_TEST_THREADS=1" >> $GITHUB_ENV
283-
echo BINDGEN_EXTRA_CLANG_ARGS="--sysroot /usr/arm-linux-gnueabihf" >> $GITHUB_ENV
284-
if: matrix.target == 'arm-unknown-linux-gnueabihf'
314+
mkdir -p .cargo
315+
echo '[patch.crates-io]' > .cargo/config.toml
316+
echo 'bssl-sys = { path = "'$OPENSSL_DIR'/rust" }' >> .cargo/config.toml
317+
if: matrix.library.name == 'boringssl'
285318
- uses: actions/cache@v1
286319
with:
287320
path: ~/.cargo/registry/index
@@ -307,8 +340,12 @@ jobs:
307340
features="$features --features bindgen"
308341
fi
309342
cargo run --manifest-path=systest/Cargo.toml --target ${{ matrix.target }} $features
343+
if: matrix.library.name != 'boringssl'
310344
- name: Test openssl
311345
run: |
346+
if [[ "${{ matrix.library.name }}" == "boringssl" ]]; then
347+
features="--features boringssl"
348+
fi
312349
if [[ "${{ matrix.library.version }}" == "vendored" ]]; then
313350
features="--features vendored"
314351
fi
@@ -325,3 +362,4 @@ jobs:
325362
features="$features --features openssl-sys/bindgen"
326363
fi
327364
cargo test --manifest-path=openssl-errors/Cargo.toml --target ${{ matrix.target }} $features
365+
if: matrix.library.name != 'boringssl'

0 commit comments

Comments
 (0)