44
55ROOT=" ${GITHUB_WORKSPACE:- $(git rev-parse --show-toplevel)} "
66
7+ latest_release=0
8+ for arg in " $@ " ; do
9+ if [ " $arg " = " --latest-release" ]; then
10+ latest_release=1
11+ fi
12+ done
13+
714CLEANUP_ON_EXIT=()
815
916function cleanup() {
@@ -49,9 +56,11 @@ rm -rf "${RUSTLS_WEBPKI_DIR}" # Cleanup before we clone
4956
5057RUSTLS_DIR=" $( mktemp -d) "
5158CLEANUP_ON_EXIT+=(" ${RUSTLS_DIR} " )
52- cargo download rustls | tar xvzf - -C " ${RUSTLS_DIR} " --strip-components=1
53- RUSTLS_COMMIT=" $( jq -r ' .git.sha1' ${RUSTLS_DIR} /.cargo_vcs_info.json) "
54- rm -rf " ${RUSTLS_DIR} " # Cleanup before we clone
59+ if [[ $latest_release == " 1" ]]; then
60+ cargo download rustls | tar xvzf - -C " ${RUSTLS_DIR} " --strip-components=1
61+ RUSTLS_COMMIT=" $( jq -r ' .git.sha1' ${RUSTLS_DIR} /.cargo_vcs_info.json) "
62+ rm -rf " ${RUSTLS_DIR} " # Cleanup before we clone
63+ fi
5564
5665git clone https://github.com/rustls/rcgen " ${RUSTLS_RCGEN_DIR} "
5766git clone https://github.com/rustls/webpki.git " ${RUSTLS_WEBPKI_DIR} "
8695# Trigger Cargo to generate the lock file
8796cargo update
8897cargo update " aws-lc-rs@${AWS_LC_RS_VERSION} "
89- cargo tree -i aws-lc-rs --features aws_lc_rs
90- cargo test --features aws_lc_rs
98+ cargo tree -i aws-lc-rs --features aws-lc-rs
99+ cargo test --features aws-lc-rs
91100popd & > /dev/null # "${RUSTLS_WEBPKI_DIR}"
92101
93102pushd " ${RUSTLS_DIR} "
94- git checkout " ${RUSTLS_COMMIT} "
103+ if [[ $latest_release == " 1" ]]; then
104+ git checkout " ${RUSTLS_COMMIT} "
105+ fi
95106rm Cargo.lock
96107# Update the Cargo.toml to use the GitHub repository reference under test.
97108RUSTLS_RCGEN_STRING=" ^rcgen = { .* }"
@@ -114,8 +125,8 @@ pushd ./rustls
114125
115126# Print the dependency tree for debug purposes, if we did everything right there
116127# should only be one aws-lc-rs version. Otherwise this will fail sine there are multiple versions
117- cargo tree -i aws-lc-rs --features aws_lc_rs
118- # Run the rustls tests with the aws_lc_rs feature enabled
119- cargo test --features aws_lc_rs
128+ cargo tree -i aws-lc-rs --features aws-lc-rs
129+ # Run the rustls tests with the aws-lc-rs feature enabled
130+ cargo test --features aws-lc-rs
120131popd & > /dev/null # ./rustls
121132popd & > /dev/null # ${RUSTLS_DIR}
0 commit comments