Building Net in Gitlab.

Hi everyone,
I’m new in GitLab. In our company, we mostly use VSTS source control. And we want to move from VSTS to GitHub. My question is: how I can restore NuGet packages, rebuild the solution and run the unit test. If some of this item is failed I need to reject the commit process and save a history of the check-in(commit). Can someone give me a link or tutorial to how to do this action?
Thanks for help