Skip to content

[WIP] Add support for commenting on upstream PRs #246

[WIP] Add support for commenting on upstream PRs

[WIP] Add support for commenting on upstream PRs #246

name: Ascend NPU Test Suite
on:
push:
branches:
- 'main'
paths:
- '.github/workflows/ascend_npu_test.yml'
- '.github/workflows/_ascend_npu_build.yml'
- '.github/workflows/_ascend_npu_ut.yml'
- '.github/workflows/_ascend_npu_benchmark.yml'
- '.github/actions/**'
- '.ci/**'
- 'ascend_npu/**'
- 'src/**'
- '!**/*.md'
pull_request:
branches:
- 'main'
paths:
- '.github/workflows/ascend_npu_test.yml'
- '.github/workflows/_ascend_npu_build.yml'
- '.github/workflows/_ascend_npu_ut.yml'
- '.github/workflows/_ascend_npu_benchmark.yml'
- '.github/actions/**'
- '.ci/**'
- 'ascend_npu/**'
- 'src/**'
- '!**/*.md'
release:
types:
- 'published'
schedule:
- cron: '0 12 * * *'
repository_dispatch:
types: [pytorch-pr-event-redispatch]
workflow_dispatch:
inputs:
runner:
required: true
type: choice
options:
- self-hosted
- npu-arm64
default: 'self-hosted'
description: 'The runner selected to run on'
image:
required: true
type: choice
options:
- 7.0.1.beta1-910b-ubuntu22.04-py3.8
- 8.0.rc1.beta1-910b-ubuntu22.04-py3.8
- 8.0.rc2.beta1-910b-ubuntu22.04-py3.9
- 8.0.rc3.beta1-910b-ubuntu22.04-py3.10
- ascendai/cann:latest
default: 'ascendai/cann:latest'
description: 'The docker image which will be loaded'
device:
required: true
type: choice
options:
- /dev/davinci1
- /dev/davinci2
- /dev/davinci3
- /dev/davinci4
- /dev/davinci5
- /dev/davinci6
- /dev/davinci7
- /dev/davinci8
default: '/dev/davinci5'
description: 'The device selected to run on'
# Only cancel the previous runs when triggered by a pull request
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'repository_dispatch' }}
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
runner: ${{ steps.set-param.outputs.runner }}
image: ${{ steps.set-param.outputs.image }}
device: ${{ steps.set-param.outputs.device }}
steps:
- name: Set param
id: set-param
run: |
set -e
echo "runner=${{ github.event.inputs.runner || 'self-hosted' }}" >> $GITHUB_OUTPUT
echo "device=${{ github.event.inputs.device || '/dev/davinci5' }}" >> $GITHUB_OUTPUT
echo "image=${{ github.event.inputs.image || 'ascendai/cann:latest' }}" >> $GITHUB_OUTPUT
build:
name: Build torch_npu
needs:
- prepare
uses: ./.github/workflows/_ascend_npu_build.yml
with:
runner: ${{ needs.prepare.outputs.runner }}
image: ${{ needs.prepare.outputs.image }}
test:
name: Test torch_npu
needs:
- prepare
- build
uses: ./.github/workflows/_ascend_npu_ut.yml
with:
runner: ${{ needs.prepare.outputs.runner }}
image: ${{ needs.prepare.outputs.image }}
device: ${{ needs.prepare.outputs.device }}
artifact_name: ${{ needs.build.outputs.artifact_name }}
benchmark:
name: Run benchmarks
needs:
- prepare
- build
- test
uses: ./.github/workflows/_ascend_npu_benchmark.yml
with:
runner: ${{ needs.prepare.outputs.runner }}
image: ${{ needs.prepare.outputs.image }}
device: ${{ needs.prepare.outputs.device }}
artifact_name: ${{ needs.build.outputs.artifact_name }}
secrets:
pr-token: ${{ secrets.COSDT_BOT_TOKEN }}
# TODO
pr-comment:
name: Comment report on upstream PRs
needs:
- benchmark
if: ${{ github.event_name == 'repository_dispatch' }}
uses: ./.github/workflows/_pytorch_pr_comment.yml
with:
repository: cosdt/pytorch-upstream
pr-number: 1
pr-comment-author: cosdt-bot
secrets:
pr-token: ${{ secrets.COSDT_BOT_TOKEN }}