diff --git a/.github/workflows/02-build-obs.yml b/.github/workflows/02-build-obs.yml index feef5bb9f..b194e43f8 100644 --- a/.github/workflows/02-build-obs.yml +++ b/.github/workflows/02-build-obs.yml @@ -161,85 +161,3 @@ jobs: fi echo "needbuild=$needbuild" >> $GITHUB_OUTPUT - - log: - needs: build - strategy: - matrix: - arch: [aarch64, x86_64] - - runs-on: ubuntu-latest - env: - ARCH: ${{ matrix.arch }} - steps: - - name: Set commit status as pending - if: ${{ needs.build.outputs.needbuild }} == "true" - uses: myrotvorets/set-commit-status-action@master - with: - token: ${{ github.token }} - status: pending - context: "${{ needs.build.outputs.pkgname }}_${{ matrix.arch }}_testing_repository_building" - targetUrl: "${{ needs.build.outputs.targeturl }}${{ matrix.arch }}" - sha: ${{ github.event.pull_request.head.sha }} - - - name: Wait for build to succeed - uses: cloudposse/github-action-wait-commit-status@main - id: wait-for-build - with: - repository: ${{ github.repository }} - sha: ${{ github.event.pull_request.head.sha }} - status: "${{ needs.build.outputs.pkgname }}_${{ matrix.arch }}_testing_repository_building" - expected_state: "success" - token: ${{ github.token }} - check-retry-interval: 60 - check-retry-count: 60 - - - name: Do something with a build time out - if: steps.wait-for-build.outputs.conclusion == 'timed_out' - id: wait_time_out - run: | - set -x - sudo apt-get update && sudo apt install -y osc - mkdir -p ~/.config/osc - echo "${{ secrets.OSCRC }}" > ~/.config/osc/oscrc - pkgname="${{ needs.build.outputs.pkgname }}" - if [ "$COMPONENT" = "main" ]; then - osc co deepin:CI:TestingIntegration:${TOPIC}/${pkgname} && cd $_ - else - osc co deepin:CI:TestingIntegration:${TOPIC}:${COMPONENT}/${pkgname} && cd $_ - fi - - timeouturl="${{ needs.build.outputs.targeturl }}${{ matrix.arch }}" - description="wait build complete timeout" - status="pending" - buildresult=$(osc results -a ${ARCH} -r testing |awk '{print $3}') - if [ "$buildresult" = "succeeded" ];then - status="success" - description="" - elif [ "$buildresult" = "excluded" ]; then - status="success" - description="build excluded" - timeouturl="" - elif [ "$buildresult" = "failed" ]; then - status="failure" - description="" - fi - echo "timeouturl=$timeouturl" >> $GITHUB_OUTPUT - echo "description=$description" >> $GITHUB_OUTPUT - echo "status=$status" >> $GITHUB_OUTPUT - - - name: Update status build status as timeout - if: steps.wait-for-build.outputs.conclusion == 'timed_out' - uses: myrotvorets/set-commit-status-action@master - with: - token: ${{ github.token }} - status: ${{ steps.wait_time_out.outputs.status }} - context: "${{ needs.build.outputs.pkgname }}_${{ matrix.arch }}_testing_repository_building" - targetUrl: ${{ steps.wait_time_out.outputs.timeouturl }} - sha: ${{ github.event.pull_request.head.sha }} - description: ${{ steps.wait_time_out.outputs.description }} - - #- name: report build error at action - # if: steps.wait_time_out.outputs.status != 'success' || steps.wait-for-build.outputs.conclusion == 'failure' - # run: | - # exit -1 diff --git a/.github/workflows/auto-integration.yml b/.github/workflows/auto-integration.yml index 0781c60f1..3bc832cb9 100644 --- a/.github/workflows/auto-integration.yml +++ b/.github/workflows/auto-integration.yml @@ -84,6 +84,61 @@ jobs: core.setOutput('issueid', issueid) core.setOutput('projectItemID', projectItemID) + wait_build_pending_status: + name: wait build pending status + runs-on: ubuntu-latest + 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') + steps: + - name: wait build pending status + uses: actions/github-script@v6 + with: + script: | + let retryCount = 30; + let attemptCount = 0; + + function sleep(time){ + return new Promise((resolve) => setTimeout(resolve, time)); + } + + if ( context.issue.number != undefined ) { + while (true) { + const { data: statuses } = await github.rest.repos.listCommitStatusesForRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: "${{ github.event.pull_request.head.sha }}", + }) + + buildStatuses = statuses.filter((status) => status.context.includes("testing_repository_building")); + const successStatuses = buildStatuses.filter((status) => status.state === "success"); + if (successStatuses.length == buildStatuses.length) { + console.log(`All build commit statuses is now a success.`); + break; + } + + if (attemptCount >= retryCount) { + core.setFailed(`Exceeded maximum retry count. Exiting...`); + break; + } + + attemptCount++; + + console.log(`Waiting for commit statuses to become a success...`); + await sleep(60000) + } + } + create_issue_link_project: name: create issue and link project needs: @@ -93,12 +148,14 @@ jobs: - build_main - build_dde - build_community + - wait_build_pending_status 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') + (needs.build_community.result == 'success' || needs.build_community.result == 'skipped') && + needs.wait_build_pending_status != 'failure' uses: deepin-community/Repository-Integration/.github/workflows/issue-project-manager.yml@master secrets: inherit with: