-
-
Notifications
You must be signed in to change notification settings - Fork 67
82 lines (69 loc) · 2.48 KB
/
reusable.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Build & Test
on:
workflow_call:
inputs:
framework:
default: net6.0
required: false
type: string
clickhouse-version:
default: latest
required: false
type: string
coverage:
default: false
required: false
type: boolean
jobs:
build-and-test:
name: Build & Test
runs-on: ubuntu-latest
services:
clickhouse:
image: clickhouse/clickhouse-server:${{ inputs.clickhouse-version }}
ports:
- 8123:8123
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/cache@v4
name: Cache NuGet
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
3.1.x
6.x
8.x
- name: Install GitHubActionsTestLogger
run: dotnet add ClickHouse.Client.Tests/ClickHouse.Client.Tests.csproj package GitHubActionsTestLogger --no-restore
- name: Install pycobertura
if: ${{ inputs.coverage }}
run: pip install pycobertura
- name: Install coverlet
if: ${{ inputs.coverage }}
run: |
dotnet add ClickHouse.Client.Tests/ClickHouse.Client.Tests.csproj package coverlet.collector --no-restore
dotnet add ClickHouse.Client.Tests/ClickHouse.Client.Tests.csproj package coverlet.msbuild --no-restore
- name: Test with coverage
run: dotnet test --framework ${{ inputs.framework }} --configuration Release --verbosity normal --logger GitHubActions /clp:ErrorsOnly /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:SkipAutoProps=true
env:
CLICKHOUSE_CONNECTION: Host=localhost;Port=8123
CLICKHOUSE_VERSION: ${{ inputs.clickhouse-version }}
- name: Rename coverage file
if: ${{ inputs.coverage }}
run: mv ./ClickHouse.Client.Tests/coverage.${{ inputs.framework }}.cobertura.xml ./ClickHouse.Client/coverage.cobertura.xml
- name: Upload coverage xml
if: ${{ inputs.coverage }}
uses: actions/upload-artifact@v4
with:
name: coverage
path: ./ClickHouse.Client/coverage.cobertura.xml
- name: Report summary
if: ${{ inputs.coverage }}
run: pycobertura show ./ClickHouse.Client/coverage.cobertura.xml --format markdown >> $GITHUB_STEP_SUMMARY