version: 2.1 jobs: linux: parameters: target: type: string library: type: string default: "" version: type: string default: "" vendored: type: boolean default: false no_run: type: boolean default: false image: type: string default: 1.33.0 minimal_build: type: boolean default: false docker: - image: rust:<< parameters.image >> environment: RUST_BACKTRACE: 1 OPENSSL_DIR: /opt/openssl CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_AR: arm-linux-gnueabihf-ar CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER: qemu-arm-static steps: - checkout - run: apt-get update - run: apt-get remove -y libssl-dev - run: | case "<< parameters.target >>" in "i686-unknown-linux-gnu") apt-get install -y --no-install-recommends gcc-multilib ;; "x86_64-unknown-linux-musl") apt-get install -y --no-install-recommends musl-tools ;; "arm-unknown-linux-gnueabihf") dpkg --add-architecture armhf apt-get update apt-get install -y --no-install-recommends \ gcc-arm-linux-gnueabihf \ libc6-dev:armhf \ qemu-user-static ;; "x86_64-unknown-linux-gnu") exit 0 esac rustup target add << parameters.target >> - unless: condition: << parameters.vendored >> steps: - restore_cache: key: openssl-<< parameters.target >>-<< parameters.library >>-<< parameters.version >> - run: | if [ -d "$OPENSSL_DIR" ]; then exit 0 fi case "<< parameters.library >>" in "libressl") URL="https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-<< parameters.version >>.tar.gz" ;; "openssl") URL="https://openssl.org/source/openssl-<< parameters.version >>.tar.gz" ;; esac case "<< parameters.target >>" in "x86_64-unknown-linux-gnu") OS_COMPILER=linux-x86_64 OS_FLAGS="" ;; "i686-unknown-linux-gnu") OS_COMPILER=linux-elf OS_FLAGS=-m32 ;; "arm-unknown-linux-gnueabihf") OS_COMPILER=linux-armv4 OS_FLAGS="" export AR=arm-linux-gnueabihf-ar export CC=arm-linux-gnueabihf-gcc ;; esac mkdir /tmp/build cd /tmp/build curl -L $URL | tar --strip-components=1 -xzf - case "<< parameters.library >>" in "openssl") ./Configure --prefix=$OPENSSL_DIR $OS_COMPILER -fPIC -g $OS_FLAGS no-shared ;; "libressl") ./configure --prefix=$OPENSSL_DIR --disable-shared --with-pic ;; esac make make install_sw - save_cache: key: openssl-<< parameters.target >>-<< parameters.library >>-<< parameters.version >> paths: - /opt/openssl - restore_cache: key: registry - run: cargo generate-lockfile - save_cache: key: registry-{{ .BuildNum }} paths: - /usr/local/cargo/registry/index - restore_cache: key: deps-<< parameters.image >>-<< parameters.target >>-<< parameters.library >>-<< parameters.version >>-{{ checksum "Cargo.lock" }} - run: | cargo build \ --manifest-path=openssl/Cargo.toml \ <<# parameters.vendored >>--features vendored<> \ --target << parameters.target >> - unless: condition: << parameters.minimal_build >> steps: - run: | cargo run \ --manifest-path=systest/Cargo.toml \ <<# parameters.vendored >>--features vendored<> \ --target << parameters.target >> - run: | cargo test \ --manifest-path=openssl-errors/Cargo.toml \ <<# parameters.vendored >>--features openssl-sys/vendored<> \ --target << parameters.target >> \ <<# parameters.no_run >>--no-run<> - run: | ulimit -c unlimited cargo test \ --manifest-path=openssl/Cargo.toml \ <<# parameters.vendored >>--features vendored<> \ --target << parameters.target >> \ <<# parameters.no_run >>--no-run<> - save_cache: key: deps-<< parameters.image >>-<< parameters.target >>-<< parameters.library >>-<< parameters.version >>-{{ checksum "Cargo.lock" }} paths: - /usr/local/cargo/registry/cache - target - run: command: | mkdir -p /tmp/core_dumps find . -name "core.*" -exec cp \{\} /tmp/core_dumps \; cp target/<< parameters.target >>/debug/openssl-* /tmp/core_dumps when: on_fail - store_artifacts: path: /tmp/core_dumps macos: parameters: vendored: type: boolean default: false image: type: string default: 1.33.0 macos: xcode: "9.0" environment: RUST_BACKTRACE: 1 steps: - checkout - run: sudo mkdir /opt - run: sudo chown -R $USER /usr/local/ /opt - run: curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain << parameters.image >> - run: sudo ln -s ~/.cargo/bin/* /usr/local/bin - run: cargo generate-lockfile - restore_cache: key: deps-<< parameters.image >>-macos-<< parameters.vendored >>-{{ checksum "Cargo.lock" }} - run: | cargo run \ --manifest-path=systest/Cargo.toml \ <<# parameters.vendored >> --features vendored <> - run: | cargo test \ --manifest-path=openssl-errors/Cargo.toml \ <<# parameters.vendored >> --features openssl-sys/vendored <> - run: | cargo test \ --manifest-path=openssl/Cargo.toml \ <<# parameters.vendored >> --features vendored <> - save_cache: key: deps-<< parameters.image >>-macos-<< parameters.vendored >>-{{ checksum "Cargo.lock" }} paths: - ~/.cargo/registry/cache - target openssl_111: &openssl_111 library: openssl version: 1.1.1c openssl_110: &openssl_110 library: openssl version: 1.1.0k openssl_102: &openssl_102 library: openssl version: 1.0.2s openssl_101: &openssl_101 library: openssl version: 1.0.1u workflows: test: jobs: - linux: name: mimimal-version target: x86_64-unknown-linux-musl vendored: true image: 1.24.1 minimal_build: true - linux: name: musl-vendored target: x86_64-unknown-linux-musl vendored: true - linux: name: x86_64-vendored target: x86_64-unknown-linux-gnu vendored: true - linux: <<: *openssl_111 name: x86_64-openssl-1.1.1 target: x86_64-unknown-linux-gnu - linux: <<: *openssl_110 name: x86_64-openssl-1.1.0 target: x86_64-unknown-linux-gnu - linux: <<: *openssl_102 name: x86_64-openssl-1.0.2 target: x86_64-unknown-linux-gnu - linux: <<: *openssl_101 name: x86_64-openssl-1.0.1 target: x86_64-unknown-linux-gnu - linux: name: i686-vendored target: i686-unknown-linux-gnu vendored: true - linux: <<: *openssl_111 name: i686-openssl-1.1.1 target: i686-unknown-linux-gnu - linux: <<: *openssl_110 name: i686-openssl-1.1.0 target: i686-unknown-linux-gnu - linux: <<: *openssl_102 name: i686-openssl-1.0.2 target: i686-unknown-linux-gnu - linux: name: armhf-vendored target: arm-unknown-linux-gnueabihf vendored: true no_run: true - linux: <<: *openssl_111 name: armhf-openssl-1.1.1 target: arm-unknown-linux-gnueabihf no_run: true - linux: <<: *openssl_110 name: armhf-openssl-1.1.0 target: arm-unknown-linux-gnueabihf no_run: true - linux: <<: *openssl_102 name: armhf-openssl-1.0.2 target: arm-unknown-linux-gnueabihf no_run: true - linux: name: x86_64-libressl-2.5 target: x86_64-unknown-linux-gnu library: libressl version: 2.5.5 - linux: name: x86_64-libressl-3.0 target: x86_64-unknown-linux-gnu library: libressl version: 3.0.0 - macos: name: macos - macos: name: macos-vendored vendored: true