Skip to content

Commit 6044076

Browse files
authored
Merge pull request #171 from wangnuannuan/jingru-modify-action
action: add action to build examples
2 parents ed742d6 + 19bf624 commit 6044076

File tree

2 files changed

+148
-6
lines changed

2 files changed

+148
-6
lines changed

.github/workflows/examples-build.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: Examples Build
2+
3+
env:
4+
GIT_AUTHOR_NAME: svc-arcoss_auto arc
5+
GIT_COMMITTER_NAME: svc-arcoss_auto arc
6+
GIT_AUTHOR_EMAIL: svc-arcoss_auto@synopsys.com
7+
GIT_COMMITTER_EMAIL: svc-arcoss_auto@synopsys.com
8+
TOOLCHAIN: gnu
9+
TOOLCHAIN_VER: 2020.09
10+
on:
11+
push:
12+
branches:
13+
- master
14+
15+
jobs:
16+
example-build-on-emsk-11:
17+
name: "Build examples on emsk version 11"
18+
runs-on: ubuntu-latest
19+
env:
20+
BOARD: emsk
21+
BD_VER: 11
22+
23+
steps:
24+
- name: checkout
25+
uses: actions/checkout@v2
26+
27+
- name: install-dependencies
28+
run: |
29+
bash ./scripts/.ci/before_install.sh
30+
31+
- name: build
32+
run: |
33+
bash ./scripts/.ci/script.sh
34+
35+
example-build-on-emsk-22:
36+
name: "Build examples on emsk version 22"
37+
runs-on: ubuntu-latest
38+
env:
39+
BOARD: emsk
40+
BD_VER: 22
41+
42+
steps:
43+
- name: checkout
44+
uses: actions/checkout@v2
45+
46+
- name: install-dependencies
47+
run: |
48+
bash ./scripts/.ci/before_install.sh
49+
50+
- name: build
51+
run: |
52+
bash ./scripts/.ci/script.sh
53+
54+
example-build-on-emsk-23:
55+
name: "Build examples on emsk version 23"
56+
runs-on: ubuntu-latest
57+
env:
58+
BOARD: emsk
59+
BD_VER: 23
60+
61+
steps:
62+
- name: checkout
63+
uses: actions/checkout@v2
64+
65+
- name: install-dependencies
66+
run: |
67+
bash ./scripts/.ci/before_install.sh
68+
69+
- name: build
70+
run: |
71+
bash ./scripts/.ci/script.sh
72+
73+
example-build-on-hsdk:
74+
name: "Build examples on hsdk"
75+
runs-on: ubuntu-latest
76+
env:
77+
BOARD: hsdk
78+
79+
steps:
80+
- name: checkout
81+
uses: actions/checkout@v2
82+
83+
- name: install-dependencies
84+
run: |
85+
bash ./scripts/.ci/before_install.sh
86+
87+
- name: build
88+
run: |
89+
bash ./scripts/.ci/script.sh
90+
91+
example-build-on-iotdk:
92+
name: "Build examples on iotdk"
93+
runs-on: ubuntu-latest
94+
env:
95+
BOARD: iotdk
96+
97+
steps:
98+
- name: checkout
99+
uses: actions/checkout@v2
100+
101+
- name: install-dependencies
102+
run: |
103+
bash ./scripts/.ci/before_install.sh
104+
105+
- name: build
106+
run: |
107+
bash ./scripts/.ci/script.sh
108+
109+
example-build-on-emsdp:
110+
name: "Build examples on emsdp"
111+
runs-on: ubuntu-latest
112+
env:
113+
BOARD: emsdp
114+
115+
steps:
116+
- name: checkout
117+
uses: actions/checkout@v2
118+
119+
- name: install-dependencies
120+
run: |
121+
bash ./scripts/.ci/before_install.sh
122+
123+
- name: build
124+
run: |
125+
bash ./scripts/.ci/script.sh
126+
127+
example-build-on-nsim:
128+
name: "Build examples on nsim"
129+
runs-on: ubuntu-latest
130+
env:
131+
BOARD: nsim
132+
133+
steps:
134+
- name: checkout
135+
uses: actions/checkout@v2
136+
137+
- name: install-dependencies
138+
run: |
139+
bash ./scripts/.ci/before_install.sh
140+
141+
- name: build
142+
run: |
143+
bash ./scripts/.ci/script.sh

scripts/.ci/script.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ prepare_env() {
1717

1818
TOOLCHAIN_CACHE_FOLDER=".cache/toolchain"
1919

20-
[ "${TRAVIS}" == "true" ] && {
20+
[ "${TRAVIS}" == "true" || "${GITHUB_ACTIONS}" == "true" ] && {
2121
if [ "${TOOLCHAIN}" == "gnu" ] ; then
2222
python scripts/.ci/toolchain.py -v $TOOLCHAIN_VER -c $TOOLCHAIN_CACHE_FOLDER || die
2323
if [ -d $TOOLCHAIN_CACHE_FOLDER ] ; then
@@ -60,11 +60,10 @@ parse_logs() {
6060
# get rid of MAC \r and change it to UNIX \n
6161
sed -i 's/\r/\n/g' $test_log
6262

63-
METRICS=$(cat $test_log | grep "test configurations passed" | sed -n 's/^.*-\(.*\)*$/\1/p')
64-
COMMENT="$BOARD ${BD_VER:-} test results: $METRICS. [Details](https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID)"
65-
66-
curl --user "$EMBARC_BOT" --request POST https://api.github.com/repos/$TRAVIS_REPO_SLUG/commits/$TRAVIS_COMMIT/comments \
67-
--data '{"body":"'"${COMMENT}"'"}'
63+
METRICS=$(cat $test_log | grep "test configurations passed" | sed -n 's/^.* \([0-9]\+\) of.*, \([0-9]\+\).*failed, \([0-9]\+\).*in \([0-9]\+\).*$/\1 \2 \3 \4/p')
64+
if ! ([ ${#METRICS[@]} -eq 4 ] && [ ${METRICS[1]} == "0" ]); then
65+
exit 1
66+
fi
6867
}
6968

7069
main() {

0 commit comments

Comments
 (0)