-
Notifications
You must be signed in to change notification settings - Fork 2
133 lines (108 loc) · 5.54 KB
/
ci.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
name: hot-potato-ci
on:
push
env:
isMaster: ${{ github.ref == 'refs/heads/master' }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.EXPAND_TEAMS_PAT }}
submodules: true
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Generate Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
configFilePath: './GitVersion.yml'
- name: Display GitVersion outputs
run: |
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}"
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}"
- name: Setup .NET 5.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- name: Build
run: |
dotnet build --configuration Release -p:Version=${{ env.GitVersion_MajorMinorPatch }}
- name: Run Unit Tests
run: |
dotnet test ./test/HotPotato.Core.Test/HotPotato.Core.Test.csproj -c Release -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=$GITHUB_WORKSPACE/test/coverage/coreCoverage.xml -p:Exclude="[xunit.*]*" -l:"JUnit;LogFilePath=$GITHUB_WORKSPACE/test/results/coreResults.xml" --no-restore --no-build
dotnet test ./test/HotPotato.AspNetCore.Middleware.Test/HotPotato.AspNetCore.Middleware.Test.csproj -c Release -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=$GITHUB_WORKSPACE/test/coverage/middlewareCoverage.xml -p:Include="[*.Middleware]*" -l:"JUnit;LogFilePath=$GITHUB_WORKSPACE/test/results/middlewareResults.xml" --no-restore --no-build
dotnet test ./test/HotPotato.OpenApi.Test/HotPotato.OpenApi.Test.csproj -c Release -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=$GITHUB_WORKSPACE/test/coverage/openApiCoverage.xml -p:Include="[*.OpenApi]*" -l:"JUnit;LogFilePath=$GITHUB_WORKSPACE/test/results/openapiResults.xml" --no-restore --no-build
- name: Run Integration Tests
run: |
dotnet test ./test/HotPotato.Integration.Test/HotPotato.Integration.Test.csproj -c Release -l:"JUnit;LogFilePath=$GITHUB_WORKSPACE/test/results/integrationResults.xml" --no-restore --no-build
- name: Run Performance Tests
run: |
dotnet test ./test/HotPotato.Benchmark.Test/HotPotato.Benchmark.Test.csproj -c Release --no-restore --no-build
- name: Run E2E Tests
env:
SpecToken: ${{ secrets.GITHUB_TOKEN }}
run: |
dotnet test ./test/HotPotato.E2E.Test/HotPotato.E2E.Test.csproj -c Release -l:"JUnit;LogFilePath=$GITHUB_WORKSPACE/test/results/E2EResults.xml" --no-restore --no-build
- name: Run TestServer Tests
env:
SpecToken: ${{ secrets.GITHUB_TOKEN }}
run: |
dotnet test ./test/HotPotato.TestServer.Test/HotPotato.TestServ.Test.csproj -c Release -l:"JUnit;LogFilePath=$GITHUB_WORKSPACE/test/results/testServerResults.xml" --no-restore --no-build
- name: Start Hot Potato For Postman Tests
env:
SpecToken: ${{ secrets.GITHUB_TOKEN }}
run: |
dotnet $GITHUB_WORKSPACE/src/HotPotato.AspNetCore.Host/bin/Release/net5.0/HotPotato.AspNetCore.Host.dll &
dotnet $GITHUB_WORKSPACE/test/HotPotato.Api/bin/Release/net5.0/HotPotato.Test.Api.dll &
- name: Run Postman Tests
uses: anthonyvscode/newman-action@v1
with:
collection: ./test/HappyPathTests.postman_collection.json
reporters: cli
- name: Deploy
if: ${{ success() && env.isMaster == 'true' }}
run: |
dotnet pack -p:PackageVersion=${{ env. GitVersion_NuGetVersionV2 }} -c Release --no-build --no-restore --output $GITHUB_WORKSPACE/nuget
dotnet nuget push $GITHUB_WORKSPACE/nuget/**/*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/HylandSoftware/index.json --skip-duplicate
# - name: Push Images
# #if: env.isMaster == 'true'
# env:
# TAG_SCHEME: ghcr.io/hylandsoftware
# GITHUB_USR: testautomation_github
# run: |
# docker login -u $GITHUB_USR -p ${{ secrets.TESTAUTOMATION_GITHUB }} $TAG_SCHEME
# docker build --tag $TAG_SCHEME/tato/hot-potato:${{ env.GitVersion_MajorMinorPatch }} --build-arg IMAGE_VERSION=${{ env.GitVersion_MajorMinorPatch }} --build-arg CERT_INSTALL=${{ secrets.CERT_INSTALL }}
# docker push $TAG_SCHEME/tato/hot-potato:${{ env.GitVersion_MajorMinorPatch }}
# docker tag $TAG_SCHEME/tato/hot-potato:${{ env.GitVersion_MajorMinorPatch }} $TAG_SCHEME/tato/hot-potato:latest
# docker push $TAG_SCHEME/tato/hot-potato:latest
- name: Archive code coverage results
uses: actions/upload-artifact@v2
with:
name: code-coverage-reports
path: ./test/coverage/*.xml
- name: Archive test results
uses: actions/upload-artifact@v2
with:
name: test-results
path: ./test/results/*.xml
- name: Create Release
uses: actions/create-release@v1
if: ${{ success() && env.isMaster == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.gitversion.outputs.nuGetVersionV2 }}
release_name: ${{ steps.gitversion.outputs.nuGetVersionV2 }}
draft: false
prerelease: false