rocm-ci #13
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
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, | |
}) |