3939 id-token : write
4040 contents : read
4141 steps :
42+ - name : Configure AWS Credentials
43+ uses : aws-actions/configure-aws-credentials@v4
44+ with :
45+ aws-region : us-west-2
46+ role-to-assume : arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2
47+ role-session-name : DDBEC-Dafny-Java-Tests
48+
4249 - name : Install Java
4350 uses : actions/setup-java@v5
4451 with :
@@ -51,22 +58,27 @@ jobs:
5158 tar -xf dynamodb_local_latest.tar.gz
5259
5360 - name : Start DynamoDB Local
54- run : java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -inMemory -sharedDb &
55- # The & runs the Java process in the background.
61+ run : |
62+ java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar \
63+ -inMemory -sharedDb -port 8000 > dynamodb-local.log 2>&1 &
64+ echo $! > dynamodb-local.pid
5665
5766 - name : Wait for DynamoDB Local
5867 run : |
5968 echo "Waiting for DynamoDB Local to start..."
60- until curl -s http://localhost:8000; do
61- sleep 1
69+ for i in {1..30}; do
70+ if curl -s -f http://localhost:8000 > /dev/null 2>&1; then
71+ echo "DynamoDB Local is ready"
72+ break
73+ fi
74+ echo "Attempt $i: DynamoDB Local not ready yet..."
75+ sleep 2
6276 done
63-
64- - name : Configure AWS Credentials
65- uses : aws-actions/configure-aws-credentials@v4
66- with :
67- aws-region : us-west-2
68- role-to-assume : arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2
69- role-session-name : DDBEC-Dafny-Java-Tests
77+ # Verify it's actually working
78+ curl -X POST http://localhost:8000 \
79+ -H "Content-Type: application/x-amz-json-1.0" \
80+ -H "X-Amz-Target: DynamoDB_20120810.ListTables" \
81+ -d '{}' || (cat dynamodb-local.log && exit 1)
7082
7183 - uses : actions/checkout@v3
7284 with :
0 commit comments