Skip to content

Bump Microsoft.Data.SqlClient from 1.1.1 to 2.1.7 in /src/SQLCover/SqlCoverCore #24

Bump Microsoft.Data.SqlClient from 1.1.1 to 2.1.7 in /src/SQLCover/SqlCoverCore

Bump Microsoft.Data.SqlClient from 1.1.1 to 2.1.7 in /src/SQLCover/SqlCoverCore #24

Workflow file for this run

name: SQLCover Pipeline
on:
pull_request:
push:
branches:
- master # Push events on master branch
# use https://marketplace.visualstudio.com/items?itemName=me-dutour-mathieu.vscode-github-actions to validate yml in vscode
env:
NUGET_PACKAGES_DIRECTORY: '.nupkg'
DOCKER_DRIVER: overlay
dotnetVersion: 3.1.401
pipelineDbPassword: 'JdMsKZPBBA8kVFXVrj8d'
jobs:
build-dacpac-dotnet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.dotnetVersion}}
- name: build dacpac
run: |
cd src/SQLCover/DatabaseProject.Build
dotnet restore
dotnet build --configuration Release
# cd $GITHUB_WORKSPACE
# Upload dacpac
- name: upload
uses: actions/upload-artifact@v1
with:
name: dacpac-DatabaseProject-package
path: ./src/SQLCover/DatabaseProject.Build/bin/Release/netstandard2.0/
# use sqlpackage to deploy dacpac file
# does not work well with env db password for some reason
deploy-sqlpackage-DatabaseProject:
runs-on: ubuntu-latest
needs: build-dacpac-dotnet
# Service containers to run with `runner-job`
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: JdMsKZPBBA8kVFXVrj8d
ports:
- 1433:1433
options: >-
--health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'JdMsKZPBBA8kVFXVrj8d' -Q 'SELECT 1' || exit 1"
--health-interval 10s
--health-timeout 3s
--health-retries 10
--health-start-period 10s
steps:
# Download artifacts
- name: download-artifact
uses: actions/download-artifact@v1
with:
name: dacpac-DatabaseProject-package
path: ~/dacpac-package
# Download sqlpackage
- name: download sqlpackage
run: >
curl -L https://go.microsoft.com/fwlink/?linkid=2113331 --output sqlpackage.zip &&
unzip sqlpackage.zip -d ~/sqlpackage &&
chmod a+x ~/sqlpackage/sqlpackage
# Run sqlpackage
- name: sqlpackage publish
run: >
~/sqlpackage/sqlpackage
/Action:Publish
/SourceFile:~/dacpac-package/DatabaseProject.Build.dacpac
/Properties:IncludeCompositeObjects=True
/TargetServerName:localhost
/TargetUser:sa
/TargetPassword:JdMsKZPBBA8kVFXVrj8d
/TargetDatabaseName:DatabaseProject
# Dump logs of the container if something failed
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v1
# Attempt to deploy a project to a SQL Server instance running in a container using dotnet publish
deploy-publish-DatabaseProject:
runs-on: ubuntu-18.04
needs: build-dacpac-dotnet
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: ${pipelineDbPassword}
ports:
- 1433:1433
options: >-
--health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P '${pipelineDbPassword}' -Q 'SELECT 1' || exit 1"
--health-interval 10s
--health-timeout 3s
--health-retries 10
--health-start-period 10s
# Fetch sources
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.dotnetVersion}}
# Publish the project
- name: publish project
run: dotnet publish ./src/SQLCover/DatabaseProject.Build/DatabaseProject.Build.csproj /p:TargetUser=sa /p:TargetPassword=${pipelineDbPassword} /bl /p:DependencyVersion="1.*-*" /warnaserror:SQL71502
# Dump logs of the container if something failed
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v1
# msbuild on windows machine until ported over to dotnet core linux
test-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Setup VSTest Path
uses: darenm/Setup-VSTest@v1
- name: Setup NuGet.exe
uses: nuget/setup-nuget@v1
with:
nuget-version: latest
- name: nuget restore
working-directory: src\SQLCover
run: nuget restore SQLCover.sln
- name: Debug Build UWP app
working-directory: src\SQLCover
run: msbuild SQLCover.sln /p:Configuration=Debug /p:AppxBundlePlatforms="x86|x64|ARM" /p:AppxPackageDir=".\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload
- name: VSTest
working-directory: src\SQLCover
run: vstest.console.exe test\SQLCover.UnitTests\bin\Debug\SQLCover.UnitTests.dll
# can only build dacpac that include master and tsqlt tests on a windows machine
build-dacpac-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Setup NuGet.exe
uses: nuget/setup-nuget@v1
with:
nuget-version: latest
- name: nuget restore
working-directory: src\SQLCover
run: nuget restore SQLCover.sln
- name: MSBuild
working-directory: src\SQLCover
run: msbuild SQLCover.sln /property:Configuration=Release
# cd %GITHUB_WORKSPACE%\src\SQLCover
# msbuild SQLCover.sln
- name: build dacpac
shell: cmd
run: |
echo %GITHUB_WORKSPACE%
dir %GITHUB_WORKSPACE%
dir %GITHUB_WORKSPACE%\src\SQLCover\test\DatabaseWithTests\bin\
- name: upload
uses: actions/upload-artifact@v1
with:
name: dacpac-DatabaseWithTests-package
path: ./src/SQLCover/test/DatabaseWithTests/bin/Release/
# run tsqlt create.sql script, tsqlt tests in db, and export junit xml report against a live db
# also run SQLCoverCore to generate coverage reports!
deploy-DatabaseWithTests-SQLCover:
runs-on: ubuntu-latest
needs: build-dacpac-windows
# Service containers to run with `runner-job`
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: JdMsKZPBBA8kVFXVrj8d
ports:
- 1433:1433
options: >-
--health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'JdMsKZPBBA8kVFXVrj8d' -Q 'SELECT 1' || exit 1"
--health-interval 10s
--health-timeout 3s
--health-retries 10
--health-start-period 10s
steps:
# Download artifacts
- uses: actions/checkout@v1
- name: download-artifact
uses: actions/download-artifact@v1
with:
name: dacpac-DatabaseWithTests-package
path: ~/dacpac-package
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.dotnetVersion}}
- name: deploy db
run: |
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'JdMsKZPBBA8kVFXVrj8d' -i '~/dacpac-package/DatabaseWithTests_Create.sql' || exit 1
- name: tSQLt tests
run: |
/opt/mssql-tools/bin/sqlcmd -d DatabaseWithTests -S localhost -U sa -P 'JdMsKZPBBA8kVFXVrj8d' -Q 'EXEC tSQLt.RunAll' || exit 1
- name: tSQLt XmlResultFormatter
run: |
/opt/mssql-tools/bin/sqlcmd -d DatabaseWithTests -S localhost -U sa -P 'JdMsKZPBBA8kVFXVrj8d' -y0 -Q 'SET NOCOUNT ON; EXEC tSQLt.XmlResultFormatter' -o "TEST-SelfBuildPipelineDV_tSQLt.xml" || exit 1
- name: tSQLt remove new lines
run: |
ls
tr -d '\n' < TEST-SelfBuildPipelineDV_tSQLt.xml
# paste -sd "" TEST-SelfBuildPipelineDV_tSQLt.xml
# perl -v
# perl -p -i -e 's/\R//g;' TEST-SelfBuildPipelineDV_tSQLt.xml
- name: upload junit report
uses: actions/upload-artifact@v1
with:
name: junit-report
path: TEST-SelfBuildPipelineDV_tSQLt.xml
- name: SQLCover Get-CoverTSql Export-Html Export-OpenXml
run: |
export DOTNET_CLI_TELEMETRY_OPTOUT=1
cd src/SQLCover/SqlCoverCore
dotnet restore
mkdir -p TestCoverageOpenXml
mkdir -p TestCoverageHtml
dotnet run -- -c Get-CoverTSql -e Export-Html -k "Server=localhost;Database=master;User ID=sa;Password=JdMsKZPBBA8kVFXVrj8d" -d DatabaseWithTests -q "tSQLt.runAll" -o TestCoverageHtml
dotnet run -- -c Get-CoverTSql -e Export-OpenXml -k "Server=localhost;Database=master;User ID=sa;Password=JdMsKZPBBA8kVFXVrj8d" -d DatabaseWithTests -q "tSQLt.runAll" -o TestCoverageOpenXml
- name: upload TestCoverageHtml
uses: actions/upload-artifact@v1
with:
name: TestCoverageHtml
path: src/SQLCover/SqlCoverCore/TestCoverageHtml
- name: upload TestCoverageOpenXml
uses: actions/upload-artifact@v1
with:
name: TestCoverageOpenXml
path: src/SQLCover/SqlCoverCore/TestCoverageOpenXml
- name: reportgenerator opencover
run: |
export DOTNET_CLI_TELEMETRY_OPTOUT=1
cd ${GITHUB_WORKSPACE}
dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools
echo ./tools/reportgenerator "-reports:src/SQLCover/SqlCoverCore/TestCoverageOpenXml/Coverage.opencover.xml;" "-targetdir:${GITHUB_WORKSPACE}/Reports" "-sourcedirs:src/SQLCover/SqlCoverCore/TestCoverageOpenXml/" -reportTypes:Html;
./tools/reportgenerator "-reports:src/SQLCover/SqlCoverCore/TestCoverageOpenXml/Coverage.opencover.xml;" "-targetdir:${GITHUB_WORKSPACE}/Reports" "-sourcedirs:src/SQLCover/SqlCoverCore/TestCoverageOpenXml/" -reportTypes:Html;
# .\tools\reportgenerator.exe "-reports:src\SQLCover\SqlCoverCore\TestCoverageOpenXml\Coverage.opencover.xml;" "-targetdir:Reports" -reportTypes:Html; -sourcedirs:src\SQLCover\SqlCoverCore\TestCoverageOpenXml\"
- name: upload Reports
uses: actions/upload-artifact@v1
with:
name: Reports-reportgenerator
path: Reports
# Dump logs of the container if something failed
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v1