2020 type : string
2121
2222jobs :
23+ format :
24+ runs-on : ubuntu-latest
25+ timeout-minutes : 5
26+
27+ steps :
28+ - name : Checkout code
29+ uses : actions/checkout@v4
30+
31+ - name : Set up Rust
32+ run : rustup update
33+
34+ - name : Check formatting
35+ working-directory : ./rust/cluster_management
36+ run : |
37+ rustup component add rustfmt
38+ cargo fmt -- --check
39+
2340 test :
2441 runs-on : ubuntu-latest
2542 timeout-minutes : 15
@@ -32,19 +49,49 @@ jobs:
3249 pull-requests : write
3350
3451 steps :
35- - name : Checkout code
36- uses : actions/checkout@v4
37-
38- - name : Set up Rust
39- run : rustup update
40-
41- - name : Configure AWS Credentials
42- uses : aws-actions/configure-aws-credentials@v4
43- with :
44- role-to-assume : ${{ secrets.RUST_IAM_ROLE }}
45- aws-region : us-east-1
46-
47- - name : Configure and run integration for cluster management
48- working-directory : ./rust/cluster_management
49- run : |
50- cargo test
52+ - name : Checkout code
53+ uses : actions/checkout@v4
54+
55+ - name : Set up Rust
56+ run : rustup update
57+
58+ - name : Configure AWS Credentials
59+ uses : aws-actions/configure-aws-credentials@v4
60+ with :
61+ role-to-assume : ${{ secrets.RUST_IAM_ROLE }}
62+ aws-region : us-east-1
63+
64+ - name : Configure and run integration for cluster management
65+ working-directory : ./rust/cluster_management
66+ run : |
67+ cargo test -- --nocapture
68+
69+ # This is a sanity check to make sure the examples are independently executable. We don't need the binary to do
70+ # anything useful here, beyond running long enough to complain about the missing environment variable.
71+ run-binary :
72+ runs-on : ubuntu-latest
73+ timeout-minutes : 5
74+
75+ steps :
76+ - name : Checkout code
77+ uses : actions/checkout@v4
78+
79+ - name : Set up Rust
80+ run : rustup update
81+
82+ - name : Build and run get_cluster binary
83+ working-directory : ./rust/cluster_management
84+ run : |
85+ # Run the binary and capture its output
86+ output=$(cargo run --bin get_cluster 2>&1) || true
87+
88+ # Check if the output contains the expected error message about CLUSTER_REGION
89+ if echo "$output" | grep -q "env variable \`CLUSTER_REGION\` should be set"; then
90+ echo "Binary correctly reported missing CLUSTER_REGION environment variable"
91+ exit 0
92+ else
93+ echo "Binary did not produce the expected error message about missing environment variables"
94+ echo "Actual output was:"
95+ echo "$output"
96+ exit 1
97+ fi
0 commit comments