-
Notifications
You must be signed in to change notification settings - Fork 44
200 lines (185 loc) · 7.8 KB
/
auto-integration.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: integration-request
on: #[push]
pull_request_target:
paths:
- "integration.yml"
types: [ opened, synchronize ]
concurrency:
group: ${{ github.workflow }}-pull/${{ github.event.number }}
cancel-in-progress: true
env:
TOPIC: test-integration-pr-${{ github.event.number }}
OSCPASS: ${{ secrets.OSCPASS }}
jobs:
parsec_integration:
uses: deepin-community/Repository-Integration/.github/workflows/01-parsec-integration.yml@master
ouput_message:
name: output integration
needs: parsec_integration
if: ${{ github.event.pull_request.head.sha }}
uses: deepin-community/Repository-Integration/.github/workflows/02-integration-output.yml@master
build_project_prepare:
name: build project prepare
runs-on: ubuntu-latest
outputs:
issueid: ${{ steps.find-comments.outputs.issueid }}
projectItemID: ${{ steps.find-comments.outputs.projectItemID }}
steps:
- name: obs integration topic project prepare
run: |
set +e
set -x
result=$(curl -u golf66:$OSCPASS "https://build.deepin.com/source/deepin:CI:TestingIntegration:$TOPIC/_meta"|grep "unknown_project")
if [ "$result" != "" ];then
curl -o meta.xml https://raw.githubusercontent.com/deepin-community/Repository-Integration/master/.github/workflows/obs-proj-meta.tpl
sed -i "s#TOPIC#${TOPIC}#g" meta.xml
curl -X PUT -u golf66:$OSCPASS -H "Content-type: text/xml" -d @meta.xml "https://build.deepin.com/source/deepin:CI:TestingIntegration:$TOPIC/_meta"
fi
- name: find comments
id: find-comments
uses: actions/github-script@v6
with:
script: |
let issueid = 'undefined'
let projectItemID = 'undefined'
const BOT_NAME = "IntegrationProjector Bot"
const COMMENT_HEAD = "**" + BOT_NAME + "**\n"
if ( context.issue.number != undefined ) {
const response = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
})
const reg = new RegExp("\\*+" + BOT_NAME + "\\*+")
botComment = response.data.find(comment => comment.body.match(reg))
if (botComment) {
// get issue id
comments = botComment.body.split("\n")
core.debug(botComment)
// console.log(comments.length)
if (comments.length > 3) {
id = comments[2].replace("IssueID: ", "")
const res = await github.rest.issues.get({
owner: "linuxdeepin",
repo: "developer-center",
issue_number: id
})
if (res.data.state != "closed") {
issueid = id
projectItemID = comments[3].replace("ProjectItemID: ", "")
}
}
}
}
console.log('issueid: ', issueid, 'projectItemID: ', projectItemID)
core.setOutput('issueid', issueid)
core.setOutput('projectItemID', projectItemID)
create_issue_link_project:
name: create issue and link project
needs:
- parsec_integration
- ouput_message
- build_project_prepare
- build_main
- build_dde
- build_community
if: |
always() && !cancelled() &&
(needs.parsec_integration.result == 'success') && (needs.ouput_message.result != 'failure' ) &&
(needs.build_main.result == 'success' || needs.build_main.result == 'skipped') &&
(needs.build_dde.result == 'success' || needs.build_dde.result == 'skipped') &&
(needs.build_community.result == 'success' || needs.build_community.result == 'skipped')
uses: deepin-community/Repository-Integration/.github/workflows/issue-project-manager.yml@master
secrets: inherit
with:
repo: linuxdeepin/developer-center
issueid: ${{ needs.build_project_prepare.outputs.issueid }} #for test 3961
project: 21 # https://github.com/orgs/linuxdeepin/projects/21/views/1
assignees: "Zeno-sole, hudeng-go"
title: "[Deepin Integration]~[${{ needs.parsec_integration.outputs.milestone }}] ${{ needs.parsec_integration.outputs.integration_message }}"
status: "In progress"
milestone: ${{ needs.parsec_integration.outputs.milestone }}
labels: ${{ needs.parsec_integration.outputs.labels }}
integrationinfo: ${{ needs.parsec_integration.outputs.integrationinfo }}
changelog: ${{ needs.parsec_integration.outputs.changelog }}
influence: ${{ needs.parsec_integration.outputs.influence }}
testrepoaddr: ${{ needs.parsec_integration.outputs.testrepoaddr }}
pass_integration:
name: pass integration
needs:
- parsec_integration
- ouput_message
- build_project_prepare
- create_issue_link_project
uses: deepin-community/Repository-Integration/.github/workflows/04-auto-test.yml@master
if: |
always() && !cancelled() &&
(needs.create_issue_link_project.result == 'success')
with:
topic: test-integration-pr-${{ github.event.number }}
packages: ${{ needs.parsec_integration.outputs.all_build_task }}
deploy: ${{ needs.parsec_integration.outputs.deploy }}
# merge finished and success, closing this pr
close-pull-request:
name: close this pull request
needs:
- parsec_integration
- pass_integration
if: |
always() && !cancelled() &&
(needs.pass_integration.result == 'success')
uses: deepin-community/Repository-Integration/.github/workflows/06-deployed.yml@master
secrets: inherit
with:
integrations: ${{ needs.parsec_integration.outputs.all_build_task }}
# build task
build_main:
name: build_main
if: always() && !cancelled() && (needs.parsec_integration.outputs.build_matrix_main != '') && (needs.parsec_integration.result == 'success')
needs:
- parsec_integration
- build_project_prepare
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.parsec_integration.outputs.build_matrix_main) }}
uses: deepin-community/Repository-Integration/.github/workflows/02-build-obs.yml@master
secrets: inherit
with:
repo: ${{ matrix.payload.repo }}
tag: ${{ matrix.payload.tag }}
tagsha: ${{ matrix.payload.tagsha }}
topic: test-integration-pr-${{ github.event.number }}
build_dde:
name: build_dde
if: always() && !cancelled() && (needs.parsec_integration.outputs.build_matrix_dde != '') && (needs.parsec_integration.result == 'success')
needs:
- parsec_integration
- build_project_prepare
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.parsec_integration.outputs.build_matrix_dde) }}
uses: deepin-community/Repository-Integration/.github/workflows/02-build-obs.yml@master
secrets: inherit
with:
repo: ${{ matrix.payload.repo }}
tag: ${{ matrix.payload.tag }}
tagsha: ${{ matrix.payload.tagsha }}
topic: test-integration-pr-${{ github.event.number }}
component: "dde"
build_community:
name: build_community
if: always() && !cancelled() && (needs.parsec_integration.outputs.build_matrix_community != '') && (needs.parsec_integration.result == 'success')
needs:
- parsec_integration
- build_project_prepare
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.parsec_integration.outputs.build_matrix_community) }}
uses: deepin-community/Repository-Integration/.github/workflows/02-build-obs.yml@master
secrets: inherit
with:
repo: ${{ matrix.payload.repo }}
tag: ${{ matrix.payload.tag }}
tagsha: ${{ matrix.payload.tagsha }}
topic: test-integration-pr-${{ github.event.number }}
component: "community"