Skip to content

Commit 451a2f3

Browse files
committed
chore: update ci.yml
Signed-off-by: Alan Brault <alan.brault@visus.io>
1 parent f500c57 commit 451a2f3

1 file changed

Lines changed: 110 additions & 41 deletions

File tree

.github/workflows/ci.yml

Lines changed: 110 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,57 +3,126 @@ name: Continuous Integration
33
on:
44
push:
55
branches:
6-
- develop
6+
- main
77
paths-ignore:
8-
- 'README.md'
9-
- 'docs/**'
10-
- '.github/workflows/docs.yml'
11-
- '.github/workflows/release.yml'
8+
- "**.md"
9+
- "renovate.json"
10+
- ".github/ISSUE_TEMPLATE/**"
11+
- ".github/PULL_REQUEST_TEMPLATE/**"
12+
- ".github/workflows/docs.yml"
13+
- ".github/workflows/release.yml"
1214

1315
pull_request:
1416
paths-ignore:
15-
- 'README.md'
16-
- 'docs/**'
17-
- '.github/workflows/docs.yml'
18-
- '.github/workflows/release.yml'
19-
17+
- "**.md"
18+
- "renovate.json"
19+
- ".github/ISSUE_TEMPLATE/**"
20+
- ".github/PULL_REQUEST_TEMPLATE/**"
21+
- ".github/workflows/docs.yml"
22+
- ".github/workflows/release.yml"
2023
concurrency:
2124
group: ${{ github.workflow }}-${{ github.ref }}
2225
cancel-in-progress: true
2326

2427
jobs:
25-
unit-tests:
26-
name: Unit Tests
27-
runs-on: ubuntu-latest
28+
test-and-analysis:
29+
name: Test & Analysis
30+
runs-on: windows-latest
31+
timeout-minutes: 30
32+
permissions:
33+
contents: read
2834
env:
29-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30-
SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }}
31-
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }}
3235
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
36+
SONAR_ANALYSIS: true
37+
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
41+
with:
42+
fetch-depth: 0
43+
show-progress: false
44+
45+
- name: Setup .NET
46+
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
47+
with:
48+
global-json-file: global.json
49+
cache: true
50+
cache-dependency-path: '**/Directory.Packages.props'
51+
52+
- name: Restore dependencies
53+
run: dotnet restore
54+
55+
- name: Install SonarCloud scanner
56+
if: github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]'
57+
shell: powershell
58+
run: dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
59+
60+
- name: Begin SonarCloud analysis
61+
if: github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]'
62+
shell: powershell
63+
run: |
64+
.\.sonar\scanner\dotnet-sonarscanner begin `
65+
/k:"visus:AddressValidation" `
66+
/o:"visus" `
67+
/d:sonar.token="$env:SONAR_TOKEN" `
68+
/d:sonar.host.url="https://sonarcloud.io" `
69+
/d:sonar.cs.vscoveragexml.reportsPaths="**/TestResults/**/*.xml" `
70+
/d:sonar.cs.vstest.reportsPaths="**/TestResults/**/*.trx"
71+
72+
- name: Build
73+
run: dotnet build -c Release --no-restore
74+
75+
- name: Run tests
76+
shell: powershell
77+
run: |
78+
dotnet test -c Release --no-build --no-restore -- `
79+
--coverage `
80+
--coverage-output-format xml `
81+
--report-trx
82+
83+
- name: Upload test results
84+
if: always()
85+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
86+
with:
87+
name: test-results
88+
path: "**/TestResults/*.trx"
89+
retention-days: 1
90+
91+
- name: End SonarCloud analysis
92+
if: github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]'
93+
shell: powershell
94+
run: |
95+
.\.sonar\scanner\dotnet-sonarscanner end `
96+
/d:sonar.token="$env:SONAR_TOKEN"
97+
98+
publish-test-results:
99+
name: Publish Test Results
100+
runs-on: ubuntu-latest
101+
needs: test-and-analysis
102+
if: always()
103+
timeout-minutes: 10
104+
permissions:
105+
contents: read
106+
checks: write
107+
pull-requests: write
33108

34109
steps:
35-
- name: Checkout
36-
uses: actions/checkout@v6
37-
with:
38-
fetch-depth: 0
39-
show-progress: false
40-
- name: Install .NET SDK
41-
uses: actions/setup-dotnet@v5
42-
with:
43-
global-json-file: global.json
44-
- name: NuGet Cache
45-
uses: actions/cache@v5
46-
with:
47-
path: ~/.nuget/packages
48-
key: ${{ runner.os}}-nuget-${{ hashFiles('**/packages.lock.json') }}
49-
restore-keys: ${{ runner.os }}-nuget
50-
- name: Test
51-
run: ./build.sh Test
52-
- name: Publish Test Results
53-
if: always()
54-
uses: dorny/test-reporter@v2
55-
with:
56-
name: Test Results
57-
path: .nuke/temp/TestResults/*.trx
58-
reporter: dotnet-trx
59-
path-replace-backslashes: true
110+
- name: Checkout
111+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
112+
with:
113+
fetch-depth: 1
114+
show-progress: false
115+
116+
- name: Download test results
117+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
118+
with:
119+
name: test-results
120+
path: test-results
121+
122+
- name: Publish test results
123+
uses: dorny/test-reporter@df6247429542221bc30d46a036ee47af1102c451 # v2.7.0
124+
with:
125+
name: Test Results
126+
path: test-results/**/*.trx
127+
reporter: dotnet-trx
128+
fail-on-error: false

0 commit comments

Comments
 (0)