-
Notifications
You must be signed in to change notification settings - Fork 3
151 lines (151 loc) · 4.76 KB
/
package.yml
File metadata and controls
151 lines (151 loc) · 4.76 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: package
on:
push:
tags:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 01 Checkout Code
uses: actions/checkout@v2
- name: 02 Setup .Net SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
5.0.100
6.0.100
- name: 03 Build with dotnet
run: dotnet build
code-check-format:
runs-on: ubuntu-latest
steps:
- name: 01 Checkout Code
uses: actions/checkout@v2
- name: 02 Setup .Net SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
5.0.100
6.0.100
- name: 03 Restore Dotnet Tool
run: dotnet tool restore
- name: 04 Check Code Format
run: dotnet format --verify-no-changes
code-scan-sonar:
runs-on: ubuntu-latest
steps:
- name: 01 Checkout Code
uses: actions/checkout@v2
- name: 02 Setup .Net SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
5.0.100
6.0.100
- name: 03 Setup JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.11
- name: 04 Install SonarScanner
run: dotnet tool restore
- name: 05 Begin Scan With SonarCloud
run: dotnet sonarscanner begin /k:"yscorecore_changedb" /o:"yscorecore" /d:sonar.login="${{secrets.SONAR_TOKEN}}" /d:sonar.host.url="https://sonarcloud.io"
- name: 06 Build with dotnet
run: dotnet build
- name: 07 End Scan With SonarCloud
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: dotnet sonarscanner end /d:sonar.login="${{secrets.SONAR_TOKEN}}"
test-sqlce:
runs-on: windows-latest
steps:
- name: 01 Checkout Code
uses: actions/checkout@v1
- name: 02 Setup .Net SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
5.0.100
6.0.100
- name: 03 Run Unit test
run: dotnet test test/ChangeDB.Agent.SqlCe.UnitTest /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:Exclude="[*Test]*"
- name: 04 UpLoad SqlCe Coverage
uses: actions/upload-artifact@v3
with:
name: sqlce-coverage
path: test/*/coverage.cobertura.xml
test-others:
runs-on: ubuntu-latest
steps:
- name: 01 Checkout Code
uses: actions/checkout@v1
- name: 02 Setup .Net SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
5.0.100
6.0.100
- name: 03 Restore Dotnet Tool
run: dotnet tool restore
- name: 04 Run Unit test
run: dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:Exclude="[*Test]*"
- name: 05 UpLoad Coverage
uses: actions/upload-artifact@v3
with:
name: test-coverage
path: test/*/coverage.cobertura.xml
test:
needs: [test-sqlce,test-others]
runs-on: ubuntu-latest
steps:
- name: 01 Checkout Code
uses: actions/checkout@v1
- name: 02 Setup .Net SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
6.0.100
- name: 03 Restore Dotnet Tool
run: dotnet tool restore
- name: 04 DownLoad Coverage
uses: actions/download-artifact@v3
with:
path: test-coverages
- name: 05 Combin All Test Report
run: dotnet reportgenerator -reports:test-coverages/**/coverage.cobertura.xml -reporttype:cobertura -targetdir:.
- name: 06 Save Artifact
uses: actions/upload-artifact@v3
with:
name: cobertura_report
path: ./Cobertura.xml
- name: 07 Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true
release:
needs: [build, test, code-check-format, code-scan-sonar]
runs-on: ubuntu-latest
steps:
- name: 01 Checkout Code
uses: actions/checkout@v2
- name: 02 Setup .Net SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
5.0.100
6.0.100
- name: 03 Set Git Tag Name
run: echo GIT_TAG=${GITHUB_REF:10} >> $GITHUB_ENV
- name: 04 Set Pack Version
run: echo PACK_VERSION=${GIT_TAG#v} >> $GITHUB_ENV
- name: 05 Create Package
run: dotnet pack -p:PackageVersion=${PACK_VERSION} -p:RepositoryUrl=${{github.event.repository.url}} -p:PackageProjectUrl=${{github.event.repository.url}} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -o .publish --configuration Release
- name: 06 Push Package
run: bash ./.github/scripts/pushpack.sh .publish ${{secrets.NUGET_APIKEY}}
- name: 07 Set Image Tag
run: echo IMAGE_VERSION=${GIT_TAG#v} >> $GITHUB_ENV
- name: 08 Build and Push Image Tag
run: bash ./.github/scripts/pushdocker.sh ${{secrets.DOCKER_USERNAME}} ${{secrets.DOCKER_PASSWORD}}