CI: depending on platform build without, with system, or with vendored TLS

This commit is contained in:
Travis Burtrum 2019-12-16 14:23:12 -05:00
parent 9b2866c5b4
commit d46c440b4e
7 changed files with 38 additions and 19 deletions

View File

@ -13,6 +13,8 @@ env:
global:
# TODO Update this to match the name of your project.
- CRATE_NAME=wireguard-proxy
- OPENSSL_STATIC=1
- CARGO_FEATURES=openssl_vendored
matrix:
# TODO These are all the build jobs. Adjust as necessary. Comment out what you
@ -28,13 +30,13 @@ matrix:
# iOS
- env: TARGET=aarch64-apple-ios DISABLE_TESTS=1
os: osx
- env: TARGET=armv7-apple-ios DISABLE_TESTS=1
- env: TARGET=armv7-apple-ios DISABLE_TESTS=1 CARGO_FEATURES=default
os: osx
- env: TARGET=armv7s-apple-ios DISABLE_TESTS=1
- env: TARGET=armv7s-apple-ios DISABLE_TESTS=1 CARGO_FEATURES=default
os: osx
- env: TARGET=i386-apple-ios DISABLE_TESTS=1
- env: TARGET=i386-apple-ios DISABLE_TESTS=1 CARGO_FEATURES=default
os: osx
- env: TARGET=x86_64-apple-ios DISABLE_TESTS=1
- env: TARGET=x86_64-apple-ios DISABLE_TESTS=1 CARGO_FEATURES=default
os: osx
# Linux
@ -61,12 +63,14 @@ matrix:
os: osx
# *BSD
# travis-ci freebsd is broken now for some reason
# - env: TARGET=i686-unknown-freebsd DISABLE_TESTS=1
# - env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1
- env: TARGET=x86_64-unknown-netbsd DISABLE_TESTS=1
# netbsd fails with vendored openssl, but built in one is fine
- env: TARGET=x86_64-unknown-netbsd DISABLE_TESTS=1 CARGO_FEATURES=tls
# Windows
- env: TARGET=x86_64-pc-windows-gnu
- env: TARGET=x86_64-pc-windows-gnu CARGO_FEATURES=default
# Bare metal
# These targets don't support std and as such are likely not suitable for

10
Cargo.lock generated
View File

@ -56,6 +56,14 @@ dependencies = [
"openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "openssl-src"
version = "111.6.1+1.1.1d"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "openssl-sys"
version = "0.9.53"
@ -64,6 +72,7 @@ dependencies = [
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-src 111.6.1+1.1.1d (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
"vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -95,6 +104,7 @@ dependencies = [
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
"checksum openssl 0.10.26 (registry+https://github.com/rust-lang/crates.io-index)" = "3a3cc5799d98e1088141b8e01ff760112bbd9f19d850c124500566ca6901a585"
"checksum openssl-src 111.6.1+1.1.1d (registry+https://github.com/rust-lang/crates.io-index)" = "c91b04cb43c1a8a90e934e0cd612e2a5715d976d2d6cff4490278a0cddf35005"
"checksum openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)" = "465d16ae7fc0e313318f7de5cecf57b2fbe7511fd213978b457e1c96ff46736f"
"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
"checksum vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168"

View File

@ -20,8 +20,9 @@ include = [
]
[features]
default = ["tls"]
default = []
tls = ["openssl"]
openssl_vendored = ["openssl/vendored"]
[dependencies]
openssl = { version = "0.10.26", optional = true }

View File

@ -9,13 +9,18 @@ environment:
# TODO Update this to match the name of your project.
CRATE_NAME: wireguard-proxy
# gnu fails to compile with any openssl combo for some reason
OPENSSL_STATIC: 1
CARGO_FEATURES: openssl_vendored
# TODO These are all the build jobs. Adjust as necessary. Comment out what you
# don't need
matrix:
# MinGW
- TARGET: i686-pc-windows-gnu
CARGO_FEATURES: default
- TARGET: x86_64-pc-windows-gnu
CARGO_FEATURES: default
# MSVC
- TARGET: i686-pc-windows-msvc
@ -23,6 +28,7 @@ environment:
# Testing other channels
- TARGET: x86_64-pc-windows-gnu
CARGO_FEATURES: default
RUST_VERSION: nightly
- TARGET: x86_64-pc-windows-msvc
RUST_VERSION: nightly
@ -44,15 +50,14 @@ install:
test_script:
# we don't run the "test phase" when doing deploys
- if [%APPVEYOR_REPO_TAG%]==[false] (
cargo build --target %TARGET% &&
cargo build --target %TARGET% --release &&
cargo run --target %TARGET% --release --bin udp-test &&
cargo run --target %TARGET% --release --bin udp-test -- -is
cargo build --target %TARGET% --release --features %CARGO_FEATURES% &&
cargo run --target %TARGET% --release --features %CARGO_FEATURES% --bin udp-test &&
cargo run --target %TARGET% --release --features %CARGO_FEATURES% --bin udp-test -- -is
)
before_deploy:
# TODO Update this to build the artifacts that matter to you
- cargo rustc --target %TARGET% --release --bin wireguard-proxy -- -C lto
- cargo rustc --target %TARGET% --release --features %CARGO_FEATURES% --bin wireguard-proxy -- -C lto
- ps: ci\before_deploy.ps1
deploy:

View File

@ -18,7 +18,7 @@ main() {
test -f Cargo.lock || cargo generate-lockfile
# TODO Update this to build the artifacts that matter to you
cross rustc --bin wireguard-proxy --target $TARGET --release -- -C lto
cross rustc --bin wireguard-proxy --target $TARGET --release --features $CARGO_FEATURES -- -C lto
# TODO Update this to package the right artifacts, this needs to handle .exe too...
case $TARGET in

View File

@ -4,18 +4,17 @@ set -ex
# TODO This is the "test phase", tweak it as you see fit
main() {
cross build --target $TARGET
cross build --target $TARGET --release
cross build --target $TARGET --release --features $CARGO_FEATURES
if [ ! -z $DISABLE_TESTS ]; then
return
fi
# first make sure udp-test succeeds running against itself
cross run --target $TARGET --release --bin udp-test
cross run --target $TARGET --release --features $CARGO_FEATURES --bin udp-test
# now run udp-test through proxy/proxyd
cross run --target $TARGET --release --bin udp-test -- -is
cross run --target $TARGET --release --features $CARGO_FEATURES --bin udp-test -- -is
}
# we don't run the "test phase" when doing deploys

View File

@ -8,14 +8,14 @@ use std::time::Duration;
mod error;
use error::Result;
#[cfg(feature = "tls")]
#[cfg(any(feature = "tls", feature = "openssl_vendored"))]
#[path = ""]
mod tls {
pub mod openssl;
pub use crate::tls::openssl::{TlsStream, TlsListener};
}
#[cfg(not(feature = "tls"))]
#[cfg(not(any(feature = "tls", feature = "openssl_vendored")))]
#[path = ""]
mod tls {
pub mod notls;