Skip to content

Commit 8f2287c

Browse files
committed
Merge branch 'develop'
2 parents dd55387 + 9831410 commit 8f2287c

File tree

2 files changed

+146
-31
lines changed

2 files changed

+146
-31
lines changed

.github/workflows/dotnet-build.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/dotnet.yml

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: dotNet
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
- feature/ci
9+
pull_request:
10+
branches:
11+
- master
12+
- develop
13+
- feature/ci
14+
15+
jobs:
16+
17+
build-and-test-debug:
18+
name: Build and test in Debug configuration
19+
strategy:
20+
matrix:
21+
os: [ubuntu-latest, windows-latest]
22+
version: [6.x, 7.x]
23+
defaults:
24+
run:
25+
working-directory: ./src
26+
runs-on: ${{ matrix.os }}
27+
steps:
28+
- uses: actions/checkout@v3
29+
- name: Setup dotNET
30+
uses: actions/setup-dotnet@v3
31+
with:
32+
dotnet-version: ${{ matrix.version }}
33+
- name: Restore dependencies
34+
run: dotnet restore
35+
- name: Build
36+
run: dotnet build --no-restore -c Debug
37+
- name: Test
38+
run: dotnet test --no-build --verbosity normal
39+
40+
build-and-test-release:
41+
name: Build and test in Release configuration
42+
needs: build-and-test-debug
43+
defaults:
44+
run:
45+
working-directory: ./src
46+
runs-on: windows-latest
47+
steps:
48+
- uses: actions/checkout@v3
49+
- name: Setup dotNET
50+
uses: actions/setup-dotnet@v3
51+
with:
52+
dotnet-version: 7.x
53+
- name: Restore dependencies
54+
run: dotnet restore
55+
- name: Build
56+
run: dotnet build --no-restore -c Release
57+
- name: Test
58+
run: dotnet test --no-build --verbosity normal
59+
#- name: Upload artifact
60+
# uses: actions/upload-artifact@v3
61+
# with:
62+
# name: release-buid
63+
# path: |
64+
# ./jjm-one_jjm.one.Serilog.Extensions.Logging.Helpers/bin/Release/*.nupkg
65+
# retention-days: 1
66+
67+
sonarcloud:
68+
name: Build and analyze with SonarCloud
69+
needs: build-and-test-release
70+
runs-on: windows-latest
71+
steps:
72+
- name: Set up JDK 11
73+
uses: actions/setup-java@v1
74+
with:
75+
java-version: 1.11
76+
- uses: actions/checkout@v3
77+
with:
78+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
79+
- name: Cache SonarCloud packages
80+
uses: actions/cache@v1
81+
with:
82+
path: ~\sonar\cache
83+
key: ${{ runner.os }}-sonar
84+
restore-keys: ${{ runner.os }}-sonar
85+
- name: Cache SonarCloud scanner
86+
id: cache-sonar-scanner
87+
uses: actions/cache@v1
88+
with:
89+
path: .\.sonar\scanner
90+
key: ${{ runner.os }}-sonar-scanner
91+
restore-keys: ${{ runner.os }}-sonar-scanner
92+
- name: Setup dotNET
93+
uses: actions/setup-dotnet@v3
94+
with:
95+
dotnet-version: 7.x
96+
- name: Install SonarCloud scanner
97+
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
98+
shell: powershell
99+
run: |
100+
New-Item -Path .\.sonar\scanner -ItemType Directory
101+
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
102+
- name: Build and analyze
103+
env:
104+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
105+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
106+
shell: powershell
107+
run: |
108+
cd .\src
109+
.\..\.sonar\scanner\dotnet-sonarscanner begin /k:"jjm-one_jjm.one.Serilog.Extensions.Logging.Helpers" /o:"jjm-one" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
110+
dotnet restore
111+
dotnet build --no-restore
112+
.\..\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
113+
114+
#publish-nuget:
115+
# name: Publish the NuGet package
116+
# needs: [build-and-test-debug, build-and-test-release, sonarcloud, publish-doc]
117+
# if: github.ref_type == 'tag' && startsWith(github.event.ref, 'refs/tags/version-')
118+
# runs-on: ubuntu-latest
119+
# steps:
120+
# - name: Download a single artifact
121+
# uses: actions/download-artifact@v3
122+
# with:
123+
# name: release-buid
124+
# - name: Setup dotNET
125+
# uses: actions/setup-dotnet@v3
126+
# with:
127+
# dotnet-version: 7.x
128+
# - name: Publish the package to nuget.org
129+
# run: |
130+
# ls -la
131+
# #run: dotnet nuget push */bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
132+
# #env:
133+
# # NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }}
134+
135+
#publish-doc:
136+
# name: Publish Documentation
137+
# needs: [build-and-test-debug]
138+
# runs-on: ubuntu-latest
139+
# steps:
140+
# - uses: actions/checkout@v3
141+
# - name: Deploy documentation
142+
# run: echo "Deploy documentation"
143+
144+
145+
146+

0 commit comments

Comments
 (0)