Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
数据应用
arduino-esp32
提交
e360c2ee
A
arduino-esp32
项目概览
数据应用
/
arduino-esp32
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
arduino-esp32
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
e360c2ee
编写于
4月 18, 2023
作者:
J
Jan Procházka
提交者:
GitHub
4月 18, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CI] Added New Board Test (#8071)
* Add check if fqbn is empty
上级
fa9e0590
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
151 addition
and
0 deletion
+151
-0
.github/scripts/find_new_boards.sh
.github/scripts/find_new_boards.sh
+90
-0
.github/workflows/boards.yml
.github/workflows/boards.yml
+61
-0
未找到文件。
.github/scripts/find_new_boards.sh
0 → 100755
浏览文件 @
e360c2ee
#!/bin/bash
# Get inputs from command
owner_repository
=
$1
pr_number
=
$2
url
=
"https://api.github.com/repos/
$owner_repository
/pulls/
$pr_number
/files"
echo
$url
# Get changes in boards.txt file from PR
Patch
=
$(
curl
$url
| jq
-r
'.[] | select(.filename == "boards.txt") | .patch '
)
# Extract only changed lines number and count
substring_patch
=
$(
echo
"
$Patch
"
|
grep
-o
'@@[^@]*@@'
)
params_array
=()
IFS
=
$'
\n
'
read
-d
''
-ra
params
<<<
$(
echo
"
$substring_patch
"
|
grep
-oE
'[-+][0-9]+,[0-9]+'
)
for
param
in
"
${
params
[@]
}
"
do
echo
"The parameter is
$param
"
params_array+
=(
"
$param
"
)
done
boards_array
=()
previous_board
=
""
file
=
"boards.txt"
# Loop through boards.txt file and extract all boards that were added
for
((
c
=
0
;
c<
${#
params_array
[@]
}
;
c+
=
2
))
do
deletion_count
=
$(
echo
"
${
params_array
[c]
}
"
|
cut
-d
','
-f2
|
cut
-d
' '
-f1
)
addition_line
=
$(
echo
"
${
params_array
[c+1]
}
"
|
cut
-d
'+'
-f2
|
cut
-d
','
-f1
)
addition_count
=
$(
echo
"
${
params_array
[c+1]
}
"
|
cut
-d
'+'
-f2
|
cut
-d
','
-f2
|
cut
-d
' '
-f1
)
addition_end
=
$((
$addition_line
+
$addition_count
))
addition_line
=
$((
$addition_line
+
3
))
addition_end
=
$((
$addition_end
-
$deletion_count
))
echo
$addition_line
echo
$addition_end
i
=
0
while
read
-r
line
do
i
=
$((
i+1
))
if
[
$i
-lt
$addition_line
]
then
continue
elif
[
$i
-gt
$addition_end
]
then
break
fi
board_name
=
$(
echo
"
$line
"
|
cut
-d
'.'
-f1
|
cut
-d
'#'
-f1
)
if
[
"
$board_name
"
!=
""
]
then
if
[
"
$board_name
"
!=
"
$previous_board
"
]
then
boards_array+
=(
"espressif:esp32:
$board_name
"
)
previous_board
=
"
$board_name
"
echo
"Added 'espressif:esp32:
$board_name
' to array"
fi
fi
done
<
"
$file
"
done
# Create JSON like string with all boards found and pass it to env variable
board_count
=
${#
boards_array
[@]
}
if
[
$board_count
-gt
0
]
then
json_matrix
=
'{"fqbn": ['
for
board
in
${
boards_array
[@]
}
do
json_matrix+
=
'"'
$board
'"'
if
[
$board_count
-gt
1
]
then
json_matrix+
=
","
fi
board_count
=
$((
$board_count
-
1
))
done
json_matrix+
=
']}'
echo
$json_matrix
echo
"FQBNS=
${
json_matrix
}
"
>>
$GITHUB_ENV
else
echo
"FQBNS=''"
>>
$GITHUB_ENV
fi
\ No newline at end of file
.github/workflows/boards.yml
0 → 100644
浏览文件 @
e360c2ee
name
:
New Board Test
# The workflow will run on schedule and labeled pull requests
on
:
pull_request
:
env
:
# It's convenient to set variables for values used multiple times in the workflow
GITHUB_TOKEN
:
${{secrets.GITHUB_TOKEN}}
jobs
:
find-boards
:
runs-on
:
ubuntu-latest
outputs
:
fqbns
:
${{ env.FQBNS }}
steps
:
# This step makes the contents of the repository available to the workflow
-
name
:
Checkout repository
uses
:
actions/checkout@v3
-
name
:
Setup jq
uses
:
dcarbone/install-jq-action@v1.0.1
-
name
:
Get board name
run
:
bash .github/scripts/find_new_boards.sh ${{ github.repository }} ${{github.event.number}}
test-boards
:
needs
:
find-boards
runs-on
:
ubuntu-latest
if
:
${{ needs.changes.outputs.services != '' }}
env
:
REPOSITORY
:
|
- source-path: '.'
name: "espressif:esp32"
strategy
:
matrix
:
${{ fromJson(needs.find-boards.outputs.fqbns) }}
steps
:
# This step makes the contents of the repository available to the workflow
-
name
:
Checkout repository
uses
:
actions/checkout@v3
-
name
:
Compile sketch
uses
:
P-R-O-C-H-Y/compile-sketches@main
with
:
platforms
:
|
${{ env.REPOSITORY }}
fqbn
:
${{ matrix.fqbn }}
use-json-file
:
false
enable-deltas-report
:
false
enable-warnings-report
:
false
cli-compile-flags
:
|
- --warnings="all"
exit-on-fail
:
true
sketch-paths
:
"
-
./libraries/ESP32/examples/ChipID/GetChipID/GetChipID.ino"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录