-
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (81 loc) · 2.97 KB
/
rocm-ci.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
on:
repository_dispatch:
types: [rocm-ci]
env:
SOURCE_REPO_OWNER: 'cupy'
SOURCE_REPO_NAME: 'test-repo-dispatch' # XXX
jobs:
test:
runs-on: ubuntu-latest # XXX
env:
RUN_URL: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
steps:
- name: Generate Token (Pending)
id: generate-token-pre
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.GH_APP_SELF_HOSTED_CI_ID }}
private-key: ${{ secrets.GH_APP_SELF_HOSTED_CI_PEM }}
owner: ${{ env.SOURCE_REPO_OWNER }}
repositories: ${{ env.SOURCE_REPO_NAME }}
- name: 'Update Commit Status (Pending)'
uses: actions/github-script@v7
with:
github-token: ${{ steps.generate-token-pre.outputs.token }}
script: |
github.rest.repos.createCommitStatus({
owner: process.env.SOURCE_REPO_OWNER,
repo: process.env.SOURCE_REPO_NAME,
sha: context.payload.client_payload.sha,
state: 'pending',
target_url: process.env.RUN_URL,
description: 'In progress',
context: context.payload.action,
})
- name: 'Checkout'
uses: actions/checkout@v4
with:
repository: ${{ env.SOURCE_REPO_OWNER }}/${{ env.SOURCE_REPO_NAME }}
ref: ${{ github.event.client_payload.sha }}
submodules: recursive
- run: sleep 300
# Regenerate the token as the installation token expires in an hour.
- name: Generate Token (Success/Failure)
if: ${{ always() }}
id: generate-token-post
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.GH_APP_SELF_HOSTED_CI_ID }}
private-key: ${{ secrets.GH_APP_SELF_HOSTED_CI_PEM }}
owner: ${{ env.SOURCE_REPO_OWNER }}
repositories: ${{ env.SOURCE_REPO_NAME }}
- name: 'Update Commit Status (Success)'
uses: actions/github-script@v7
if: ${{ success() }}
with:
github-token: ${{ steps.generate-token-post.outputs.token }}
script: |
github.rest.repos.createCommitStatus({
owner: process.env.SOURCE_REPO_OWNER,
repo: process.env.SOURCE_REPO_NAME,
sha: context.payload.client_payload.sha,
state: 'success',
target_url: process.env.RUN_URL,
description: 'Successful',
context: context.payload.action,
})
- name: 'Update Commit Status (Failure)'
uses: actions/github-script@v7
if: ${{ !success() }}
with:
github-token: ${{ steps.generate-token-post.outputs.token }}
script: |
github.rest.repos.createCommitStatus({
owner: process.env.SOURCE_REPO_OWNER,
repo: process.env.SOURCE_REPO_NAME,
sha: context.payload.client_payload.sha,
state: 'failure',
target_url: process.env.RUN_URL,
description: 'Failed',
context: context.payload.action,
})