Skip to content

Commit 1cbed51

Browse files
authored
Wire-up rust-openssl into GitHub CI (for the time being) (#2291)
### Description of changes: Adds validation that AWS-LC will build with rust-openssl when using the bindgen feature or bindgen-cli if pointed at an AWS-LC installation directory. We will add coverage on the aws-lc-rs side specifically for handling coverage of the crate specific feature flag that toggles on `aws-lc-sys`. ### Call-outs: Not putting this into CodeBuild right now as it would require building new docker images with Rust, and the current process is influx. Will wait for the new deployment process to be completed so we can guarantee more frequently updated rust compiler releases without having to automate that with each invocation. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.
1 parent bd41f9a commit 1cbed51

4 files changed

Lines changed: 81 additions & 3 deletions

File tree

.github/workflows/integrations.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,28 @@ jobs:
4848
- name: Run librdkafka build
4949
run: |
5050
./tests/ci/integration/run_librdkafka_integration.sh
51-
51+
rust-openssl:
52+
if: github.repository_owner == 'aws'
53+
runs-on: ubuntu-latest
54+
steps:
55+
- name: Checkout aws-lc
56+
uses: actions/checkout@v4
57+
with:
58+
path: aws-lc
59+
- name: Checkout rust-openssl
60+
uses: actions/checkout@v4
61+
with:
62+
repository: sfackler/rust-openssl
63+
path: rust-openssl
64+
- uses: dtolnay/rust-toolchain@stable
65+
id: toolchain
66+
- name: Set Rust toolchain override
67+
run: rustup override set ${{ steps.toolchain.outputs.name }}
68+
- name: Install bindgen-cli
69+
run: cargo install --locked bindgen-cli
70+
- name: Run rust-openssl integration tests
71+
env:
72+
RUST_OPENSSL_SRC_DIR: "${{ github.workspace }}/rust-openssl"
73+
run: |
74+
pushd "${GITHUB_WORKSPACE}/aws-lc"
75+
./tests/ci/integration/run_rust_openssl_integration.sh

tests/ci/integration/run_bind9_integration.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#!/bin/bash -exu
1+
#!/usr/bin/env bash
22
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
# SPDX-License-Identifier: Apache-2.0 OR ISC
44

5+
set -exu
6+
57
source tests/ci/common_posix_setup.sh
68

79
# Set up environment.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
# SPDX-License-Identifier: Apache-2.0 OR ISC
4+
5+
set -exo pipefail
6+
7+
source tests/ci/common_posix_setup.sh
8+
9+
if [[ -z "${RUST_OPENSSL_SRC_DIR}" ]]; then
10+
echo "RUST_OPENSSL_SRC_DIR environment variable must be set"
11+
exit 1
12+
fi
13+
14+
# Create build directory and navigate to it
15+
AWS_LC_SRC_DIR="${SRC_ROOT}"
16+
AWS_LC_BUILD_DIR="${SYS_ROOT}/aws-lc-build"
17+
AWS_LC_SHARED_INSTALL_DIR="${SYS_ROOT}/aws-lc-install-shared"
18+
AWS_LC_STATIC_INSTALL_DIR="${SYS_ROOT}/aws-lc-install-static"
19+
20+
function validate_rust_openssl() {
21+
OPENSSL_DIR="${1}"
22+
OPENSSL_STATIC="${2}"
23+
24+
# Find the path to libcrypto.so and store its directory as it can be different depending on OS distribution
25+
ADDITIONAL_ENV_VARS=()
26+
if [[ "${OPENSSL_STATIC}" -eq 0 ]]; then
27+
LIB_DIR=$(find "${OPENSSL_DIR}" -name "libcrypto.so" -exec dirname {} \; | head -n 1)
28+
ADDITIONAL_ENV_VARS+=("LD_LIBRARY_PATH=${LIB_DIR}:${LD_LIBRARY_PATH}")
29+
fi
30+
31+
pushd "${RUST_OPENSSL_SRC_DIR}"
32+
cargo -v clean
33+
env OPENSSL_DIR="${OPENSSL_DIR}" OPENSSL_STATIC="${OPENSSL_STATIC}" "${ADDITIONAL_ENV_VARS[@]}" \
34+
cargo -v test -p openssl-sys --release --no-default-features "${@:3}"
35+
env OPENSSL_DIR="${OPENSSL_DIR}" OPENSSL_STATIC="${OPENSSL_STATIC}" "${ADDITIONAL_ENV_VARS[@]}" \
36+
cargo -v test -p openssl --release --no-default-features "${@:3}"
37+
38+
popd # "${RUST_OPENSSL_SRC_DIR}"
39+
}
40+
41+
AWS_LC_BUILD_ARGS=("-DBUILD_TESTING=OFF" "-DBUILD_TOOL=OFF" "-DCMAKE_BUILD_TYPE=RelWithDebInfo")
42+
43+
aws_lc_build "${AWS_LC_SRC_DIR}" "${AWS_LC_BUILD_DIR}" "${AWS_LC_SHARED_INSTALL_DIR}" "${AWS_LC_BUILD_ARGS[@]}" -DBUILD_SHARED_LIBS=1
44+
aws_lc_build "${AWS_LC_SRC_DIR}" "${AWS_LC_BUILD_DIR}" "${AWS_LC_STATIC_INSTALL_DIR}" "${AWS_LC_BUILD_ARGS[@]}" -DBUILD_SHARED_LIBS=0
45+
46+
validate_rust_openssl "${AWS_LC_SHARED_INSTALL_DIR}" 0
47+
validate_rust_openssl "${AWS_LC_STATIC_INSTALL_DIR}" 1
48+
49+
validate_rust_openssl "${AWS_LC_SHARED_INSTALL_DIR}" 0 -F bindgen
50+
validate_rust_openssl "${AWS_LC_STATIC_INSTALL_DIR}" 1 -F bindgen

tests/ci/integration/run_strongswan_integration.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#!/bin/bash -exu
1+
#!/usr/bin/env bash
22
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
# SPDX-License-Identifier: Apache-2.0 OR ISC
44

5+
set -exu
6+
57
source tests/ci/common_posix_setup.sh
68

79
# Set up environment.

0 commit comments

Comments
 (0)