colossalai

Форк
0
/
doc_test_on_pr.yml 
102 строки · 3.5 Кб
1
name: Test Documentation on PR
2
on:
3
  pull_request:
4
    branches:
5
      - "main"
6
      - "develop"
7
      - "feature/**"
8
    # any change in the examples folder will trigger check for the corresponding example.
9
    paths:
10
      - "docs/source/**.md"
11

12
jobs:
13
  # This is for changed example files detect and output a matrix containing all the corresponding directory name.
14
  detect-changed-doc:
15
    if: |
16
      github.event.pull_request.draft == false &&
17
      github.event.pull_request.base.repo.full_name == 'hpcaitech/ColossalAI' && github.event_name == 'pull_request'
18
    runs-on: ubuntu-latest
19
    outputs:
20
      any_changed: ${{ steps.changed-files.outputs.any_changed }}
21
      changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
22
    concurrency:
23
      group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-detect-change
24
      cancel-in-progress: true
25
    name: Detect changed example files
26
    steps:
27
      - uses: actions/checkout@v3
28
        with:
29
          fetch-depth: 0
30
          ref: ${{ github.event.pull_request.head.sha }}
31

32
      - name: Locate base commit
33
        id: locate-base-sha
34
        run: |
35
          curBranch=$(git rev-parse --abbrev-ref HEAD)
36
          commonCommit=$(git merge-base origin/main $curBranch)
37
          echo $commonCommit
38
          echo "baseSHA=$commonCommit" >> $GITHUB_OUTPUT
39

40
      - name: Get all changed example files
41
        id: changed-files
42
        uses: tj-actions/changed-files@v35
43
        with:
44
          base_sha: ${{ steps.locate-base-sha.outputs.baseSHA }}
45
          files: |
46
            ./docs/source/**/*.md
47

48
  # If no file is changed, it will prompt an error and shows the matrix do not have value.
49
  check-changed-doc:
50
    # Add this condition to avoid executing this job if the trigger event is workflow_dispatch.
51
    if: |
52
      github.event.pull_request.draft == false &&
53
      github.event.pull_request.base.repo.full_name == 'hpcaitech/ColossalAI' && github.event_name == 'pull_request' &&
54
      needs.detect-changed-doc.outputs.any_changed == 'true'
55
    name: Test the changed Doc
56
    needs: detect-changed-doc
57
    runs-on: [self-hosted, gpu]
58
    container:
59
      image: hpcaitech/pytorch-cuda:2.0.0-11.7.0
60
      options: --gpus all --rm
61
    timeout-minutes: 20
62
    defaults:
63
      run:
64
        shell: bash
65
    concurrency:
66
      group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-run-doctest
67
      cancel-in-progress: true
68
    steps:
69
      - name: Checkout ColossalAI-Documentation
70
        uses: actions/checkout@v2
71
        with:
72
          path: "./ColossalAI-Documentation"
73
          repository: "hpcaitech/ColossalAI-Documentation"
74

75
      - name: Install Docer
76
        run: |
77
          pip install -v ./ColossalAI-Documentation/doc-build/third_party/hf-doc-builder
78
          pip install -v ./ColossalAI-Documentation/doc-build
79

80
      - name: Checkout ColossalAI
81
        uses: actions/checkout@v3
82

83
      - name: Install Doc Test Requirements
84
        run: |
85
          source activate pytorch
86
          conda env update --file docs/conda-doc-test-deps.yml --prune
87
          pip install -r docs/requirements-doc-test.txt
88

89
      - name: Install ColossalAI
90
        run: |
91
          source activate pytorch
92
          BUILD_EXT=1 pip install -v .
93

94
      - name: Test the Doc
95
        run: |
96
          source activate pytorch
97
          for file in ${{ needs.detect-changed-doc.outputs.changed_files }}; do
98
            echo "Testing $file now..."
99
            docer test -p $file
100
          done
101
        env:
102
          NCCL_SHM_DISABLE: 1
103

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.