Skip to content

Commit 9a2b7c0

Browse files
committed
Align CI and release workflows with ManagedCode pipeline
1 parent 469456d commit 9a2b7c0

2 files changed

Lines changed: 223 additions & 244 deletions

File tree

.github/workflows/dotnet.yml

Lines changed: 38 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,55 @@
1-
name: .NET
1+
name: .NET CI
22

33
on:
44
push:
55
branches: [ main ]
66
pull_request:
77
branches: [ main ]
8-
9-
10-
# Allows you to run this workflow manually from the Actions tab
118
workflow_dispatch:
129

1310
jobs:
14-
1511
build-and-test:
1612
runs-on: ubuntu-latest
17-
13+
1814
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v5
17+
18+
- name: Setup .NET
19+
uses: actions/setup-dotnet@v4
20+
with:
21+
dotnet-version: 9.0.x
22+
23+
- name: Restore dependencies
24+
run: dotnet restore Together.slnx
25+
26+
- name: Build
27+
run: dotnet build Together.slnx --configuration Release --no-restore
1928

20-
- uses: actions/checkout@v3
21-
- name: Setup .NET
22-
uses: actions/setup-dotnet@v3
23-
with:
24-
dotnet-version: 9.0.x
25-
26-
# run build and test
27-
- name: Restore dependencies
28-
run: dotnet restore Together.slnx
29-
30-
- name: Build
31-
run: dotnet build Together.slnx --no-restore --configuration Release
32-
33-
- name: Test and Collect Code Coverage
34-
run: dotnet test Together.slnx --no-build --configuration Release -p:CollectCoverage=true -p:CoverletOutput=coverage/
29+
- name: Test and collect coverage
30+
run: dotnet test Together.slnx --configuration Release --no-build -p:CollectCoverage=true -p:CoverletOutput=coverage/
3531

36-
- name: Copy coverage files
37-
run: |
38-
mkdir '${{ github.workspace }}/coverage'
39-
find . -name "*.opencover.xml" -exec sh -c 'cp "$0" "coverage/coverage-$(basename $0)"' {} \;
32+
- name: Copy coverage files
33+
run: |
34+
mkdir -p "${{ github.workspace }}/coverage"
35+
find . -name "*.opencover.xml" -exec sh -c 'cp "$1" "coverage/coverage-$(basename "$1")"' _ {} \;
4036
41-
- name: List coverage files
42-
run: ls '${{ github.workspace }}/coverage/'
37+
- name: List coverage files
38+
run: ls "${{ github.workspace }}/coverage/"
4339

44-
- name: SonarCloud Scan
45-
uses: sonarsource/sonarcloud-github-action@master
46-
with:
47-
args: >
48-
-Dsonar.organization=managedcode
49-
-Dsonar.projectKey=managedcode_Together
50-
-Dsonar.token=${{ secrets.SONAR_TOKEN }}
51-
-Dsonar.cs.opencover.reportsPaths=${{ github.workspace }}/coverage/
52-
env:
53-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
40+
- name: SonarCloud Scan
41+
uses: sonarsource/sonarcloud-github-action@master
42+
with:
43+
args: >
44+
-Dsonar.organization=managedcode
45+
-Dsonar.projectKey=managedcode_Together
46+
-Dsonar.token=${{ secrets.SONAR_TOKEN }}
47+
-Dsonar.cs.opencover.reportsPaths=${{ github.workspace }}/coverage/
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
5551

56-
- name: Upload coverage reports to Codecov
57-
uses: codecov/codecov-action@v3
58-
env:
59-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
60-
61-
# - name: coveralls
62-
# uses: coverallsapp/github-action@master
63-
# with:
64-
# github-token: ${{secrets.GITHUB_TOKEN }}
65-
# path-to-lcov: coverage/coverage.info
52+
- name: Upload coverage reports to Codecov
53+
uses: codecov/codecov-action@v4
54+
env:
55+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)