Skip to content

Commit 7b45929

Browse files
authored
chore(rust): add comments to release scripts
1 parent c0ec84d commit 7b45929

File tree

5 files changed

+43
-7
lines changed

5 files changed

+43
-7
lines changed

DynamoDbEncryption/runtimes/rust/RELEASE.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@ To publish a new version of the aws-db-esdk for version N.N.N
33
1. Acquire the appropriate permissions
44
1. Ensure git checkout of main is fresh and clean
55
1. ./start_release.sh N.N.N
6-
1. cd ../../../releases/rust/db_esdk
6+
1. `cd ../../../releases/rust/db_esdk`
77
1. Create a PR with all changed or added files
8-
1. cargo publish
9-
1. cd ../../../DynamoDbEncryption/runtimes/rust/ # i.e. return here
8+
1. Within the PR, make sure you also:
9+
1. Update the `CHANGELOG.md` in the root directory with the changes
10+
1. If this is a major version bump, update the `SUPPORT_POLICY.rst` for Rust
11+
1. Get the PR reviewed by a teammate
12+
1. Before merging the PR, publish the new version of the `aws-db-esdk` crate and test the published crate (documented in next steps)
13+
1. Run `cargo publish`
14+
1. `cd ../../../DynamoDbEncryption/runtimes/rust/` # i.e. return here
1015
1. ./test_published.sh N.N.N
16+
1. Ignore/stash the changes in `DynamoDbEncryption/runtimes/rust/test_examples/Cargo.toml` which adds the `aws-db-esdk`
17+
1. Merge the release PR
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,57 @@
11
#!/bin/bash -eu
22

3+
# Check if exactly one argument is provided
34
if [ "$#" -ne 1 ]; then
45
echo 1>&2 "USAGE: start_release.sh N.N.N"
56
exit 1
67
fi
78

9+
# Go to the directory of this script
810
cd $( dirname ${BASH_SOURCE[0]} )
911

12+
# Check if the provided argument matches the version pattern
1013
REGEX_VERSION='^\d+\.\d+\.\d+$'
1114
MATCHES=$(echo "$1" | egrep $REGEX_VERSION | wc -l)
1215
if [ $MATCHES -eq 0 ]; then
1316
echo 1>&2 "Version \"$1\" must be N.N.N"
1417
exit 1
1518
fi
1619

20+
# Update the version in Cargo.toml
1721
perl -pe "s/^version = .*$/version = \"$1\"/" < Cargo.toml > new_Cargo.toml
1822
mv new_Cargo.toml Cargo.toml
1923

24+
# Remove all files and directories in src except for specified files
2025
find src -depth 1 | egrep -v '(intercept.rs|lib.rs|software_externs.rs)' | xargs rm -rf
26+
27+
# Change to the parent directory and run make polymorph and transpile commands
2128
cd ../..
2229
make polymorph_rust transpile_rust test_rust
30+
31+
# Remove target directory
2332
cd runtimes/rust
2433
rm -rf target
34+
35+
# Remove existing release directory and copy current directory to releases
2536
rm -rf ../../../releases/rust/db_esdk
2637
cp -r . ../../../releases/rust/db_esdk
38+
39+
# Go to the release directory
2740
cd ../../../releases/rust/db_esdk
41+
42+
# Restore the dafny_runtime_rust directory that was previously tracked by Git but had been deleted
2843
git checkout dafny_runtime_rust
44+
45+
# Remove unnecessary files and directories
2946
rm -rf *~ copy_externs.sh start_release.sh test_published.sh test_examples *.pem RELEASE.md
47+
48+
# Create .gitignore file with specified entries
3049
echo Cargo.lock > .gitignore
3150
echo target >> .gitignore
3251

52+
# Run cargo test and example tests
3353
cargo test
3454
cargo run --example main
35-
rm -f Cargo.lock *.pem
3655

56+
# Remove Cargo.lock and .pem files after testing the examples
57+
rm -f Cargo.lock *.pem

DynamoDbEncryption/runtimes/rust/test_examples/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[package]
22
name = "aws-db-esdk-examples"
3-
version = "0.1.0"
43
edition = "2021"
54
rust-version = "1.80.0"
65

Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#!/bin/bash -eu
22

3+
# Check if exactly one argument is provided
34
if [ "$#" -ne 1 ]; then
45
echo 1>&2 "USAGE: test_published.sh N.N.N"
56
exit 1
67
fi
78

9+
# Go to the directory of this script
810
cd $( dirname ${BASH_SOURCE[0]} )
911

12+
# Check if the provided argument matches the version pattern
1013
REGEX_VERSION='^\d+\.\d+\.\d+$'
11-
1214
echo "$1" | egrep -q $REGEX_VERSION
1315
if [ $? -ne 0 ]; then
1416
echo 1>&2 "Version \"$1\" must be N.N.N"
@@ -17,14 +19,21 @@ fi
1719

1820
VERSION=$1
1921

22+
# Update examples in test_examples directory
2023
rm -rf test_examples/src
2124
cp -r examples test_examples/src/
2225
cd test_examples
26+
27+
# Add aws-db-esdk
2328
cargo add aws-db-esdk
29+
30+
# Check if the added version matches the provided version
2431
MATCH=$(fgrep "aws-db-esdk = \"$VERSION\"" Cargo.toml | wc -l)
2532
if [ $MATCH -eq "0" ]; then
2633
echo Version $VERSION of aws-db-esdk not the most recent
2734
egrep '^aws-db-esdk' Cargo.toml
2835
exit 1
2936
fi
37+
38+
# Run the cargo project
3039
cargo run

submodules/smithy-dafny

0 commit comments

Comments
 (0)