-
Notifications
You must be signed in to change notification settings - Fork 12
217 lines (204 loc) · 9.46 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
on:
- workflow_dispatch
- pull_request
- push
name: CI
jobs:
licenses:
name: License update
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Support longpaths
run: git config --global core.longpaths true
- name: Checkout
uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
- run: dotnet tool restore
working-directory: ./commercetools.Sdk
- run: dotnet restore --configfile Nuget.config --packages ../packages
working-directory: ./commercetools.Sdk
- run: dotnet build --no-restore --source ../packages -c Release
working-directory: ./commercetools.Sdk
- run: dotnet tool install --global dotnet-project-licenses
- run: ./license-check.sh
- uses: stefanzweifel/git-auto-commit-action@v4
if: github.event_name == 'push' && github.ref != 'refs/heads/master'
with:
file_pattern: 'licenses/index.json'
commit_message: "TASK: Updating license information"
commit_user_name: automation-commercetools
commit_user_email: automation@commercetools.com
commit_author: Auto Mation <automation@commercetools.com>
disable_globbing: true
unittests:
name: Unit tests
continue-on-error: true
strategy:
matrix:
osversion:
- windows-latest
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.osversion }}
steps:
- name: Support longpaths
run: git config --global core.longpaths true
- name: Checkout
uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
- run: dotnet tool restore
working-directory: ./commercetools.Sdk
- run: dotnet restore --configfile Nuget.config --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.Api.Serialization.Tests --no-build -c Release
working-directory: ./commercetools.Sdk
- run: dotnet test --verbosity=normal Tests/commercetools.Sdk.Api.Tests --no-build -c Release
working-directory: ./commercetools.Sdk
- run: dotnet test --verbosity=normal Tests/commercetools.Sdk.ImportApi.Tests --no-build -c Release
working-directory: ./commercetools.Sdk
- run: dotnet test --verbosity=normal Tests/commercetools.Sdk.HistoryApi.Tests --no-build -c Release
working-directory: ./commercetools.Sdk
integrationtests:
name: Integration tests
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
ClientType:
- Stream
- String
env:
CTP_ClientType: ${{ matrix.ClientType }}
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_Import__ClientId: ${{ secrets.CTP_CLIENT_ID }}
CTP_Import__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET }}
CTP_Import__ProjectKey: ${{ secrets.CTP_PROJECT_KEY }}
CTP_Import__Scope: ${{ secrets.CTP_SCOPE }}
CTP_Import__ApiBaseAddress: "https://import.europe-west1.gcp.commercetools.com/"
CTP_MeClient__ClientId: ${{ secrets.CTP_MECLIENT_ID }}
CTP_MeClient__ClientSecret: ${{ secrets.CTP_MECLIENT_SECRET }}
CTP_MeClient__ProjectKey: ${{ secrets.CTP_MEPROJECT_KEY }}
CTP_MeClient__Scope: ${{ secrets.CTP_MESCOPES }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
- run: dotnet tool restore
working-directory: ./commercetools.Sdk
- run: dotnet restore --configfile Nuget.config --packages ../packages
working-directory: ./commercetools.Sdk
- run: dotnet build --no-restore --source ../packages -c Release
working-directory: ./commercetools.Sdk
- run: dotnet test IntegrationTests/commercetools.Api.IntegrationTests --verbosity=normal --no-build -c Release
if: github.event_name == 'push'
working-directory: ./commercetools.Sdk
- run: dotnet test IntegrationTests/commercetools.Api.IntegrationTests --verbosity=normal --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_Import__ClientId: ${{ secrets.CTP_CLIENT_ID_PR }}
CTP_Import__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET_PR }}
CTP_Import__ProjectKey: ${{ secrets.CTP_PROJECT_KEY_PR }}
CTP_Import__Scope: ${{ secrets.CTP_SCOPE_PR }}
CTP_Import__ApiBaseAddress: "https://import.europe-west1.gcp.commercetools.com/"
CTP_MeClient__ClientId: ${{ secrets.CTP_MECLIENT_ID_PR }}
CTP_MeClient__ClientSecret: ${{ secrets.CTP_MECLIENT_SECRET_PR }}
CTP_MeClient__ProjectKey: ${{ secrets.CTP_MEPROJECT_KEY_PR }}
CTP_MeClient__Scope: ${{ secrets.CTP_MESCOPES_PR }}
- run: dotnet test IntegrationTests/commercetools.ImportApi.IntegrationTests --verbosity=normal --no-build -c Release
if: github.event_name == 'push'
working-directory: ./commercetools.Sdk
- run: dotnet test IntegrationTests/commercetools.ImportApi.IntegrationTests --verbosity=normal --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_MeClient__ClientId: ${{ secrets.CTP_MECLIENT_ID_PR }}
CTP_MeClient__ClientSecret: ${{ secrets.CTP_MECLIENT_SECRET_PR }}
CTP_MeClient__ProjectKey: ${{ secrets.CTP_MEPROJECT_KEY_PR }}
CTP_MeClient__Scope: ${{ secrets.CTP_MESCOPES_PR }}
- run: dotnet test IntegrationTests/commercetools.GraphQL.Api.IntegrationTests --verbosity=normal --no-build -c Release
if: github.event_name == 'push'
working-directory: ./commercetools.Sdk
- run: dotnet test IntegrationTests/commercetools.GraphQL.Api.IntegrationTests --verbosity=normal --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_Import__ClientId: ${{ secrets.CTP_CLIENT_ID_PR }}
CTP_Import__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET_PR }}
CTP_Import__ProjectKey: ${{ secrets.CTP_PROJECT_KEY_PR }}
CTP_Import__Scope: ${{ secrets.CTP_SCOPE_PR }}
CTP_Import__ApiBaseAddress: "https://import.europe-west1.gcp.commercetools.com/"
CTP_MeClient__ClientId: ${{ secrets.CTP_MECLIENT_ID_PR }}
CTP_MeClient__ClientSecret: ${{ secrets.CTP_MECLIENT_SECRET_PR }}
CTP_MeClient__ProjectKey: ${{ secrets.CTP_MEPROJECT_KEY_PR }}
CTP_MeClient__Scope: ${{ secrets.CTP_MESCOPES_PR }}
artifacts:
name: Create artifacts
runs-on: ubuntu-latest
needs: [unittests, integrationtests]
steps:
- uses: actions/checkout@v3
# Authenticates packages to push to GPR
- uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
source-url: https://nuget.pkg.github.com/commercetools/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./patch_csproj.rb --version 0.1.0-alpha-${{ github.run_number }} --patch **/*.csproj
- run: dotnet tool restore
working-directory: ./commercetools.Sdk
- run: dotnet restore --configfile Nuget.config --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/ --configfile Nuget.config
working-directory: ./commercetools.Sdk
- name: List packages
run: ls -la pack
- name: Publish Nuget 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 --skip-duplicate --no-symbols
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: commercetools.Sdkv2.0.1.0-alpha-${{ github.run_number }}
path: pack