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