forked from w35l3y/EdgeDrivers
-
Notifications
You must be signed in to change notification settings - Fork 0
229 lines (229 loc) · 7.31 KB
/
call-test-driver.yaml
File metadata and controls
229 lines (229 loc) · 7.31 KB
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
217
218
219
220
221
222
223
224
225
226
227
228
229
name: call-test-driver
#concurrency:
# group: ${{ github.workflow }}-${{ github.ref }}
# cancel-in-progress: true
on:
workflow_call:
inputs:
driver:
description: "Folder name of the driver"
required: true
type: string
version:
description: "Folder name of the version"
required: true
type: string
default: all
environment:
description: Environment
required: true
type: string
default: beta
workflow_dispatch:
inputs:
driver:
description: "Folder name of the driver"
required: true
type: string
version:
description: "Folder name of the version"
required: true
type: string
default: all
environment:
description: Environment
required: true
type: string
default: beta
jobs:
test_latest:
continue-on-error: true
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
strategy:
fail-fast: false
matrix:
stapi:
- v9_52
include:
- stapi: v9_52
release: apiv9_52/lua_libs-api_v9_52X
path: lua_libs-api_v9
steps:
- name: Check SMARTTHINGS_TOKEN
uses: actions/github-script@v3
env:
VALUE: ${{ secrets.SMARTTHINGS_TOKEN }}
if: env.VALUE == ''
with:
script: |
core.setFailed("Missing secrets.SMARTTHINGS_TOKEN")
- uses: actions/checkout@v3
- name: Load node
uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"
cache-dependency-path: package-lock.json
- name: Execute helpers
env:
DRIVER_FOLDER: ${{ inputs.driver }}
DRIVER_VERSION: ${{ inputs.version }}
run: |
npm ci
npm start
- name: Load/Install Lua
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: lua5.3
version: 1.0
- name: Create symbolic link
run: sudo ln -fs /usr/bin/lua5.3 /usr/bin/lua
# - name: Load Lua from cache
# uses: actions/cache@v3
# id: lua
# with:
# path: |
# /usr/bin/lua*
# /usr/share/doc/lua*
# /usr/share/man/man1/lua*.gz
# key: lua-5.3
# - name: Install Lua
# if: steps.lua.outputs.cache-hit != 'true'
# run: |
# sudo apt update
# sudo apt install lua5.3
- name: Load SmartThings CLI from cache
uses: actions/cache@v3
id: stcli
with:
path: smartthings
key: stcli-latest
- name: Download SmartThings CLI
if: steps.stcli.outputs.cache-hit != 'true'
run: wget https://github.com/SmartThingsCommunity/smartthings-cli/releases/latest/download/smartthings-linux-x64.tar.gz -O - | tar -xz
- name: Load capabilities from cache
uses: actions/cache@v3
id: capabilities
with:
path: capabilities
key: capabilities
- name: Load SmartThings API from cache
uses: actions/cache@v3
id: stapi
with:
path: ${{ matrix.path }}
key: stapi-${{ matrix.stapi }}
- name: Download SmartThings API
if: steps.stapi.outputs.cache-hit != 'true'
run: wget https://github.com/SmartThingsCommunity/SmartThingsEdgeDrivers/releases/download/${{ matrix.release }}.tar.gz -O - | tar -xz --skip-old-files
- name: Set Environment Variables
run: |
echo "LUA_PATH=$(pwd)/${{ matrix.path }}/?.lua;$(pwd)/${{ matrix.path }}/?/init.lua;./?.lua;./?/init.lua;;" >> $GITHUB_ENV
echo "ST_CAPABILITY_CACHE=$(pwd)/${{ inputs.driver }}/tmp/capabilities/" >> $GITHUB_ENV
echo "$(pwd)" >> $GITHUB_PATH
- name: Run tests
id: test
working-directory: ${{ inputs.driver }}/tmp/src
run: lua test/init.lua
env:
SMARTTHINGS_TOKEN: ${{ secrets.SMARTTHINGS_TOKEN }}
test:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
strategy:
fail-fast: false
matrix:
stapi:
- v5_48
- v6_49
- v8_51
include:
- stapi: v5_48
release: apiv5_48/lua_libs-api_v5_48X
path: lua_libs-api_v5
- stapi: v6_49
release: apiv6_49/lua_libs-api_v6_49X
path: lua_libs-api_v6
- stapi: v8_51
release: apiv8_51/lua_libs-api_v8_51X
path: lua_libs-api_v8
steps:
- name: Check SMARTTHINGS_TOKEN
uses: actions/github-script@v3
env:
VALUE: ${{ secrets.SMARTTHINGS_TOKEN }}
if: env.VALUE == ''
with:
script: |
core.setFailed("Missing secrets.SMARTTHINGS_TOKEN")
- uses: actions/checkout@v3
- name: Load node
uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"
cache-dependency-path: package-lock.json
- name: Execute helpers
env:
DRIVER_FOLDER: ${{ inputs.driver }}
DRIVER_VERSION: ${{ inputs.version }}
run: |
npm ci
npm start
- name: Load/Install Lua
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: lua5.3
version: 1.0
- name: Create symbolic link
run: sudo ln -fs /usr/bin/lua5.3 /usr/bin/lua
# - name: Load Lua from cache
# uses: actions/cache@v3
# id: lua
# with:
# path: |
# /usr/bin/lua*
# /usr/share/doc/lua*
# /usr/share/man/man1/lua*.gz
# key: lua-5.3
# - name: Install Lua
# if: steps.lua.outputs.cache-hit != 'true'
# run: |
# sudo apt update
# sudo apt install lua5.3
- name: Load SmartThings CLI from cache
uses: actions/cache@v3
id: stcli
with:
path: smartthings
key: stcli-latest
- name: Download SmartThings CLI
if: steps.stcli.outputs.cache-hit != 'true'
run: wget https://github.com/SmartThingsCommunity/smartthings-cli/releases/latest/download/smartthings-linux-x64.tar.gz -O - | tar -xz
- name: Load capabilities from cache
uses: actions/cache@v3
id: capabilities
with:
path: capabilities
key: capabilities
- name: Load SmartThings API from cache
uses: actions/cache@v3
id: stapi
with:
path: ${{ matrix.path }}
key: stapi-${{ matrix.stapi }}
- name: Download SmartThings API
if: steps.stapi.outputs.cache-hit != 'true'
run: wget https://github.com/SmartThingsCommunity/SmartThingsEdgeDrivers/releases/download/${{ matrix.release }}.tar.gz -O - | tar -xz --skip-old-files
- name: Set Environment Variables
run: |
echo "LUA_PATH=$(pwd)/${{ matrix.path }}/?.lua;$(pwd)/${{ matrix.path }}/?/init.lua;./?.lua;./?/init.lua;;" >> $GITHUB_ENV
echo "ST_CAPABILITY_CACHE=$(pwd)/${{ inputs.driver }}/tmp/capabilities/" >> $GITHUB_ENV
echo "$(pwd)" >> $GITHUB_PATH
- name: Run tests
id: test
working-directory: ${{ inputs.driver }}/tmp/src
run: lua test/init.lua
env:
SMARTTHINGS_TOKEN: ${{ secrets.SMARTTHINGS_TOKEN }}