-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (59 loc) · 2.3 KB
/
unit-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: unit tests
# Note: If you need to make changes to this file, please use a branch off the main branch instead of a fork.
# The pull_request target from a forked repo will not have access to the secrets needed for this workflow.
on:
# pull_request_target:
workflow_dispatch:
pull_request:
paths:
- 'AdventureWorks/**'
jobs:
build-and-deploy:
# Containers must run in Linux based operating systems
runs-on: ubuntu-latest
# service/sidecar container for azure-sql-edge
services:
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
env:
ACCEPT_EULA: 1
SA_PASSWORD: ${{ secrets.CONTAINER_SQL_PASSWORD }}
ports:
- 1433:1433
steps:
- name: 'checkout code'
uses: actions/checkout@v3
- name: 'wait for sql container to be ready'
run: |
set +o pipefail +e
for i in {1..60};
do
sqlcmd -S localhost -U sa -P ${{ secrets.CONTAINER_SQL_PASSWORD }} -d master -Q "select getdate()"
if [ $? -eq 0 ]
then
echo "sql server ready"
break
else
echo "not ready yet..."
sleep 1
fi
done
set -o pipefail -e
- name: 'Create and setup database'
uses: azure/sql-action@v2
with:
connection-string: 'Server=localhost;Database=master;User Id=sa;Password=${{ secrets.CONTAINER_SQL_PASSWORD }};TrustServerCertificate=True;'
path: 'UnitTests/tsqlt/PrepareServer.sql' # the sql script to configure for clr
# deploy the sql project
- name: 'Deploy SQL Projects'
uses: azure/sql-action@v2
with:
connection-string: 'Server=localhost;Database=testingDB;User Id=sa;Password=${{ secrets.CONTAINER_SQL_PASSWORD }};TrustServerCertificate=True;'
path: 'UnitTests/UnitTests.sqlproj'
action: 'publish'
arguments: '/p:IncludeCompositeObjects=True'
- name: 'Run tSQLt tests'
uses: azure/sql-action@v2
with:
connection-string: 'Server=localhost;Database=testingDB;User ID=sa;Password=${{ secrets.CONTAINER_SQL_PASSWORD }};TrustServerCertificate=True;'
path: 'UnitTests/myTests/ExecTest.sql' # the tsqlt test command