32
32
runs-on : ubuntu-20.04
33
33
steps :
34
34
- uses : actions/checkout@v4
35
- if : github.event_name != 'workflow_dispatch'
36
-
37
- - uses : actions/checkout@v4
38
- if : github.event_name == 'workflow_dispatch'
39
35
with :
40
- repository : ${{ github.event.inputs.repository }}
41
- ref : ${{ github.event.inputs.branch }}
36
+ repository : ${{ github.event.inputs.repository || github.repository }}
37
+ ref : ${{ github.event.inputs.branch || github.ref }}
42
38
43
39
- uses : ./.github/actions/setup-target
44
40
with :
57
53
58
54
run-target :
59
55
name : ${{ matrix.board.mcu }}${{ matrix.board.freq }}
60
- if : ${{ github.repository_owner == 'esp-rs' }}
56
+ if : github.repository_owner == 'esp-rs'
61
57
needs : build-espflash
62
- runs-on :
63
- [
64
- self-hosted,
65
- linux,
66
- x64,
67
- " ${{ matrix.board.mcu }}${{ matrix.board.freq }}" ,
68
- ]
58
+ runs-on : [self-hosted, linux, x64, "${{ matrix.board.mcu }}${{ matrix.board.freq }}"]
69
59
strategy :
70
60
matrix :
71
61
board :
@@ -79,88 +69,47 @@ jobs:
79
69
- mcu : esp32s2
80
70
- mcu : esp32s3
81
71
fail-fast : false
72
+ env :
73
+ ESPFLASH_PORT : /dev/serial_ports/${{ matrix.board.mcu }}
74
+ ESPFLASH_APP : espflash/tests/data/${{ matrix.board.mcu }}
82
75
steps :
83
76
- uses : actions/checkout@v4
77
+
84
78
- uses : actions/download-artifact@v4
85
79
with :
86
80
name : espflash
87
81
path : espflash_app
88
82
89
- - run : chmod +x espflash_app/espflash
83
+ - name : Set up espflash binary
84
+ run : |
85
+ chmod +x espflash_app/espflash
86
+ echo "$PWD/espflash_app" >> "$GITHUB_PATH"
90
87
91
88
- name : board-info test
92
- env :
93
- ESPFLASH_PORT : /dev/serial_ports/${{ matrix.board.mcu }}
94
- shell : bash
95
- run : |
96
- result=$(espflash_app/espflash board-info)
97
- echo "$result"
98
- if [[ $? -ne 0 || ! "$result" =~ "esp32" ]]; then
99
- exit 1
100
- fi
89
+ run : bash espflash/tests/scripts/board-info.sh
101
90
102
91
- name : flash test
103
- env :
104
- ESPFLASH_PORT : /dev/serial_ports/${{ matrix.board.mcu }}
105
- ESPFLASH_APP : espflash/tests/data/${{ matrix.board.mcu }}
106
- shell : bash
107
- run : |
108
- result=$(espflash_app/espflash flash --no-skip ${{ env.ESPFLASH_APP }} 2>&1)
109
- echo "$result"
110
- if [[ ! $result =~ "Flashing has completed!" ]]; then
111
- exit 1
112
- fi
92
+ run : bash espflash/tests/scripts/flash.sh ${{ env.ESPFLASH_APP }}
113
93
114
94
- name : monitor test
115
- env :
116
- ESPFLASH_PORT : /dev/serial_ports/${{ matrix.board.mcu }}
117
- shell : bash
118
- run : |
119
- result=$(timeout 5s espflash_app/espflash monitor --non-interactive || true)
120
- echo "$result"
121
- if ! echo "$result" | grep -q "Hello world!"; then
122
- exit 1
123
- fi
124
-
125
- - name : erase/read flash test
126
- env :
127
- ESPFLASH_PORT : /dev/serial_ports/${{ matrix.board.mcu }}
128
- run : |
129
- result=$(espflash_app/espflash erase-flash 2>&1)
130
- echo "$result"
131
- if [[ ! $result =~ "Flash has been erased!" ]]; then
132
- exit 1
133
- fi
134
- result=$(espflash_app/espflash read-flash 0 0x200 flash_content.bin 2>&1)
135
- echo "$result"
136
- if [[ ! $result =~ "Flash content successfully read and written to" ]]; then
137
- exit 1
138
- fi
139
- echo "Checking if flash is empty"
140
- if hexdump -v -e '/1 "%02x"' "flash_content.bin" | grep -qv '^ff*$'; then
141
- exit 1
142
- fi
143
- echo "Flash is empty!"
95
+ run : bash espflash/tests/scripts/monitor.sh
96
+
97
+ - name : erase-flash test
98
+ run : bash espflash/tests/scripts/erase-flash.sh
144
99
145
100
- name : save-image/write-bin test
146
- env :
147
- ESPFLASH_PORT : /dev/serial_ports/${{ matrix.board.mcu }}
148
- ESPFLASH_APP : espflash/tests/data/${{ matrix.board.mcu }}
149
101
run : |
150
- result=$(espflash_app/espflash save-image --merge --chip ${{ matrix.board.mcu }} ${{ matrix.board.flag }} ${{ env.ESPFLASH_APP }} app.bin 2>&1)
151
- echo "$result"
152
- if [[ ! $result =~ "Image successfully saved!" ]]; then
153
- exit 1
154
- fi
155
- echo "Writting binary"
156
- result=$(espflash_app/espflash write-bin 0x0 app.bin 2>&1)
157
- echo "$result"
158
- if [[ ! $result =~ "Binary successfully written to flash!" ]]; then
159
- exit 1
160
- fi
161
- echo "Monitoring..."
162
- result=$(timeout 5s espflash_app/espflash monitor --non-interactive || true)
163
- echo "$result"
164
- if ! echo "$result" | grep -q "Hello world!"; then
165
- exit 1
166
- fi
102
+ bash espflash/tests/scripts/save-image_write-bin.sh ${{ matrix.board.mcu }} ${{ env.ESPFLASH_APP }}
103
+ bash espflash/tests/scripts/monitor.sh
104
+
105
+ - name : erase-region test
106
+ run : bash espflash/tests/scripts/erase-region.sh
107
+
108
+ - name : hold-in-reset test
109
+ run : bash espflash/tests/scripts/hold-in-reset.sh
110
+
111
+ - name : reset test
112
+ run : bash espflash/tests/scripts/reset.sh
113
+
114
+ - name : checksum-md5 test
115
+ run : bash espflash/tests/scripts/checksum-md5.sh
0 commit comments