auto integration linuxdeepin/dde-control-center #870
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |