-
Notifications
You must be signed in to change notification settings - Fork 8
199 lines (166 loc) · 4.91 KB
/
main.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
name: build
on:
push:
branches: [ master, main, next, v2 ]
tags-ignore:
- 'v*'
paths-ignore:
- docs/*
- '**/*.md'
- test/*.go
pull_request:
branches: [ master, main, next, v2 ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go 1.21
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: install tooling
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
install-only: true
- name: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build cli
run: task build-powershell build-snapshot
shell: bash
- uses: actions/upload-artifact@v4
with:
name: c8y.windows.amd64
path: dist/windows_windows_amd64_v1/bin/c8y*
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: c8y.linux.amd64
path: dist/linux_linux_amd64_v1/bin/c8y*
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: c8y.macos.amd64
path: dist/macOS_darwin_amd64_v1/bin/c8y*
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: PSc8y Module
path: output_pwsh/PSc8y/
if-no-files-found: error
test-examples:
runs-on: ${{ matrix.os }}
needs: [build]
if: ${{ true }}
env:
C8Y_HOST: ${{ secrets.C8Y_HOST }}
C8Y_TENANT: ${{ secrets.C8Y_TENANT }}
C8Y_USER: ${{ secrets.C8Y_USER }}
C8Y_USERNAME: ${{ secrets.C8Y_USER }}
C8Y_PASSWORD: ${{ secrets.C8Y_PASSWORD }}
DEVICE_BOOTSTRAP_USER: ${{ secrets.DEVICE_BOOTSTRAP_USER }}
DEVICE_BOOTSTRAP_PASSWORD: ${{ secrets.DEVICE_BOOTSTRAP_PASSWORD }}
# Max timeout for each request (in milliseconds)
C8Y_SETTINGS_DEFAULTS_TIMEOUT: 30000
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Go 1.21
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
id: download
with:
name: c8y.linux.amd64
path: /home/runner/.local/bin/
- name: Test c8y examples
if: ${{ true }}
run: |
mv /home/runner/.local/bin/c8y* /home/runner/.local/bin/c8y || true
chmod +x /home/runner/.local/bin/c8y
echo "/home/runner/.local/bin" >> $GITHUB_PATH
c8y version
c8y currentuser get --select id
task test-cli
shell: bash
timeout-minutes: 20
test-pwsh:
runs-on: ${{ matrix.os }}
needs: [build]
if: ${{ false }}
env:
C8Y_HOST: ${{ secrets.C8Y_HOST }}
C8Y_TENANT: ${{ secrets.C8Y_TENANT }}
C8Y_USER: ${{ secrets.C8Y_USER }}
C8Y_PASSWORD: ${{ secrets.C8Y_PASSWORD }}
DEVICE_BOOTSTRAP_USER: ${{ secrets.DEVICE_BOOTSTRAP_USER }}
DEVICE_BOOTSTRAP_PASSWORD: ${{ secrets.DEVICE_BOOTSTRAP_PASSWORD }}
# Max timeout for each request (in milliseconds)
C8Y_SETTINGS_DEFAULTS_TIMEOUT: 30000
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Go 1.21
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build powershell module
run: task build-powershell build-snapshot
shell: bash
- name: Test powershell module
if: ${{ true }}
run: task test-powershell
shell: bash
timeout-minutes: 30
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.os }}
path: tools/PSc8y/reports/*.xml
publish-test-results:
runs-on: ubuntu-latest
needs: [test-pwsh]
# Disabled as pester does not support junit reports (only nunit)
if: always() && false
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Get test results
uses: actions/download-artifact@v4
with:
name: test-results-${{ matrix.os }}
path: test-results-${{ matrix.os }}
- name: Publish results
uses: EnricoMi/[email protected]
if: always()
with:
check_name: Test Results
github_token: ${{ secrets.GITHUB_TOKEN }}
files: test-results-${{ matrix.os }}/*.xml
log_level: DEBUG