-
Notifications
You must be signed in to change notification settings - Fork 327
115 lines (105 loc) · 3.72 KB
/
ci_py3.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
name: CI Build PY3
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
ci-test:
runs-on: EasyRec-py3-15
defaults:
run:
shell: bash {0}
steps:
- name: FetchCommit ${{ github.event.pull_request.head.sha }}
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: RunCiTest
id: run_ci_test
env:
TEST_DEVICES: ""
PULL_REQUEST_NUM: ${{ github.event.pull_request.number }}
run: |
source activate tf15_py3
python git-lfs/git_lfs.py pull
source scripts/ci_test.sh
- name: LabelAndComment
env:
CI_TEST_PASSED: ${{steps.run_ci_test.outputs.ci_test_passed}}
uses: actions/github-script@v5
with:
script: |
const { CI_TEST_PASSED } = process.env
labels = await github.rest.issues.listLabelsOnIssue({
issue_number: context.issue.number,
repo:context.repo.repo,
owner:context.repo.owner
})
console.log('labels.url=' + labels.url)
labels = labels.data
var label_names = []
if (labels != null) {
labels.forEach(tmp_lbl => label_names.push(tmp_lbl.name))
}
console.log(`ci_test_passed=${CI_TEST_PASSED} labels=${label_names}`);
var pass_label = null;
if (labels != null) {
pass_label = labels.find(label=>label.name=='ci_py3_test_passed');
}
var fail_label = null;
if (labels != null) {
fail_label = labels.find(label=>label.name=='ci_py3_test_failed');
}
if (pass_label) {
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'ci_py3_test_passed'
})
}
if (fail_label) {
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'ci_py3_test_failed'
})
}
if (CI_TEST_PASSED == 1) {
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['ci_py3_test_passed']
})
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: "CI PY3 Test Passed"
})
} else {
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['ci_py3_test_failed']
})
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: "CI PY3 Test Failed"
})
}
- name: SignalFail
env:
CI_TEST_PASSED: ${{steps.run_ci_test.outputs.ci_test_passed}}
run: |
echo "CI_TEST_PASSED=${CI_TEST_PASSED}"
if [ $CI_TEST_PASSED -ne 1 ]
then
echo "ci_py3_test_failed, will exit"
exit 1
fi