-
Notifications
You must be signed in to change notification settings - Fork 5
197 lines (188 loc) · 9.59 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
on:
- workflow_dispatch
- pull_request
- push
name: CI
jobs:
unittests:
name: Unit tests
strategy:
matrix:
osversion:
- windows-latest
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.osversion }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup dotnet 2.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: '2.1.805' # SDK Version to use.
- run: dotnet restore --packages ../packages
working-directory: ./commercetools.Sdk
- run: dotnet build --no-restore --source ../packages -c Release
working-directory: ./commercetools.Sdk
- run: dotnet test --verbosity=normal Tests/commercetools.Sdk.Domain.Tests --no-build -c Release
working-directory: ./commercetools.Sdk
- run: dotnet test --verbosity=normal Tests/commercetools.Sdk.HttpApi.Tests --no-build -c Release
working-directory: ./commercetools.Sdk
- run: dotnet test --verbosity=normal Tests/commercetools.Sdk.Linq.Tests --no-build -c Release
working-directory: ./commercetools.Sdk
- run: dotnet test --verbosity=normal Tests/commercetools.Sdk.Serialization.Tests --no-build -c Release
working-directory: ./commercetools.Sdk
integrationtests:
name: Integration tests
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
container:
- BuiltIn
- SimpleInjector
env:
CTP_Container: ${{ matrix.container }}
CTP_Client__ClientId: ${{ secrets.CTP_CLIENT_ID }}
CTP_Client__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET }}
CTP_Client__ProjectKey: ${{ secrets.CTP_PROJECT_KEY }}
CTP_Client__Scope: ${{ secrets.CTP_SCOPE }}
CTP_TokenClient__ClientId: ${{ secrets.CTP_CLIENT_ID }}
CTP_TokenClient__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET }}
CTP_TokenClient__ProjectKey: ${{ secrets.CTP_PROJECT_KEY }}
CTP_TokenClient__Scope: ${{ secrets.CTP_SCOPE }}
CTP_TokenClientWithSmallerScope__ClientId: ${{ secrets.CTP_CLIENT_ID }}
CTP_TokenClientWithSmallerScope__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET }}
CTP_TokenClientWithSmallerScope__ProjectKey: ${{ secrets.CTP_PROJECT_KEY }}
CTP_TokenClientWithSmallerScope__Scope: ${{ secrets.CTP_SCOPE }}
CTP_TokenClientWithAnonymousScope__ClientId: ${{ secrets.CTP_CLIENT_ID }}
CTP_TokenClientWithAnonymousScope__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET }}
CTP_TokenClientWithAnonymousScope__ProjectKey: ${{ secrets.CTP_PROJECT_KEY }}
CTP_TokenClientWithAnonymousScope__Scope: ${{ secrets.CTP_SCOPE }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup
uses: actions/setup-dotnet@v1
with:
dotnet-version: '2.1.805' # SDK Version to use.
- run: dotnet restore --packages ../packages
working-directory: ./commercetools.Sdk
- run: dotnet build --no-restore --source ../packages -c Release
working-directory: ./commercetools.Sdk
- run: dotnet test IntegrationTests/commercetools.Sdk.IntegrationTests --no-build -c Release
if: github.event_name == 'push'
working-directory: ./commercetools.Sdk
- run: dotnet test IntegrationTests/commercetools.Sdk.IntegrationTests --no-build -c Release
if: github.event_name == 'pull_request'
working-directory: ./commercetools.Sdk
env:
CTP_Client__ClientId: ${{ secrets.CTP_CLIENT_ID_PR }}
CTP_Client__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET_PR }}
CTP_Client__ProjectKey: ${{ secrets.CTP_PROJECT_KEY_PR }}
CTP_Client__Scope: ${{ secrets.CTP_SCOPE_PR }}
CTP_TokenClient__ClientId: ${{ secrets.CTP_CLIENT_ID_PR }}
CTP_TokenClient__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET_PR }}
CTP_TokenClient__ProjectKey: ${{ secrets.CTP_PROJECT_KEY_PR }}
CTP_TokenClient__Scope: ${{ secrets.CTP_SCOPE_PR }}
CTP_TokenClientWithSmallerScope__ClientId: ${{ secrets.CTP_CLIENT_ID_PR }}
CTP_TokenClientWithSmallerScope__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET_PR }}
CTP_TokenClientWithSmallerScope__ProjectKey: ${{ secrets.CTP_PROJECT_KEY_PR }}
CTP_TokenClientWithSmallerScope__Scope: ${{ secrets.CTP_SCOPE_PR }}
CTP_TokenClientWithAnonymousScope__ClientId: ${{ secrets.CTP_CLIENT_ID_PR }}
CTP_TokenClientWithAnonymousScope__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET_PR }}
CTP_TokenClientWithAnonymousScope__ProjectKey: ${{ secrets.CTP_PROJECT_KEY_PR }}
CTP_TokenClientWithAnonymousScope__Scope: ${{ secrets.CTP_SCOPE_PR }}
core3:
name: Core3 tests
runs-on: ubuntu-latest
strategy:
matrix:
container:
- BuiltIn
- SimpleInjector
env:
CTP_Container: ${{ matrix.container }}
CTP_Client__ClientId: ${{ secrets.CTP_CLIENT_ID }}
CTP_Client__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET }}
CTP_Client__ProjectKey: ${{ secrets.CTP_PROJECT_KEY }}
CTP_Client__Scope: ${{ secrets.CTP_SCOPE }}
CTP_TokenClient__ClientId: ${{ secrets.CTP_CLIENT_ID }}
CTP_TokenClient__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET }}
CTP_TokenClient__ProjectKey: ${{ secrets.CTP_PROJECT_KEY }}
CTP_TokenClient__Scope: ${{ secrets.CTP_SCOPE }}
CTP_TokenClientWithSmallerScope__ClientId: ${{ secrets.CTP_CLIENT_ID }}
CTP_TokenClientWithSmallerScope__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET }}
CTP_TokenClientWithSmallerScope__ProjectKey: ${{ secrets.CTP_PROJECT_KEY }}
CTP_TokenClientWithSmallerScope__Scope: ${{ secrets.CTP_SCOPE }}
CTP_TokenClientWithAnonymousScope__ClientId: ${{ secrets.CTP_CLIENT_ID }}
CTP_TokenClientWithAnonymousScope__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET }}
CTP_TokenClientWithAnonymousScope__ProjectKey: ${{ secrets.CTP_PROJECT_KEY }}
CTP_TokenClientWithAnonymousScope__Scope: ${{ secrets.CTP_SCOPE }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup dotnet 3.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.0.100' # SDK Version to use.
- run: dotnet restore IntegrationTests/commercetools.Sdk.Core3Tests/commercetools.Sdk.Core3Tests.csproj --packages ../packages
working-directory: ./commercetools.Sdk
- run: dotnet build IntegrationTests/commercetools.Sdk.Core3Tests/commercetools.Sdk.Core3Tests.csproj --no-restore --source ../packages -c Release
working-directory: ./commercetools.Sdk
- run: dotnet test IntegrationTests/commercetools.Sdk.Core3Tests/commercetools.Sdk.Core3Tests.csproj --no-build -c Release
if: github.event_name == 'push'
working-directory: ./commercetools.Sdk
- run: dotnet test IntegrationTests/commercetools.Sdk.Core3Tests/commercetools.Sdk.Core3Tests.csproj --no-build -c Release
if: github.event_name == 'pull_request'
working-directory: ./commercetools.Sdk
env:
CTP_Client__ClientId: ${{ secrets.CTP_CLIENT_ID_PR }}
CTP_Client__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET_PR }}
CTP_Client__ProjectKey: ${{ secrets.CTP_PROJECT_KEY_PR }}
CTP_Client__Scope: ${{ secrets.CTP_SCOPE_PR }}
CTP_TokenClient__ClientId: ${{ secrets.CTP_CLIENT_ID_PR }}
CTP_TokenClient__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET_PR }}
CTP_TokenClient__ProjectKey: ${{ secrets.CTP_PROJECT_KEY_PR }}
CTP_TokenClient__Scope: ${{ secrets.CTP_SCOPE_PR }}
CTP_TokenClientWithSmallerScope__ClientId: ${{ secrets.CTP_CLIENT_ID_PR }}
CTP_TokenClientWithSmallerScope__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET_PR }}
CTP_TokenClientWithSmallerScope__ProjectKey: ${{ secrets.CTP_PROJECT_KEY_PR }}
CTP_TokenClientWithSmallerScope__Scope: ${{ secrets.CTP_SCOPE_PR }}
CTP_TokenClientWithAnonymousScope__ClientId: ${{ secrets.CTP_CLIENT_ID_PR }}
CTP_TokenClientWithAnonymousScope__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET_PR }}
CTP_TokenClientWithAnonymousScope__ProjectKey: ${{ secrets.CTP_PROJECT_KEY_PR }}
CTP_TokenClientWithAnonymousScope__Scope: ${{ secrets.CTP_SCOPE_PR }}
artifacts:
name: Create artifacts
runs-on: ubuntu-latest
needs: [unittests, integrationtests, core3]
steps:
- uses: actions/checkout@master
# Authenticates packages to push to GPR
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '2.1.805'
source-url: https://nuget.pkg.github.com/commercetools/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./patch_csproj.rb --version 1.0.0-alpha-${{ github.run_number }} --patch **/*.csproj
- run: dotnet restore --packages ../packages
working-directory: ./commercetools.Sdk
- run: dotnet build --no-restore --source ../packages -c Release
working-directory: ./commercetools.Sdk
- name: Create the package
run: dotnet pack -c Release -o ../../pack/
working-directory: ./commercetools.Sdk
- name: List packages
run: ls -la pack
- name: Publish packages to GitHub registry
if: github.ref == 'refs/heads/master'
run: dotnet nuget push "pack/*.nupkg" -k ${GITHUB_TOKEN} -s https://nuget.pkg.github.com/commercetools/index.json --no-symbols true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v2
with:
name: commercetools.Sdk.1.0.0-alpha-${{ github.run_number }}
path: pack