Skip to content

Commit 0b20bcd

Browse files
committed
add: ci测试编译demo
1 parent 470ab31 commit 0b20bcd

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: test
2+
3+
on:
4+
push:
5+
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: environment prepare
14+
run: |
15+
cd ~
16+
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh -s 0.33.0
17+
~/bin/arduino-cli version
18+
~/bin/arduino-cli config init
19+
- name: install package
20+
run: |
21+
~/bin/arduino-cli core update-index --additional-urls https://github.com/Air-duino/Arduino-pack-json-ci/releases/download/Nightly/package_air_index.json
22+
~/bin/arduino-cli core install AirM2M:AirMCU@0.4.4 --additional-urls https://github.com/Air-duino/Arduino-pack-json-ci/releases/download/Nightly/package_air_index.json
23+
- name: replace package
24+
run: |
25+
rm -rf ~/.arduino15/packages/AirM2M/hardware/AirMCU/0.4.4/
26+
git submodule update --init --recursive
27+
cp -r /home/runner/work/action/Arduino-AirMCU ~/.arduino15/packages/AirM2M/hardware/AirMCU/0.4.4/
28+
- name: build
29+
run: |
30+
cd libraries
31+
python test.py
32+

libraries/test.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
3+
root = "/home/runner/work/action/Arduino-AirMCU/libraries/"
4+
5+
for dir in os.listdir(root):
6+
if not os.path.isdir(dir):
7+
continue
8+
ex_path = root+dir+"/examples/"
9+
if not os.path.exists(ex_path):
10+
continue
11+
for ex in os.listdir(ex_path):
12+
ex_repo_path = ex_path+ex+"/"
13+
if not os.path.isdir(ex_repo_path):
14+
continue
15+
print("found example: "+ex_repo_path)
16+
#编译
17+
os.system("/home/runner/bin/arduino-cli compile -b AirM2M:AirMCU:AirM2M_Air001_Board "+ex_repo_path)
18+

0 commit comments

Comments
 (0)