Skip to content

Commit 0501ee2

Browse files
committed
Fixes to github actions for limiting waiting on resources, and missing environment variables for tests
1 parent c82afa8 commit 0501ee2

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

.github/workflows/dotnet.yml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,60 @@ jobs:
2727

2828
- name: Wait for services to be ready
2929
run: |
30+
set -e
31+
3032
# Wait for RavenDB
31-
until curl -s http://localhost:8080; do
32-
echo "Waiting for RavenDB..."
33+
echo "Waiting for RavenDB..."
34+
for i in {1..60}; do
35+
if curl -s http://localhost:8080 > /dev/null; then
36+
echo "RavenDB is ready"
37+
break
38+
fi
3339
sleep 5
3440
done
41+
if ! curl -s http://localhost:8080 > /dev/null; then
42+
echo "RavenDB did not become ready in time"
43+
exit 1
44+
fi
45+
3546
# Wait for SQL Server
36-
until docker exec sqlserver /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Inforigami1 -Q "SELECT 1"; do
37-
echo "Waiting for SQL Server..."
47+
echo "Waiting for SQL Server..."
48+
for i in {1..60}; do
49+
if docker logs sqlserver 2>&1 | grep -q "SQL Server is now ready for client connections"; then
50+
echo "SQL Server is ready"
51+
break
52+
fi
3853
sleep 5
3954
done
55+
if ! docker logs sqlserver 2>&1 | grep -q "SQL Server is now ready for client connections"; then
56+
echo "SQL Server did not become ready in time"
57+
exit 1
58+
fi
59+
4060
# Wait for EventStoreDB
41-
until curl -s http://localhost:2113; do
42-
echo "Waiting for EventStoreDB..."
61+
echo "Waiting for EventStoreDB..."
62+
for i in {1..60}; do
63+
if curl -s http://localhost:2113 > /dev/null; then
64+
echo "EventStoreDB is ready"
65+
break
66+
fi
4367
sleep 5
4468
done
45-
69+
if ! curl -s http://localhost:2113 > /dev/null; then
70+
echo "EventStoreDB did not become ready in time"
71+
exit 1
72+
fi
73+
4674
- name: Restore dependencies
4775
run: dotnet restore
4876

4977
- name: Build
5078
run: dotnet build --no-restore
5179

5280
- name: Test
81+
env:
82+
Inforigami_Regalo_AzureTableStorage_UnitTest_AzureStorageAccountName: ${{ secrets.AzureStorageAccountName }}
83+
Inforigami_Regalo_AzureTableStorage_UnitTest_AzureStorageAccountKey: ${{ secrets.AzureStorageAccountKey }}
5384
run: dotnet test --no-build --verbosity normal
5485

5586
- name: Stop Docker Compose services

0 commit comments

Comments
 (0)