This repository was archived by the owner on Nov 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (104 loc) · 3.5 KB
/
Copy pathci.yml
File metadata and controls
109 lines (104 loc) · 3.5 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: CI
on: [push, pull_request]
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Update Java SDK for SonarQube
uses: actions/setup-java@v1
with:
java-version: '11'
- name: Setup .NET versions
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
6.0.x
7.0.x
- name: Dump .NET info
run: dotnet --info
- name: Restore dotnet tools
run: dotnet tool restore
# - name: Prepare sonarqube
# if: ${{ github.actor != 'dependabot[bot]' }}
# env:
# SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
# run: dotnet sonarscanner begin -d:sonar.host.url=https://sonarcloud.io -organization:testablehttpclient -key:testablehttpclient_TestableHttpClient -version:`dotnet nbgv get-version --variable NuGetPackageVersion` -d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml -d:sonar.login=${{env.SONAR_TOKEN}}
- name: Restore dependencies
run: dotnet restore
- name: Build source code
run: dotnet build --configuration Release --no-restore
- name: Test with dotnet
run: dotnet test --configuration Release --no-build --collect="Code Coverage" --framework="net6.0"
# - name: Upload sonarqube results
# if: ${{ github.actor != 'dependabot[bot]' }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
# run: dotnet sonarscanner end -d:sonar.login=${{env.SONAR_TOKEN}}
- name: Check source file format
run: dotnet format --no-restore --verify-no-changes
- name: Pack
run: dotnet pack --output ./artifacts --configuration Release --no-build
- uses: actions/upload-artifact@v2
with:
name: artifacts
path: ./artifacts
- uses: actions/upload-artifact@v2
with:
name: coverage
path: ./**/TestResults/**/coverage.opencover.xml
testOnSupportedDotnetVersions:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch all history for all tags and branches
run: git fetch --prune --unshallow
- name: Setup .NET versions
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
6.0.x
7.0.x
- name: Dump .NET info
run: dotnet --info
- name: Restore dependencies
run: dotnet restore
- name: Build source code
run: dotnet build --configuration Release --no-restore
- name: Test with dotnet
run: dotnet test --configuration Release --no-build
# publish:
# runs-on: ubuntu-latest
# needs: build
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Setup .NET versions
# uses: actions/setup-dotnet@v1
# with:
# dotnet-version: |
# 7.0.x
# - uses: actions/download-artifact@v2
# with:
# name: artifacts
# path: ./artifacts
# - name: Publish packages
# env:
# NUGET_TOKEN: ${{secrets.NUGET_TOKEN}}
# run: dotnet nuget push './artifacts/**/*.nupkg' --source https://api.nuget.org/v3/index.json --api-key ${{env.NUGET_TOKEN}}