aslotte / MLOps.NET

A machine learning model operations and management tool for ML.NET
https://www.nuget.org/packages/MLOps.NET
MIT License
80 stars 30 forks source link

Add SQL Server Integration Tests to CI pipeline #134

Closed aslotte closed 4 years ago

aslotte commented 4 years ago

Is your feature request related to a problem? Please describe. We currently can't run our SQL server tests in our CI pipeline as it requires SQL server.

Describe the solution you'd like It may make sense to run these tests in a Docker container of sorts, or against a container with SQL Server installed on it.

aslotte commented 4 years ago

@shanranm if you have further thoughts on how we can do this, please elaborate.

CodeItQuick commented 4 years ago

Interested on helping on this one

aslotte commented 4 years ago

GitHub Service Continers https://help.github.com/en/actions/configuring-and-managing-workflows/using-databases-and-service-containers\

SQL Server Image https://hub.docker.com/_/microsoft-mssql-server

aslotte commented 4 years ago

I think the steps here would be:

  1. Create a new project called MLOps.NET.TestFramework
  2. To that project add the ability to read configuration values: https://weblog.west-wind.com/posts/2018/Feb/18/Accessing-Configuration-in-NET-Core-Test-Projects
  3. Refactor the use of the explicit connectionstring in the SQL server integration test to instead use user secrets and env variables
  4. Create a new workflow file for integration tests that run on PR and CI builds
  5. In that workflow file do the following steps:
    • Create a service container, specify the SQL server image, and password in GitHub secrets
    • Checkout
    • Build integration test project
    • Run integration test project (make sure to set the env variable here using a GitHub secret for the connection string. The connection string needs to have port ,1433 in there, e.g. localhost,1433)
memsranga commented 4 years ago

I think you almost got it, lemme know if you need more help

aslotte commented 4 years ago

Yep, I actually just got it working using GitHub service containers (had no idea they existed so this was really cool). Planning on getting a PR up during the next stream once the current SQL Server PR has been reviewed, since I think others may find it useful to know how to set a pipeline like this up as well. Thanks for extending your help!