|
| 1 | +name: Test windows on the comment |
| 2 | + |
| 3 | +on: |
| 4 | + issue_comment: |
| 5 | + types: [created] |
| 6 | + |
| 7 | +jobs: |
| 8 | + windows_test_preparation: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + if: ${{ github.event.issue.pull_request && github.event.comment.body == '/start Windows testing' }} |
| 11 | + steps: |
| 12 | + - name: react_to_comment |
| 13 | + uses: actions/github-script@v4 |
| 14 | + with: |
| 15 | + script: | |
| 16 | + const {owner, repo} = context.issue; |
| 17 | + github.reactions.createForIssueComment({ |
| 18 | + owner, |
| 19 | + repo, |
| 20 | + comment_id: context.payload.comment.id, |
| 21 | + content: "rocket", |
| 22 | + }); |
| 23 | + - name: get_pr_sha |
| 24 | + id: sha |
| 25 | + uses: actions/github-script@v4 |
| 26 | + with: |
| 27 | + result-encoding: string |
| 28 | + script: | |
| 29 | + const { owner, repo, number } = context.issue; |
| 30 | + const pr = await github.pulls.get({ |
| 31 | + owner, |
| 32 | + repo, |
| 33 | + pull_number: number, |
| 34 | + }); |
| 35 | + return pr.data.head.sha |
| 36 | + - name: update_pr_status_pending |
| 37 | + run: | |
| 38 | + gh api --method POST -H "Accept: application/vnd.github+json" /repos/$OWNER/$REPO/statuses/$SHA -f state='pending' -f target_url='${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' -f description='The build started2!' -f context='Windows pre-commit' |
| 39 | + echo "REF == = = = = = = ${{ steps.sha.outputs.result }}" |
| 40 | + env: |
| 41 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 42 | + OWNER: ${{ github.repository_owner }} |
| 43 | + REPO: ${{ github.event.repository.name }} |
| 44 | + SHA: ${{ steps.sha.outputs.result }} |
| 45 | + outputs: |
| 46 | + PR_SHA: ${{ steps.sha.outputs.result }} |
| 47 | + |
| 48 | + |
| 49 | + windows_default: |
| 50 | + name: Windows |
| 51 | + needs: [windows_test_preparation] |
| 52 | + if: github.repository == 'intel/llvm' |
| 53 | + uses: ./.github/workflows/sycl_windows_build_and_test.yml |
| 54 | + with: |
| 55 | + build_ref: ${{ needs.windows_test_preparation.outputs.PR_SHA }} |
| 56 | + |
| 57 | + windows_test_completion: |
| 58 | + runs-on: ubuntu-latest |
| 59 | + needs: [windows_default] |
| 60 | + steps: |
| 61 | + - name: update_pr_status_success |
| 62 | + if: always() && success() |
| 63 | + run: | |
| 64 | + gh api --method POST -H "Accept: application/vnd.github+json" /repos/$OWNER/$REPO/statuses/$SHA -f state='success' -f target_url='${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' -f description='The build started2!' -f context='Windows pre-commit' |
| 65 | + env: |
| 66 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 67 | + OWNER: ${{ github.repository_owner }} |
| 68 | + REPO: ${{ github.event.repository.name }} |
| 69 | + SHA: ${{ steps.sha.outputs.result }} |
| 70 | + - name: update_pr_status_failure |
| 71 | + if: failure() |
| 72 | + run: | |
| 73 | + gh api --method POST -H "Accept: application/vnd.github+json" /repos/$OWNER/$REPO/statuses/$SHA -f state='failure' -f target_url='${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' -f description='The build started2!' -f context='Windows pre-commit' |
| 74 | + env: |
| 75 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 76 | + OWNER: ${{ github.repository_owner }} |
| 77 | + REPO: ${{ github.event.repository.name }} |
| 78 | + SHA: ${{ steps.sha.outputs.result }} |
| 79 | + |
| 80 | + # windows_default: |
| 81 | + # runs-on: ubuntu-latest |
| 82 | + # needs: [windows_test_preparation] |
| 83 | + # steps: |
| 84 | + # - name: print_ref |
| 85 | + # run: | |
| 86 | + # echo "REF == = = = = = = ${{github.ref}}" |
| 87 | + # echo "REF == = = = = = = ${{ needs.windows_test_preparation.outputs.PR_SHA }}" |
0 commit comments