-
Notifications
You must be signed in to change notification settings - Fork 1
142 lines (117 loc) · 5.3 KB
/
push.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
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
name: Build Test Coverage
on:
workflow_dispatch:
push:
paths:
- 'ChocolateStoreCore/**'
- 'ChocolateStoreCoreTests/**'
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout code
if: ${{ github.actor != 'dependabot[bot]' }}
uses: actions/checkout@v3
with:
token: ${{ secrets.GIT_PAT }}
- name: Checkout code for dependabot
if: ${{ github.actor == 'dependabot[bot]' }}
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Update Version
run: |
pwsh -File ${{ github.workspace }}\version.ps1 -dir ${{ github.workspace }}\ChocolateStoreCore
- name: Restore dependencies ChocolateStoreCore
run: |
cd ${{ github.workspace }}\ChocolateStoreCore
dotnet restore ${{ github.workspace }}\ChocolateStoreCore\ChocolateStoreCore.csproj -r win-x86
- name: Build ChocolateStoreCore
run: |
dotnet build ${{ github.workspace }}\ChocolateStoreCore\ChocolateStoreCore.csproj --configuration Release --no-restore
- name: Restore dependencies Tests
run: |
cd ${{ github.workspace }}\ChocolateStoreCoreTests\
dotnet restore -r win-x86
- name: Build Tests
run: |
dotnet build "${{ github.workspace }}\ChocolateStoreCoreTests\ChocolateStoreCoreTests.csproj" --configuration Release --no-restore
- name: Test
run: |
dotnet test "${{ github.workspace }}\ChocolateStoreCoreTests\ChocolateStoreCoreTests.csproj" --configuration Release --no-restore --collect:"XPlat Code Coverage"
- name: ReportGenerator New
if: ${{ github.actor != 'dependabot[bot]' }}
run: |
dotnet tool install -g dotnet-reportgenerator-globaltool
$reports = "${{ github.workspace }}\ChocolateStoreCoreTests\**\coverage.cobertura.xml"
$targetdir = "${{ github.workspace }}\.coverage"
$reporttypes = 'MarkdownSummaryGithub;Badges;HtmlSummary'
$historydir = "${{ github.workspace }}\.coverage\History"
$title = 'ChocolateStoreCore Coverage Report'
$license = "${{ secrets.REPORTGENERATOR_LICENSE }}"
reportgenerator -reports:"$reports" -targetdir:"$targetdir" -reporttypes:"$reporttypes" -historydir:"$historydir" -license:"$license"
- name: Publish
if: ${{ github.actor != 'dependabot[bot]' }}
run: |
pwsh -File ${{ github.workspace }}\publish.ps1 -dir ${{ github.workspace }}\ChocolateStoreCore
- name: Create chocolatey package
if: ${{ github.actor != 'dependabot[bot]' }}
run: |
pwsh -File ${{ github.workspace }}\package.ps1 -dir ${{ github.workspace }}\ChocolateStoreCore
- name: Add artefacts
if: ${{ github.actor != 'dependabot[bot]' }}
uses: actions/upload-artifact@v3
with:
name: Assets
path: "${{ github.workspace }}/release/*"
- name: Test coverage report generation preparation
if: ${{ github.actor != 'dependabot[bot]' }}
run: |
if (!(Test-Path -path ${{ github.workspace }}\.coverage\History)) {
New-Item -ItemType directory -Force -Path ${{ github.workspace }}\.coverage\History
}
#- name: ReportGenerator
# if: ${{ github.actor != 'dependabot[bot]' }}
# uses: danielpalme/[email protected]
# with:
# reports: ${{ github.workspace }}\ChocolateStoreCoreTests\**\coverage.cobertura.xml
# targetdir: ${{ github.workspace }}\.coverage
# reporttypes: MarkdownSummaryGithub;Badges;HtmlSummary
# historydir: ${{ github.workspace }}\.coverage\History
# title: 'ChocolateStoreCore Coverage Report'
# license: ${{ secrets.REPORTGENERATOR_LICENSE }}
- name: Commit and push changes
if: ${{ github.actor != 'dependabot[bot]' }}
run: |
cd ${{ github.workspace }}
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git remote add origin_https https://${{ secrets.GIT_PAT }}@github.com/robertZaufall/ChocolateStoreCore.git
git remote update
$Local = $(git rev-parse '@') ; echo "Local: $Local"
$Remote = $(git rev-parse '@{u}') ; echo "Remote: $Remote"
if ($Local -ne $Remote) {
echo "Check-in cancelled due to changes in the meantime."
exit 0
}
git add ChocolateStoreCore/ChocolateStoreCore.csproj
git add version.txt
git add ChocolateyPackages\chocolatestore\chocolatestore.nuspec
git add .coverage/SummaryGithub.md
git add .coverage/summary.html
git add .coverage/badge_branchcoverage.svg
git add .coverage/badge_combined.svg
git add .coverage/badge_linecoverage.svg
git add .coverage/badge_methodcoverage.svg
git add .coverage/badge_shieldsio_branchcoverage_blue.svg
git add .coverage/badge_shieldsio_linecoverage_blue.svg
git add .coverage/badge_shieldsio_methodcoverage_blue.svg
git add .coverage/History
git commit -m "automated ci/cd task [skip actions]"
git push origin_https
env:
GIT_PAT: ${{ secrets.GIT_PAT }}