From e4f013d73f7db6366b4bf6458f199e438f88e075 Mon Sep 17 00:00:00 2001 From: Andrew Whitehead Date: Tue, 2 Feb 2021 12:12:10 -0800 Subject: [PATCH] build vendored openssl Signed-off-by: Andrew Whitehead --- .github/workflows/build.yml | 2 ++ .github/workflows/rusttest.yml | 50 ++++++++++++++++++++++++++-------- build.sh | 5 ++-- indy-credx/Cargo.toml | 1 + indy-data-types/Cargo.toml | 2 ++ 5 files changed, 46 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cbeda1b..a1d5c4d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,7 @@ jobs: - name: Build library env: + BUILD_FEATURES: vendored BUILD_TARGET: ${{ matrix.target }} run: ./build.sh @@ -75,6 +76,7 @@ jobs: - name: Build library env: + BUILD_FEATURES: vendored BUILD_TARGET: ${{ matrix.target }} BUILD_TOOLCHAIN: ${{ matrix.toolchain }} run: ./build.sh diff --git a/.github/workflows/rusttest.yml b/.github/workflows/rusttest.yml index 67f99e5..dd2b7f4 100644 --- a/.github/workflows/rusttest.yml +++ b/.github/workflows/rusttest.yml @@ -7,14 +7,10 @@ on: branches: [main] jobs: - test: - name: Test Suite + lints: + name: Lints - strategy: - matrix: - os: [macos-latest, windows-latest, ubuntu-latest] - - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - name: Checkout sources @@ -40,25 +36,55 @@ jobs: command: fmt args: --all -- --check + test: + name: Test Suite + needs: [lints] + + strategy: + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + + - name: Cache cargo resources + uses: Swatinem/rust-cache@v1 + - name: Debug build uses: actions-rs/cargo@v1 with: command: build - args: --all-targets + args: --manifest-path indy-credx/Cargo.toml --features vendored - - name: Test default features + - name: Test indy-utils uses: actions-rs/cargo@v1 with: command: test + args: --manifest-path indy-utils/Cargo.toml - - name: Test CL + - name: Test indy-data-types (CL) uses: actions-rs/cargo@v1 with: command: test args: --manifest-path indy-data-types/Cargo.toml --features cl - - name: Test CL-native + - name: Test indy-data-types (CL-native) + uses: actions-rs/cargo@v1 + with: + command: test + args: --manifest-path indy-data-types/Cargo.toml --features cl_native,vendored + + - name: Test indy-credx (vendored) uses: actions-rs/cargo@v1 with: command: test - args: --manifest-path indy-data-types/Cargo.toml --features cl_native + args: --manifest-path indy-credx/Cargo.toml --features vendored diff --git a/build.sh b/build.sh index 91ca4c4..8955f32 100755 --- a/build.sh +++ b/build.sh @@ -10,6 +10,7 @@ RUSTUP=${RUSTUP:-`command -v rustup`} PROJECT=indy-credx LIB_NAME=indy_credx +FEATURES="${BUILD_FEATURES:-default}" if [ ! -x "$RUSTUP" ]; then echo "rustup command not found: it can be obtained from https://rustup.rs/" @@ -75,7 +76,7 @@ if [ "$TARGET" = "apple-darwin" ]; then TARGET_LIBS= for target in $MACOS_UNIVERSAL_TARGETS; do echo "Building $PROJECT for toolchain '$BUILD_TOOLCHAIN', target '$target'.." - $RUSTUP run $BUILD_TOOLCHAIN cargo build --release --target $target + $RUSTUP run $BUILD_TOOLCHAIN cargo build --manifest-path indy-credx/Cargo.toml --release --features $FEATURES --target $target TARGET_LIBS="./target/$target/release/lib${LIB_NAME}.dylib $TARGET_LIBS" done @@ -86,7 +87,7 @@ if [ "$TARGET" = "apple-darwin" ]; then else # Build normal target echo "Building $PROJECT for toolchain '$BUILD_TOOLCHAIN'.." - CMD="$RUSTUP run $BUILD_TOOLCHAIN cargo build --release" + CMD="$RUSTUP run $BUILD_TOOLCHAIN cargo build --manifest-path indy-credx/Cargo.toml --release --features $FEATURES" if [ -n "$TARGET" ]; then $CMD --target "$TARGET" else diff --git a/indy-credx/Cargo.toml b/indy-credx/Cargo.toml index f7203b7..b08b864 100644 --- a/indy-credx/Cargo.toml +++ b/indy-credx/Cargo.toml @@ -19,6 +19,7 @@ crate-type = ["staticlib", "rlib", "cdylib"] default = ["ffi"] ffi = ["ffi-support", "logger", "zeroize"] logger = ["env_logger"] +vendored = ["indy-data-types/vendored"] [dependencies] env_logger = { version = "0.7.1", optional = true } diff --git a/indy-data-types/Cargo.toml b/indy-data-types/Cargo.toml index 4550987..7f5a58e 100644 --- a/indy-data-types/Cargo.toml +++ b/indy-data-types/Cargo.toml @@ -23,8 +23,10 @@ hash = ["indy-utils/hash"] merkle_tree = ["hash"] rich_schema = [] serde_support = ["indy-utils/serde_support", "serde", "serde_json"] +vendored = ["openssl", "openssl/vendored"] [dependencies] +openssl = { version = "0.10", optional = true } once_cell = "1.4" regex = "1.3" serde = { version = "1.0", optional = true, features = ["derive"] }