-
-
Notifications
You must be signed in to change notification settings - Fork 149
137 lines (131 loc) · 4.47 KB
/
test.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
name: test
on:
workflow_call:
pull_request:
branches:
- '**'
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
jobs:
sample:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
- run: dotnet run --project ./samples/Riok.Mapperly.Sample
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
- run: dotnet build /p:TreatWarningsAsErrors=true
- run: dotnet test --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: sudo apt update && sudo apt -y install zipmerge # zipmerge is used to merge the multi target nupkg
- uses: actions/[email protected]
- run: dotnet tool restore
- run: RELEASE_VERSION="0.0.1-dev.$GITHUB_RUN_ID" ./build/package.sh
- uses: actions/upload-artifact@v3
with:
name: mapperly-nupkg
path: artifacts/*.nupkg
- if: failure()
uses: actions/upload-artifact@v3
with:
name: verify-test-results
path: '**/*.received.*'
validate-package:
needs: package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
- run: dotnet tool restore
- uses: actions/download-artifact@v3
with:
name: mapperly-nupkg
path: artifacts
- run: dotnet meziantou.validate-nuget-package ./artifacts/*.nupkg
- run: dotnet validate package local ./artifacts/*.nupkg
integration-test:
needs: package
runs-on: ubuntu-latest
# use an alpine container to ensure only the dotnet version we want to test is installed,
# ubuntu-latest already contains several dotnet versions...
container:
image: alpine:3.17
strategy:
matrix:
dotnet:
- '8.0'
- '7.0'
- '6.0'
steps:
- uses: actions/checkout@v3
# install required dotnet dependencies
# https://learn.microsoft.com/en-us/dotnet/core/install/linux-alpine#dependencies
- run: apk add --no-cache bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib
# delete global.json since we want to use custom versions here
- run: rm global.json
- uses: actions/[email protected]
with:
dotnet-version: ${{ matrix.dotnet }}
- run: dotnet --list-sdks
- uses: actions/download-artifact@v3
with:
name: mapperly-nupkg
path: artifacts
# use nupkg artifact for integration tests instead of project references
- run: dotnet nuget add source "$(pwd)/artifacts"
- run: >-
dotnet build
-f net${{ matrix.dotnet }}
-p:MapperlyIntegrationTestsTargetFramework=net${{ matrix.dotnet }}
-p:MapperlyNugetPackageVersion="0.0.1-dev.$GITHUB_RUN_ID"
working-directory: ./test/Riok.Mapperly.IntegrationTests
- run: dotnet test --no-build -f net${{ matrix.dotnet }}
working-directory: ./test/Riok.Mapperly.IntegrationTests
- if: failure()
uses: actions/upload-artifact@v3
with:
name: verify-test-results
path: '**/*.received.*'
integration-test-net-framework:
needs: package
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
# delete global.json since we want to use custom versions here
- run: rm global.json
- uses: actions/download-artifact@v3
with:
name: mapperly-nupkg
path: artifacts
# use nupkg artifact for integration tests instead of project references
- run: dotnet nuget add source "$(Get-Location)/artifacts"
- run: >-
dotnet build
-f net48
-p:MapperlyIntegrationTestsTargetFramework=net48
-p:MapperlyNugetPackageVersion=0.0.1-dev.$env:GITHUB_RUN_ID
working-directory: ./test/Riok.Mapperly.IntegrationTests
- run: dotnet test --no-build -f net48
working-directory: ./test/Riok.Mapperly.IntegrationTests
- if: failure()
uses: actions/upload-artifact@v3
with:
name: verify-test-results
path: '**/*.received.*'