CI for Open Source Dotnet

Azure Devops

trigger:
- master
pool:
vmImage: ubuntu-latest
variables:
buildConfiguration: 'Release'
steps:
- script: dotnet build -c $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
- script: dotnet test -c $(buildConfiguration)

AppVeyor

version: 1.0.{build}
image: Visual Studio 2022
configuration: Release
before_build:
- cmd: dotnet restore
build:
project: NLC.Library.sln
verbosity: minimal

Travis

language: csharp
# solution is optional and results in a restore
solution: NLC.Library.sln
# mono only needed for paket
mono: latest
# attempt to use linux and mac
os:
- linux
- osx
osx_image: latest# dotnet version can be more specific but that is handled by global.json# specific version of sdk to prevent mac issuesdotnet: 3.1.403 # 404 not on travis yetbefore_install:
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update ; fi
# needed for tests
# dotnet: 2.1
script:
- dotnet build src/NLC.Library.csproj -c Release
- dotnet test tests/NLC.Library.tests.csproj -c Release

CircleCI

version: 2.1orbs:
windows: circleci/windows@2.4
jobs:
test:
description: 'Setup and run tests'
executor:
name: windows/default
steps:
- checkout
- run:
name: 'Install dependencies'
command: dotnet.exe restore
- run:
name: 'Run tests'
command: dotnet test
build:
description: 'Build app'
executor:
name: windows/default
steps:
- checkout
- run:
name: 'Build app'
command: dotnet.exe build -c Release
workflows:
test_and_build:
jobs:
- test
- build:
requires:
- test

Github Workflows

# this is our main Windows based build
name: .NET Core
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest, macos-latest, ubuntu-latest ]
include:
- dotnet-version: '6.0.101'
tfm: 'net6.0'
steps:

- uses: actions/checkout@v3
- name: Setup .NET Core ${{ matrix.os }}
uses: actions/setup-dotnet@v1.7.2
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Display dotnet version
run: dotnet --version
- name: Install dependencies
run: dotnet restore -p:TargetFramework=${{ matrix.tfm }}
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal -f=${{ matrix.tfm }}

Conclusions

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store