-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaction.yml
62 lines (61 loc) · 2.16 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
name: 'Wokwi IoT and Embedded System Simulator'
description: 'This action tests your firmware builds with the Wokwi Simulator'
branding:
color: blue
icon: play
inputs:
token:
description: 'Wokwi API token'
required: true
path:
description: 'Path to the directory where wokwi.toml is, relative to the root of your repository'
default: '/'
required: false
timeout:
description: 'Timeout in milliseconds for the simulation'
default: '10000'
required: false
expect_text:
description: 'Text to expect in the serial output, test will fail if not found'
default: ''
required: false
fail_text:
description: 'Text that fails the test if found in the serial output'
default: ''
required: false
scenario:
description: 'Path to scenario yaml file (relative to project directory)'
default: ''
required: false
diagram_file:
description: 'Custom diagram file'
default: 'diagram.json'
required: false
elf:
description: 'Custom firmware ELF path'
default: ''
required: false
serial_log_file:
description: 'Serial log file to be written (relative to project directory)'
default: ''
required: false
runs:
using: 'composite'
steps:
- name: Install wokwi-cli
run: |
wget -q -O /usr/local/bin/wokwi-cli https://github.com/wokwi/wokwi-cli/releases/latest/download/wokwi-cli-linuxstatic-x64
chmod +x /usr/local/bin/wokwi-cli
shell: bash
- run: |
wokwi-cli --timeout "${{ inputs.timeout }}" --expect-text "$CI_EXPECT_TEXT" \
${{ inputs.diagram_file != '' && format('--diagram-file "{0}"', inputs.diagram_file) || '' }} \
${{ inputs.elf != '' && format('--elf "{0}"', inputs.elf) || '' }} \
--fail-text "$CI_FAIL_TEXT" --scenario "${{ inputs.scenario }}" "${GITHUB_WORKSPACE}/${{ inputs.path }}" \
--serial-log-file "${{ inputs.serial_log_file }}"
env:
WOKWI_CLI_TOKEN: ${{ inputs.token }}
FORCE_COLOR: 2 # Enables color output - see https://github.com/chalk/supports-color/issues/106
CI_EXPECT_TEXT: ${{ inputs.expect_text }}
CI_FAIL_TEXT: ${{ inputs.fail_text }}
shell: bash