DEV Community

Cover image for Open Source DevOps Server to Get Most Of Your .NET Projects
Robin Shen
Robin Shen

Posted on • Updated on

Open Source DevOps Server to Get Most Of Your .NET Projects

OneDev is an open source git hosting and CI/CD server. Unlike traditional code hosting platforms, it parses C# code to enable symbol search and navigation, both in source view and diff view:

Image description

The latest version also adds the ability to suggest CI/CD job templates for .net projects, as well as analyzing TRX formatted unit test report, coverlet coverage report and roslynator code analysis report to annotate source and pull request diff to facilitate code review.

Let’s test with a real project to demonstrate it:

  1. First start up OneDev server with a one-liner on a Linux machine with docker installed:

    docker run -it - rm -v $(pwd)/onedev:/opt/onedev -v /var/run/docker.sock:/var/run/docker.sock -p 6610:6610 1dev/server:9.1.5
    
  2. Access http:localhost:6610 to set up the server, and then import a repository like below:

    Image description

    Specify url as https:github.com/bitwarden/server, and proceed with import with all others remain as default. After a while, we will see two projects get imported, respectively bitwarden, and bitwarden/server

  3. Navigate to project bitwarden/server and click the link adding .onedev-buildspec.yml to set up CI/CD like below:

    Image description

    OneDev under the hood checks if the project root contains dotnet solution file, and suggest a dotnet ci job if it exists. You may further tune the job to meet your requirement. For this demo project, we simply commit the change without any modification and the CI job will be running.

  4. We can open the running build, and check its log like below:

    Image description

  5. The job takes some time. After it finishes, we will see three new tabs summarizing unit tests, code coverages, and code problems:

    Image description

    From the reports, you may drill down problems to source view directly

  6. When open source files in OneDev, coverage info and code problems will be displayed, and you can even comment the code problems to discuss with author:

    Image description

    This also works for diff view in pull request, and is especially useful when review the change. That’s all. Thanks for watching.

Top comments (0)