Skip to content

Commit 3a95c5c

Browse files
Parallelize CI workflow
1 parent 9246950 commit 3a95c5c

3 files changed

Lines changed: 50 additions & 50 deletions

File tree

.github/workflows/CI.yml

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
name: CI
2-
3-
on: [push]
2+
on: [ push, pull_request ]
43

54
jobs:
65
Build:
7-
86
runs-on: ubuntu-latest
97

108
steps:
@@ -22,50 +20,4 @@ jobs:
2220
run: dotnet build --no-restore
2321

2422
- name: Test
25-
run: dotnet test --no-build
26-
27-
Code-Quality:
28-
needs: Build
29-
runs-on: ubuntu-latest
30-
if: github.actor != 'dependabot[bot]'
31-
32-
steps:
33-
- name: Checkout code
34-
uses: actions/checkout@v2
35-
with:
36-
fetch-depth: 0
37-
38-
- name: Setup .NET 5
39-
uses: actions/setup-dotnet@v1
40-
with:
41-
dotnet-version: 5.0.x
42-
43-
- name: Setup .NET 6
44-
uses: actions/setup-dotnet@v1
45-
with:
46-
dotnet-version: 6.0.x
47-
48-
- name: Install Sonar Scanner
49-
run: dotnet tool install --global dotnet-sonarscanner
50-
51-
- name: Install dependencies
52-
run: dotnet restore
53-
54-
- name: Start Sonar Analysis
55-
run: dotnet-sonarscanner begin /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /o:"ecoapm" /k:"ecoAPM_GitHubLabelSync" /d:sonar.cs.vstest.reportsPaths="test/TestResults/results.trx" /d:sonar.cs.opencover.reportsPaths="test/TestResults/coverage.opencover.xml"
56-
57-
- name: Build
58-
run: dotnet build --no-restore
59-
env:
60-
SONAR_DOTNET_ENABLE_CONCURRENT_EXECUTION: true
61-
62-
- name: Test
63-
run: dotnet test --no-build --logger "trx;LogFileName=results.trx" --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
64-
65-
- name: Move Code Coverage
66-
run: mv test/TestResults/**/*.xml test/TestResults
67-
68-
- name: Finish Sonar Analysis
69-
run: dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
70-
env:
71-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
23+
run: dotnet test --no-build

.github/workflows/Sonar.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Sonar
2+
on: push
3+
4+
jobs:
5+
Code-Quality:
6+
runs-on: ubuntu-latest
7+
if: github.actor != 'dependabot[bot]'
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v2
12+
with:
13+
fetch-depth: 0
14+
15+
- name: Setup .NET 5
16+
uses: actions/setup-dotnet@v1
17+
with:
18+
dotnet-version: 5.0.x
19+
20+
- name: Setup .NET 6
21+
uses: actions/setup-dotnet@v1
22+
with:
23+
dotnet-version: 6.0.x
24+
25+
- name: Install Sonar Scanner
26+
run: dotnet tool install --global dotnet-sonarscanner
27+
28+
- name: Install dependencies
29+
run: dotnet restore
30+
31+
- name: Start Sonar Analysis
32+
run: dotnet-sonarscanner begin /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /o:"ecoapm" /k:"ecoAPM_GitHubLabelSync" /d:sonar.cs.vstest.reportsPaths="test/TestResults/results.trx" /d:sonar.cs.opencover.reportsPaths="test/TestResults/coverage.opencover.xml"
33+
34+
- name: Build
35+
run: dotnet build --no-restore
36+
env:
37+
SONAR_DOTNET_ENABLE_CONCURRENT_EXECUTION: true
38+
39+
- name: Test
40+
run: dotnet test --no-build --logger "trx;LogFileName=results.trx" --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
41+
42+
- name: Move Code Coverage
43+
run: mv test/TestResults/**/*.xml test/TestResults
44+
45+
- name: Finish Sonar Analysis
46+
run: dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
47+
env:
48+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)