I am in the process of migrating my svn repsitories to git with GitLab.
Now I have seen that there is a continuous integration implementation with GitLab CI and just want to try it out.
I already installed and configured a Runner but Gitlab complains that I don't have a .gitlab-ci.yml
file.
I already use TeamCity for continuous integration so I don't want to put too much effort into writing a build script.
Can anybody tell me where I can find a basic example of a gitlab-ci.yml
file that basically just builds my Solution and runs all tests (MSTests)?
You can configure your job to use Unit test reports, and GitLab displays a report on the merge request so that it's easier and faster to identify the failure without having to check the entire log.
As you can see above, to configure a runner and also pipelines for GitLab is not a big deal. . NET Framework brings a bit more of complexity because of several tools you need to have configured as well, but once you did it, it's done for that runner and project.
Although Jenkins offers more flexibility and just requires JRE as a prerequisite, it lacks support for SLA and project management features that GitLab offers. However, each of them is at par when supporting CI/CD for a software project through their advanced infrastructure and features.
Apparently there is no simple msbuild example but this should get you started:
variables: Solution: MySolution.sln before_script: - "echo off" - 'call "%VS120COMNTOOLS%\vsvars32.bat"' # output environment variables (usefull for debugging, propably not what you want to do if your ci server is public) - echo. - set - echo. stages: - build - test - deploy build: stage: build script: - echo building... - 'msbuild.exe "%Solution%"' except: - tags test: stage: test script: - echo testing... - 'msbuild.exe "%Solution%"' - dir /s /b *.Tests.dll | findstr /r Tests\\*\\bin\\ > testcontainers.txt - 'for /f %%f in (testcontainers.txt) do mstest.exe /testcontainer:"%%f"' except: - tags deploy: stage: deploy script: - echo deploying... - 'msbuild.exe "%Solution%" /t:publish' only: - production
Figuring out which tests to run is a bit tricky. My convention is that every project has a folder tests in which the test projects are named after the schema MyProject.Core.Tests (for a project called MyProject.Core)
Just as a first feedback towards gitlab-ci
I like the simplicity and the source control integration. But I would like to be able to modify the script before execution (especially while changing the script) but I could imaging to rerun a specific commit and inject variables or change the script (I can do that with teamcity). Or even ignore a failed test and rerun the script again (I do that a lot with teamcity). I know gitlab-ci does not know anything about my tests I just have a command line that returns an error code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With