-
Notifications
You must be signed in to change notification settings - Fork 118
163 lines (145 loc) · 4.8 KB
/
hil.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
name: HIL
on:
pull_request:
push:
workflow_dispatch:
inputs:
repository:
description: "Owner and repository to test"
required: true
default: 'esp-rs/espflash'
branch:
description: "Branch, tag or SHA to checkout."
required: true
default: "main"
merge_group:
env:
CARGO_TERM_COLOR: always
# Cancel any currently running workflows from the same PR, branch, or
# tag when a new workflow is triggered.
#
# https://stackoverflow.com/a/66336834
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
jobs:
build-espflash:
name: Build espflash
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
if: github.event_name != 'workflow_dispatch'
- uses: actions/checkout@v4
if: github.event_name == 'workflow_dispatch'
with:
repository: ${{ github.event.inputs.repository }}
ref: ${{ github.event.inputs.branch }}
- uses: ./.github/actions/setup-target
with:
arch: x86_64
target: x86_64-unknown-linux-gnu
- name: Build espflash
run: cargo build --release
working-directory: espflash
- uses: actions/upload-artifact@v4
with:
name: espflash
path: target/release/espflash
if-no-files-found: error
run-target:
name: ${{ matrix.board.mcu }}${{ matrix.board.freq }}
if: ${{ github.repository_owner == 'esp-rs' }}
needs: build-espflash
runs-on: [self-hosted, linux, x64, "${{ matrix.board.mcu }}${{ matrix.board.freq }}" ]
strategy:
matrix:
board:
- mcu: esp32
- mcu: esp32c2
freq: -26mhz
flag: -x 26mhz
- mcu: esp32c3
- mcu: esp32c6
- mcu: esp32h2
- mcu: esp32s2
- mcu: esp32s3
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: espflash
path: espflash_app
- run: chmod +x espflash_app/espflash
- name: board-info test
env:
ESPFLASH_PORT: /dev/serial_ports/${{ matrix.board.mcu }}
shell: bash
run: |
result=$(espflash_app/espflash board-info)
echo "$result"
if [[ $? -ne 0 || ! "$result" =~ "esp32" ]]; then
exit 1
fi
- name: flash test
env:
ESPFLASH_PORT: /dev/serial_ports/${{ matrix.board.mcu }}
ESPFLASH_APP: espflash/resources/apps/${{ matrix.board.mcu }}
shell: bash
run: |
result=$(espflash_app/espflash flash ${{ env.ESPFLASH_APP }} 2>&1)
echo "$result"
if [[ ! $result =~ "Flashing has completed!" ]]; then
exit 1
fi
- name: monitor test
env:
ESPFLASH_PORT: /dev/serial_ports/${{ matrix.board.mcu }}
shell: bash
run: |
result=$(timeout 5s espflash_app/espflash monitor --non-interactive || true)
echo "$result"
if ! echo "$result" | grep -q "Hello world!"; then
exit 1
fi
- name: erase/read flash test
env:
ESPFLASH_PORT: /dev/serial_ports/${{ matrix.board.mcu }}
run: |
result=$(espflash_app/espflash erase-flash 2>&1)
echo "$result"
if [[ ! $result =~ "Flash has been erased!" ]]; then
exit 1
fi
result=$(espflash_app/espflash read-flash 0 0x200 flash_content.bin 2>&1)
echo "$result"
if [[ ! $result =~ "Flash content successfully read and written to" ]]; then
exit 1
fi
echo "Checking if flash is empty"
if hexdump -v -e '/1 "%02x"' "flash_content.bin" | grep -qv '^ff*$'; then
exit 1
fi
echo "Flash is empty!"
- name: save-image/write-bin test
env:
ESPFLASH_PORT: /dev/serial_ports/${{ matrix.board.mcu }}
ESPFLASH_APP: espflash/resources/apps/${{ matrix.board.mcu }}
run: |
result=$(espflash_app/espflash save-image --merge --chip ${{ matrix.board.mcu }} ${{ matrix.board.flag }} ${{ env.ESPFLASH_APP }} app.bin 2>&1)
echo "$result"
if [[ ! $result =~ "Image successfully saved!" ]]; then
exit 1
fi
echo "Writting binary"
result=$(espflash_app/espflash write-bin 0x0 app.bin 2>&1)
echo "$result"
if [[ ! $result =~ "Binary successfully written to flash!" ]]; then
exit 1
fi
echo "Monitoring..."
result=$(timeout 5s espflash_app/espflash monitor --non-interactive || true)
echo "$result"
if ! echo "$result" | grep -q "Hello world!"; then
exit 1
fi