Skip to content

Commit

Permalink
Update dotnet.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
DRyncewicz authored Jun 22, 2024
1 parent 1cece34 commit 290c11b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,41 @@ jobs:

runs-on: ubuntu-latest

services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: "Your_password123"
ports:
- 1433:1433
options: >-
--health-cmd "wget --quiet --tries=1 --spider http://localhost:1433 || exit 1"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Wait for SQL Server to be healthy
run: |
echo "Waiting for SQL Server to start..."
while ! nc -z localhost 1433; do
sleep 1
done
echo "SQL Server is up and running."
- name: Set up database
run: |
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "Your_password123" -Q "CREATE DATABASE TestDb"
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
env:
ConnectionStrings__DefaultConnection: "Server=localhost;Database=TestDb;User Id=sa;Password=Your_password123;"
run: dotnet test --no-build --verbosity normal

0 comments on commit 290c11b

Please sign in to comment.