diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4de7c7fa8..98ab144fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,6 @@ jobs: matrix: thing: - stable - - macos-x86_64 - arm-android - arm64-android - i686-android @@ -76,72 +75,113 @@ jobs: - i686-linux - arm-linux - aarch64-linux - - x86_64-musl + - arm64-macos + - x86_64-macos - x86_64-mingw - i686-msvc - x86_64-msvc include: + - check_only: false + - extra_test_args: '' + - apt_packages: '' + - custom_env: {} - thing: stable target: x86_64-unknown-linux-gnu rust: stable os: ubuntu-latest - - thing: macos-x86_64 - target: x86_64-apple-darwin - rust: stable - os: macos-latest - thing: arm-android - target: arm-linux-androideabi + target: armv7-linux-androideabi rust: stable os: ubuntu-latest + check_only: true - thing: arm64-android target: aarch64-linux-android rust: stable os: ubuntu-latest + check_only: true - thing: i686-android target: i686-linux-android rust: stable os: ubuntu-latest + check_only: true - thing: x86_64-android target: x86_64-linux-android rust: stable os: ubuntu-latest + check_only: true - thing: aarch64-ios target: aarch64-apple-ios os: macos-latest + check_only: true + # It's... theoretically possible to run tests on iPhone Simulator, + # but for now, make sure that BoringSSL only builds. - thing: aarch64-ios-sim target: aarch64-apple-ios-sim os: macos-latest + check_only: true - thing: x86_64-ios target: x86_64-apple-ios os: macos-latest + check_only: true - thing: i686-linux target: i686-unknown-linux-gnu rust: stable os: ubuntu-latest + apt_packages: gcc-multilib g++-multilib - thing: arm-linux target: arm-unknown-linux-gnueabi rust: stable os: ubuntu-latest + apt_packages: gcc-arm-linux-gnueabi g++-arm-linux-gnueabi + check_only: true + custom_env: + CC: arm-linux-gnueabi-gcc + CXX: arm-linux-gnueabi-g++ + CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER: arm-linux-gnueabi-g++ - thing: aarch64-linux target: aarch64-unknown-linux-gnu rust: stable os: ubuntu-latest - - thing: x86_64-musl - target: x86_64-unknown-linux-musl + apt_packages: crossbuild-essential-arm64 + check_only: true + custom_env: + CC: aarch64-linux-gnu-gcc + CXX: aarch64-linux-gnu-g++ + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-g++ + - thing: arm64-macos + target: aarch64-apple-darwin rust: stable - os: ubuntu-latest + os: macos-latest + check_only: true + - thing: x86_64-macos + target: x86_64-apple-darwin + rust: stable + os: macos-latest - thing: x86_64-mingw target: x86_64-pc-windows-gnu rust: stable - os: ubuntu-latest + os: windows-latest + check_only: true # tests are flaky for unclear reasons + custom_env: + CC: gcc + CXX: g++ + C_INCLUDE_PATH: "C:\\msys64\\usr\\include" + CPLUS_INCLUDE_PATH: "C:\\msys64\\usr\\include" + LIBRARY_PATH: "C:\\msys64\\usr\\lib" + # CI's Windows doesn't have required root certs + extra_test_args: --workspace --exclude tokio-boring --exclude hyper-boring - thing: i686-msvc target: i686-pc-windows-msvc rust: stable-x86_64-msvc os: windows-latest + # CI's Windows doesn't have required root certs + extra_test_args: --workspace --exclude tokio-boring --exclude hyper-boring - thing: x86_64-msvc target: x86_64-pc-windows-msvc rust: stable-x86_64-msvc os: windows-latest + # CI's Windows doesn't have required root certs + extra_test_args: --workspace --exclude tokio-boring --exclude hyper-boring steps: - uses: actions/checkout@v2 @@ -151,6 +191,10 @@ jobs: run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} shell: bash - run: rustup target add ${{ matrix.target }} + - name: Install target-specific APT dependencies + if: "matrix.apt_packages != ''" + run: sudo apt update && sudo apt install -y ${{ matrix.apt_packages }} + shell: bash - name: Install nasm if: startsWith(matrix.os, 'windows') run: choco install nasm @@ -164,18 +208,19 @@ jobs: - name: Set LIBCLANG_PATH if: startsWith(matrix.os, 'windows') run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV - - if: "startsWith(matrix.os, 'windows') && !contains(matrix.target, 'ios')" - # CI's Windows doesn't have require root certs - run: cargo test --workspace --exclude tokio-boring --exclude hyper-boring - name: Run tests (Windows) - - if: "!startsWith(matrix.os, 'windows') && !contains(matrix.target, 'ios')" - run: cargo test - name: Run tests (not Windows) - - if: "contains(matrix.target, 'ios')" - # It's... theoretically possible to run tests on iPhone Simulator, - # but for now, make sure that BoringSSL only builds. - run: cargo check --target ${{ matrix.target }} --all-targets - name: Check tests (iOS) + - name: Set Android Linker path + if: endsWith(matrix.thing, '-android') + run: echo "CARGO_TARGET_$(echo ${{ matrix.target }} | tr \\-a-z _A-Z)_LINKER=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/$(echo ${{ matrix.target }} | sed s/armv7/armv7a/)21-clang++" >> "$GITHUB_ENV" + - name: Build tests + # We `build` because we want the linker to verify we are cross-compiling correctly for check-only targets. + run: cargo build --target ${{ matrix.target }} --tests ${{ matrix.extra_test_args }} + shell: bash + env: ${{ matrix.custom_env }} + - name: Run tests + if: "!matrix.check_only" + run: cargo test --target ${{ matrix.target }} ${{ matrix.extra_test_args }} + shell: bash + env: ${{ matrix.custom_env }} - name: Test boring-sys cargo publish # Running `cargo publish --dry-run` tests two things: # diff --git a/boring-sys/build/config.rs b/boring-sys/build/config.rs index 12e89ffa8..79d119fcd 100644 --- a/boring-sys/build/config.rs +++ b/boring-sys/build/config.rs @@ -8,7 +8,6 @@ pub(crate) struct Config { pub(crate) host: String, pub(crate) target: String, pub(crate) target_arch: String, - pub(crate) target_env: String, pub(crate) target_os: String, pub(crate) features: Features, pub(crate) env: Env, @@ -42,7 +41,6 @@ impl Config { let host = env::var("HOST").unwrap(); let target = env::var("TARGET").unwrap(); let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap(); - let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap(); let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap(); let features = Features::from_env(); @@ -58,7 +56,6 @@ impl Config { host, target, target_arch, - target_env, target_os, features, env, diff --git a/boring-sys/build/main.rs b/boring-sys/build/main.rs index e9749ff9b..b2ed72f65 100644 --- a/boring-sys/build/main.rs +++ b/boring-sys/build/main.rs @@ -153,7 +153,7 @@ fn get_boringssl_source_path(config: &Config) -> &PathBuf { /// so adjust library location based on platform and build target. /// See issue: https://github.com/alexcrichton/cmake-rs/issues/18 fn get_boringssl_platform_output_path(config: &Config) -> String { - if config.target_env == "msvc" { + if config.target.ends_with("-msvc") { // Code under this branch should match the logic in cmake-rs let debug_env_var = config .env @@ -676,6 +676,7 @@ fn main() { .size_t_is_usize(true) .layout_tests(true) .prepend_enum_name(true) + .blocklist_type("max_align_t") // Not supported by bindgen on all targets, not used by BoringSSL .clang_args(get_extra_clang_args_for_bindgen(&config)) .clang_arg("-I") .clang_arg(include_path.display().to_string());