Skip to content

Commit c0afa42

Browse files
authored
Setting up CI/CD with GitHub Actions using a standard .NET workflow (#2254)
* Create dotnet.yml * Update dotnet.yml: Add target solution * Update dotnet.yml: Restore Ocelot.sln * Update dotnet.yml: .NET 9 * Update dotnet.yml: Setup .NET with multiple SDK versions * Update dotnet.yml: Split target frameworks * Update dotnet.yml: Unit Tests step * Update dotnet.yml: 3 testing steps * Add DotNet workflow config to VS-solution items * Update dotnet.yml: Build on push, pull_request
1 parent 68090bc commit c0afa42

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

.github/workflows/dotnet.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: .NET
5+
6+
#on:
7+
# push:
8+
# branches: [ "develop" ]
9+
# pull_request:
10+
# branches: [ "develop" ]
11+
on: [push, pull_request]
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
dotnet-version: [ '8.0', '9.0' ]
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Setup .NET ${{ matrix.dotnet-version }}
23+
uses: actions/setup-dotnet@v3
24+
with:
25+
dotnet-version: ${{ matrix.dotnet-version }}.x
26+
# - name: Display dotnet version
27+
# run: dotnet --version
28+
- name: Restore
29+
run: dotnet restore ./Ocelot.sln -p:TargetFramework=net${{ matrix.dotnet-version }}
30+
- name: Build
31+
run: dotnet build --no-restore ./Ocelot.sln --framework net${{ matrix.dotnet-version }}
32+
# - name: Test
33+
# run: dotnet test --no-build --verbosity normal ./Ocelot.sln --framework net${{ matrix.dotnet-version }}
34+
- name: Unit Tests
35+
run: dotnet test --no-restore --no-build --verbosity minimal --framework net${{ matrix.dotnet-version }} ./test/Ocelot.UnitTests/Ocelot.UnitTests.csproj
36+
- name: Integration Tests
37+
run: dotnet test --no-restore --no-build --verbosity minimal --framework net${{ matrix.dotnet-version }} ./test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj
38+
- name: Acceptance Tests
39+
run: dotnet test --no-restore --no-build --verbosity minimal --framework net${{ matrix.dotnet-version }} ./test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj

Ocelot.Release.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1313
.readthedocs.yaml = .readthedocs.yaml
1414
build.cake = build.cake
1515
codeanalysis.ruleset = codeanalysis.ruleset
16+
.github\workflows\dotnet.yml = .github\workflows\dotnet.yml
1617
GitVersion.yml = GitVersion.yml
1718
LICENSE.md = LICENSE.md
1819
README.md = README.md

Ocelot.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1313
.readthedocs.yaml = .readthedocs.yaml
1414
build.cake = build.cake
1515
codeanalysis.ruleset = codeanalysis.ruleset
16+
.github\workflows\dotnet.yml = .github\workflows\dotnet.yml
1617
GitVersion.yml = GitVersion.yml
1718
LICENSE.md = LICENSE.md
1819
README.md = README.md

0 commit comments

Comments
 (0)