Skip to content

rocm-6-2

rocm-6-2 #6

Workflow file for this run

name: Self-Hosted CI
on:
workflow_dispatch:
inputs:
ref:
required: true
default: 'main'
action:
required: true
default: 'rocm-6-2'
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 }}'
RUN_TRIGGER: ${{
github.event_name == 'workflow_dispatch' && 'manual workflow dispatch' ||
github.event.payload.client_payload.url
}}
RUN_ACTION: ${{
github.event_name == 'workflow_dispatch' && inputs.action ||
github.event.action
}}
SOURCE_STATUS_REF: ${{
github.event_name == 'workflow_dispatch' && '' ||
github.event.client_payload.head_sha
}}
SOURCE_CHECKOUT_REF: ${{
github.event_name == 'workflow_dispatch' && inputs.ref ||
( github.event.client_payload.merge_commit_sha || github.event.client_payload.head_sha )
}}
steps:
- name: Information
uses: actions/github-script@v7
with:
script: |
core.info(`Triggered by: ${ process.env.RUN_TRIGGER }`);
- name: Generate Token (Pre)
id: generate-token-pre
if: ${{ env.SOURCE_STATUS_REF != '' }}
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)
if: ${{ env.SOURCE_STATUS_REF != '' }}
uses: actions/github-script@v7
with:
github-token: ${{ steps.generate-token-pre.outputs.token }}
script: |
await github.rest.repos.createCommitStatus({
owner: process.env.SOURCE_REPO_OWNER,
repo: process.env.SOURCE_REPO_NAME,
sha: process.env.SOURCE_STATUS_REF,
state: 'pending',
description: 'In progress',
target_url: process.env.RUN_URL,
context: process.env.RUN_ACTION,
})
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ env.SOURCE_REPO_OWNER }}/${{ env.SOURCE_REPO_NAME }}
ref: ${{ env.SOURCE_CHECKOUT_REF }}
submodules: recursive
- name: Test
id: test
run: |
./.pfnci/linux/run.sh "${{ env.RUN_ACTION }}" build test
# Regenerate the token as the installation token expires in an hour.
- name: Generate Token (Post)
if: ${{ always() && env.SOURCE_STATUS_REF != '' }}
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() && env.SOURCE_STATUS_REF != '' }}
with:
github-token: ${{ steps.generate-token-post.outputs.token }}
script: |
await github.rest.repos.createCommitStatus({
owner: process.env.SOURCE_REPO_OWNER,
repo: process.env.SOURCE_REPO_NAME,
sha: process.env.SOURCE_STATUS_REF,
state: "${{ steps.test.outcome == 'success' && 'success' || 'failure' }}",
description: "${{ steps.test.outcome == 'success' && 'Successful' || 'Failed' }}",
target_url: process.env.RUN_URL,
context: process.env.RUN_ACTION,
})