-
Notifications
You must be signed in to change notification settings - Fork 758
54 lines (52 loc) · 1.63 KB
/
reusable_ci_workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Reusable CI workflow
on:
workflow_call:
inputs:
PROJECT_PATH:
required: true
type: string
TEST_PROJECT_PATH:
required: true
type: string
CODECOV_FLAGS:
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Restore
run: |
dotnet restore ${{inputs.PROJECT_PATH}} &&
dotnet restore ${{inputs.TEST_PROJECT_PATH}}
- name: Check formatting
run: |
dotnet format --no-restore --verify-no-changes --severity warn ${{inputs.PROJECT_PATH}} || (echo "Run 'dotnet format' to fix issues" && exit 1) &&
dotnet format --no-restore --verify-no-changes --severity warn ${{inputs.TEST_PROJECT_PATH}} || (echo "Run 'dotnet format' to fix issues" && exit 1)
- name: Build
run: |
dotnet build --no-restore ${{inputs.PROJECT_PATH}}
dotnet build --no-restore ${{inputs.TEST_PROJECT_PATH}}
- name: Test
run: >
dotnet test
${{inputs.TEST_PROJECT_PATH}}
--no-restore
--no-build
--collect "XPlat Code Coverage"
--results-directory .coverage
--
DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
- name: Upload Coverage
uses: codecov/codecov-action@v3
with:
flags: ${{inputs.CODECOV_FLAGS}}
directory: .coverage