-
Notifications
You must be signed in to change notification settings - Fork 130
157 lines (129 loc) · 4.64 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
name: Build and Run Integration tests
on:
pull_request:
branches:
- main
push:
workflow_dispatch:
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-app:
name: Generate and Build App
strategy:
matrix:
board:
- mcu: esp32
target: xtensa-esp32-none-elf
- mcu: esp32c3
target: riscv32imc-unknown-none-elf
- mcu: esp32c6
target: riscv32imac-unknown-none-elf
- mcu: esp32h2
target: riscv32imac-unknown-none-elf
- mcu: esp32s2
target: xtensa-esp32s2-none-elf
- mcu: esp32s3
target: xtensa-esp32s3-none-elf
fail-fast: false
runs-on: ubuntu-22.04
steps:
- if: matrix.board.mcu == 'esp32' || matrix.board.mcu == 'esp32s2' || matrix.board.mcu == 'esp32s3'
uses: esp-rs/[email protected]
with:
default: true
buildtargets: ${{ matrix.board.mcu }}
ldproxy: false
- if: matrix.board.mcu != 'esp32' && matrix.board.mcu != 'esp32s2' && matrix.board.mcu != 'esp32s3'
uses: dtolnay/rust-toolchain@nightly
with:
target: ${{ matrix.board.target }}
components: rust-src
- uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v4
with:
repository: esp-rs/esp-hal
path: esp-hal
- run: cargo build --release --example hello_world
working-directory: esp-hal/${{ matrix.board.mcu }}-hal
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.board.mcu }}_app
path: esp-hal/${{ matrix.board.mcu }}-hal/target/${{ matrix.board.target }}/release/examples/hello_world
if-no-files-found: error
build-espflash:
name: Build espflash
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- 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@v3
with:
name: espflash
path: target/release/espflash
if-no-files-found: error
run-target:
name: Run Tests on Target
if: ${{ github.repository_owner == 'esp-rs' }}
needs: [build-app, build-espflash]
runs-on: [self-hosted, linux, x64, "${{ matrix.board }}" ]
strategy:
matrix:
board: [esp32, esp32c3, esp32c6, esp32h2, esp32s2, esp32s3]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: ${{ matrix.board }}_app
path: espflash/${{ matrix.board }}_app
- uses: actions/download-artifact@v3
with:
name: espflash
path: espflash_app
shell: 'script -q -e -c "bash {0}"'
- run: chmod +x espflash_app/espflash
- name: Flash test
env:
ESPFLASH_PORT: /dev/serial_ports/${{ matrix.board }}
ESPFLASH_APP: espflash/${{ matrix.board }}_app/hello_world
shell: 'script -q -e -c "bash {0}"'
run: |
timeout 20s espflash_app/espflash flash --monitor ${{ env.ESPFLASH_APP }} 2>&1
ret=$?
if [[ $ret -eq 124 ]]; then
ret=0
fi
exit $ret
# - name: Pull docker image
# run: docker pull ubuntu:20.04
# - name: Run docker container
# id: docker-run
# run: |
# result=$(docker run -dti --rm --privileged ubuntu:20.04)
# echo "container-id=$(echo $result)" >> $GITHUB_OUTPUT
# - name: Copy espflash
# run: docker cp espflash_app/espflash ${{ steps.docker-run.outputs.container-id }}:/espflash
# - name: Copy target
# run: docker cp espflash/${{ matrix.board }}_app/hello_world ${{ steps.docker-run.outputs.container-id }}:/hello_world
# - name: Allow to execute espflash
# run: docker exec -i ${{ steps.docker-run.outputs.container-id }} bash -c "chmod +x espflash"
# - name: Monitor test
# if: ${{ matrix.board != 'esp32c3' }}
# continue-on-error: true
# run: docker exec -i ${{ steps.docker-run.outputs.container-id }} bash -c "timeout 20s ./espflash monitor --port /dev/ttyUSB0 2>&1"
# - name: Stop docker container
# run: docker stop ${{ steps.docker-run.outputs.container-id }}