rocm-6-2 #4
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: Self-Hosted CI | |
on: | |
repository_dispatch: | |
env: | |
SOURCE_REPO_OWNER: 'cupy' | |
SOURCE_REPO_NAME: 'cupy' | |
jobs: | |
test: | |
runs-on: pg01-rocm | |
env: | |
RUN_URL: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' | |
steps: | |
- name: Information | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
core.info(`Triggered by: ${ context.payload.client_payload.url }`); | |
- name: Generate Token (Pre) | |
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 (Pre) | |
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.head_sha, | |
state: 'pending', | |
description: 'In progress', | |
target_url: process.env.RUN_URL, | |
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.merge_commit_sha || github.event.client_payload.head_sha }} | |
submodules: recursive | |
- name: Test | |
id: test | |
run: | | |
./.pfnci/linux/run.sh "${{ github.event.action }}" build test | |
# Regenerate the token as the installation token expires in an hour. | |
- name: Generate Token (Post) | |
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 (Post) | |
uses: actions/github-script@v7 | |
if: ${{ always() }} | |
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.head_sha, | |
state: "${{ steps.test.outcome == 'success' && 'success' || 'failure' }}", | |
description: "${{ steps.test.outcome == 'success' && 'Successful' || 'Failed' }}", | |
target_url: process.env.RUN_URL, | |
context: context.payload.action, | |
}) |