Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI to build for all matrix targets #1

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 36 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
thing:
- stable
Expand All @@ -81,6 +82,9 @@ jobs:
- i686-msvc
- x86_64-msvc
include:
- check_only: false
- extra_test_args: ''
- apt_packages: ''
- thing: stable
target: x86_64-unknown-linux-gnu
rust: stable
Expand All @@ -93,55 +97,77 @@ jobs:
target: arm-linux-androideabi
rust: stable
os: ubuntu-latest
apt_packages: gcc-multilib g++-multilib
check_only: true # TODO run with qemu?
- thing: arm64-android
target: aarch64-linux-android
rust: stable
os: ubuntu-latest
apt_packages: gcc-multilib g++-multilib
check_only: true # TODO run with qemu?
- thing: i686-android
target: i686-linux-android
rust: stable
os: ubuntu-latest
apt_packages: gcc-multilib
- thing: x86_64-android
target: x86_64-linux-android
rust: stable
os: ubuntu-latest
apt_packages: gcc-multilib
- 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 # TODO run with qemu?
- thing: aarch64-linux
target: aarch64-unknown-linux-gnu
rust: stable
os: ubuntu-latest
apt_packages: crossbuild-essential-arm64
check_only: true # TODO run with qemu?
- thing: x86_64-musl
target: x86_64-unknown-linux-musl
rust: stable
os: ubuntu-latest
apt_packages: musl-tools
- thing: x86_64-mingw
target: x86_64-pc-windows-gnu
rust: stable
os: ubuntu-latest
apt_packages: mingw-w64 binutils-mingw-w64
- 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
Expand All @@ -151,6 +177,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 install -y ${{ matrix.apt_packages }}
shell: bash
- name: Install nasm
if: startsWith(matrix.os, 'windows')
run: choco install nasm
Expand All @@ -164,18 +194,12 @@ 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)
- if: "!matrix.check_only"
run: cargo test --target ${{ matrix.target }} ${{ matrix.extra_test_args }}
name: Run tests
- if: matrix.check_only
run: cargo check --target ${{ matrix.target }} --tests
name: Check tests

test-fips:
name: Test FIPS integration
Expand Down
2 changes: 1 addition & 1 deletion boring-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ include = [
]

[build-dependencies]
bindgen = { version = "0.59", default-features = false, features = ["runtime"] }
bindgen = { version = "0.60", default-features = false, features = ["runtime"] }
cmake = "0.1"

[features]
Expand Down
35 changes: 27 additions & 8 deletions boring-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,34 @@ fn get_boringssl_cmake_config() -> cmake::Config {
boringssl_cmake
}

"windows" => {
if std::env::var("HOST").unwrap() != std::env::var("TARGET").unwrap() {
// BoringSSL's CMakeLists.txt isn't set up for cross-compiling using Visual Studio.
// Disable assembly support so that it at least builds.
boringssl_cmake.define("OPENSSL_NO_ASM", "YES");
}
boringssl_cmake
}

_ => {
// Configure BoringSSL for building on 32-bit non-windows platforms.
if arch == "x86" && os != "windows" {
boringssl_cmake.define(
"CMAKE_TOOLCHAIN_FILE",
pwd.join(BORING_SSL_PATH)
.join("src/util/32-bit-toolchain.cmake")
.as_os_str(),
);
if std::env::var("HOST").unwrap() != std::env::var("TARGET").unwrap() {
match arch.as_str() {
"x86" => {
boringssl_cmake.define(
"CMAKE_TOOLCHAIN_FILE",
pwd.join(BORING_SSL_PATH)
.join("src/util/32-bit-toolchain.cmake")
.as_os_str(),
);
}
"aarch64" => {
boringssl_cmake.define(
"CMAKE_TOOLCHAIN_FILE",
pwd.join("cmake/aarch64.cmake").as_os_str(),
);
}
_ => {}
}
}

boringssl_cmake
Expand Down
3 changes: 3 additions & 0 deletions boring-sys/cmake/aarch64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# A proper CMake toolchain also sets CMAKE_SYSTEM_NAME,
# but BoringSSL deosn't actually rely on that.
set(CMAKE_SYSTEM_PROCESSOR aarch64)
1 change: 0 additions & 1 deletion boring-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use std::convert::TryInto;
use std::ffi::c_void;
use std::os::raw::{c_char, c_int, c_uint, c_ulong};

#[allow(deref_nullptr)] // TODO: remove this when https://github.com/rust-lang/rust-bindgen/issues/1651 finally gets fixed
mod generated {
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}
Expand Down