Skip to content

[Nightly] Refactor test workflows #7245

[Nightly] Refactor test workflows

[Nightly] Refactor test workflows #7245

Workflow file for this run

name: pull
on:
pull_request:
types:
- opened
- synchronize
- reopened
- converted_to_draft
- ready_for_review
- labeled
branches:
- main
- release/*
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
preci-lint-check:
if: ${{ github.repository_owner == 'intel' }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout torch-xpu-ops
uses: actions/checkout@v4
with:
path: torch-xpu-ops
- name: Run lint check
run: |
export ADDITIONAL_LINTRUNNER_ARGS="--skip CLANGTIDY,CLANGFORMAT,MERGE_CONFLICTLESS_CSV --all-files"
cd ./torch-xpu-ops
bash .github/scripts/lintrunner.sh
- name: Run lint check with Clang
run: |
sudo apt update && sudo apt install -y libomp-dev
rm -rf pytorch
git clone https://github.com/pytorch/pytorch pytorch
cd pytorch && cp -r ../torch-xpu-ops third_party/
export ADDITIONAL_LINTRUNNER_ARGS="--take CLANGTIDY,CLANGFORMAT \
build/xpu/**/*.* \
build/xpu/*.* \
third_party/torch-xpu-ops/src/*.* \
third_party/torch-xpu-ops/src/**/*.* \
third_party/torch-xpu-ops/src/**/**/*.* \
third_party/torch-xpu-ops/src/**/**/**/*.*"
export CLANG=1
bash third_party/torch-xpu-ops/.github/scripts/lintrunner.sh
conditions-filter:
if: ${{ github.event.pull_request.draft == false }}
needs: [preci-lint-check]
runs-on: ubuntu-latest
timeout-minutes: 10
env:
GH_TOKEN: ${{ github.token }}
outputs:
src_changed: ${{ steps.check-files.outputs.src_changed }}
has_label: ${{ steps.check-label.outputs.has_label }}
disabled_tests: ${{ steps.check-pr-desc.outputs.disabled_tests }}
steps:
- uses: dorny/paths-filter@v2
id: check-files
with:
filters: |
src_changed:
- 'cmake/**'
- 'tools/**'
- 'src/**.cmake'
- 'CMakeLists.txt'
- 'test/sycl/CMakeLists.txt'
- 'src/xccl/CMakeLists.txt'
- 'src/ATen/CMakeLists.txt'
- 'src/CMakeLists.txt'
- '.github/workflows/_windows_ut.yml'
- name: Check Label
id: check-label
run: |
echo "has_label=${{ contains(github.event.pull_request.labels.*.name, 'windows_ci') }}" >> $GITHUB_OUTPUT
- name: Check PR infos
id: check-pr-desc
run: |
set -x -e -o pipefail
sudo apt update && sudo apt install -y dos2unix
gh --repo ${GITHUB_REPOSITORY} pr view ${{ github.event.pull_request.number }} 2>&1 |tee pr-info.txt
dos2unix pr-info.txt
disabled_tests="$(awk '/disable_/{printf("%s ", $0)}' pr-info.txt)"
echo "disabled_tests=${disabled_tests}" |tee "${GITHUB_OUTPUT}"
linux-build:
if: ${{ !contains(needs.conditions-filter.outputs.disabled_tests, 'disable_all')}}
needs: [conditions-filter]
secrets: inherit
uses: ./.github/workflows/_linux_build.yml
with:
runner: pvc_rolling
test_type: build-cicd
pytorch: main
torch_xpu_ops: cicd
linux-ut:
needs: [conditions-filter, linux-build]
uses: ./.github/workflows/_linux_ut.yml
with:
runner: linux.idc.xpu
test_type: build-cicd-ut
pytorch: main
torch_xpu_ops: cicd
ut: ut_regression,ut_transformers,ut_extended,ut_op,xpu_dev1,xpu_distributed
disabled_tests: ${{ needs.conditions-filter.outputs.disabled_tests }}
linux-e2e:
name: linux-e2e
if: ${{ !contains(needs.conditions-filter.outputs.disabled_tests, 'disable_e2e') }}
needs: [conditions-filter, linux-build]
strategy:
fail-fast: false
matrix:
suite: [huggingface, timm_models, torchbench]
uses: ./.github/workflows/_linux_e2e.yml
with:
runner: pvc_rolling
test_type: build-cicd-e2e
pytorch: main
suite: ${{ matrix.suite }}
linux-e2e-summary:
if: ${{ ! cancelled() }}
name: linux-e2e
permissions: write-all
needs: [linux-e2e]
uses: ./.github/workflows/_linux_e2e_summary.yml
with:
test_type: build-cicd-e2e
windows:
name: windows
if: ${{ !(contains(needs.conditions-filter.outputs.disabled_tests, 'disable_all') || contains(needs.conditions-filter.outputs.disabled_tests, 'disable_win')) }}
needs: [conditions-filter]
uses: ./.github/workflows/_windows_ut.yml
with:
ut: ut_extended,ut_torch
runner: Windows_CI
src_changed: ${{ needs.conditions-filter.outputs.src_changed }}
has_label: ${{ needs.conditions-filter.outputs.has_label }}