forked from parallaxsecond/rust-psa-crypto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci.sh
executable file
·70 lines (57 loc) · 1.78 KB
/
ci.sh
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
#!/usr/bin/env bash
# Copyright 2020 Contributors to the Parsec project.
# SPDX-License-Identifier: Apache-2.0
# Continuous Integration test script, executed by GitHub Actions on x86 and
# Travis CI on Arm64.
set -euf -o pipefail
# The Parsec operations repository is included as a submodule. It is
# necessary to update it first.
git submodule update --init
################
# Build client #
################
RUST_BACKTRACE=1 cargo build
#################
# Static checks #
#################
# On native target clippy or fmt might not be available.
if cargo fmt -h; then
cargo fmt --all -- --check
fi
if cargo clippy -h; then
cargo clippy --all-targets -- -D clippy::all -D clippy::cargo
fi
#############
# Run tests #
#############
RUST_BACKTRACE=1 cargo test -- --test-threads=1
# Remove mbedtls directory if it exists
rm -rf psa-crypto/mbedtls
################################
# Check feature configurations #
################################
# psa-crypto-sys
pushd psa-crypto-sys
cargo build --no-default-features
# psa-crypto
popd
pushd psa-crypto
cargo build --no-default-features
cargo build --no-default-features --features operations
cargo build --no-default-features --features no-std
# Test dynamic linking
git clone https://github.com/ARMmbed/mbedtls.git
pushd mbedtls
git checkout mbedtls-2.22.0
./scripts/config.py crypto
SHARED=1 make
popd
# Clean before to force dynamic linking
cargo clean
MBEDTLS_LIB_DIR=$(pwd)/mbedtls/library MBEDTLS_INCLUDE_DIR=$(pwd)/mbedtls/include cargo build --release
# Clean before to force static linking
cargo clean
MBEDTLS_LIB_DIR=$(pwd)/mbedtls/library MBEDTLS_INCLUDE_DIR=$(pwd)/mbedtls/include MBEDCRYPTO_STATIC=1 cargo build --release
# Clean before to only build the interface
cargo clean
MBEDTLS_INCLUDE_DIR=$(pwd)/mbedtls/include cargo build --release