/
action.yml
76 lines (67 loc) · 2 KB
/
action.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
name: 'ioBroker Testing: Adapter tests'
author: 'AlCalzone'
#description: 'Greet someone'
inputs:
node-version:
description: 'Node.js version'
required: true
install-command:
description: "Overwrite the default install command"
default: "npm ci"
os:
description: 'The operation system to use'
required: true
build:
description: 'Set to true when the adapter needs a build step before testing'
default: 'false'
build-command:
description: 'Overwrite the default build command'
default: 'npm run build'
extra-tests:
description: 'Add an additional command to run before the built-in tests'
default: 'false'
# Conditional syntax isn't supported, but there are workarounds:
# https://github.com/actions/runner/issues/834#issuecomment-909921245
runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ inputs.node-version }}
cache: 'npm'
- name: Install Dependencies
shell: bash
run: ${{ inputs.install-command }}
- name: Create a clean build
shell: bash
run: |
if ${{ inputs.build }}; then
${{ inputs.build-command }}
else
echo "Skipping build step..."
fi
- name: Run additional tests
shell: bash
run: |
if [[ "${{ inputs.extra-tests }}" == "false" ]] ; then
echo "Skipping build step..."
else
${{ inputs.extra-tests }}
fi
- name: Run unit tests
shell: bash
run: |
if npm run | grep -q "test:unit" ; then
echo "Unit test script found"
npm run test:unit
else
echo "No unit tests defined, skipping..."
fi
- name: Run integration tests
shell: bash
run: npm run test:integration
env:
DEBUG: 'testing:*'