colossalai
102 строки · 3.5 Кб
1name: Test Documentation on PR
2on:
3pull_request:
4branches:
5- "main"
6- "develop"
7- "feature/**"
8# any change in the examples folder will trigger check for the corresponding example.
9paths:
10- "docs/source/**.md"
11
12jobs:
13# This is for changed example files detect and output a matrix containing all the corresponding directory name.
14detect-changed-doc:
15if: |
16github.event.pull_request.draft == false &&
17github.event.pull_request.base.repo.full_name == 'hpcaitech/ColossalAI' && github.event_name == 'pull_request'
18runs-on: ubuntu-latest
19outputs:
20any_changed: ${{ steps.changed-files.outputs.any_changed }}
21changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
22concurrency:
23group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-detect-change
24cancel-in-progress: true
25name: Detect changed example files
26steps:
27- uses: actions/checkout@v3
28with:
29fetch-depth: 0
30ref: ${{ github.event.pull_request.head.sha }}
31
32- name: Locate base commit
33id: locate-base-sha
34run: |
35curBranch=$(git rev-parse --abbrev-ref HEAD)
36commonCommit=$(git merge-base origin/main $curBranch)
37echo $commonCommit
38echo "baseSHA=$commonCommit" >> $GITHUB_OUTPUT
39
40- name: Get all changed example files
41id: changed-files
42uses: tj-actions/changed-files@v35
43with:
44base_sha: ${{ steps.locate-base-sha.outputs.baseSHA }}
45files: |
46./docs/source/**/*.md
47
48# If no file is changed, it will prompt an error and shows the matrix do not have value.
49check-changed-doc:
50# Add this condition to avoid executing this job if the trigger event is workflow_dispatch.
51if: |
52github.event.pull_request.draft == false &&
53github.event.pull_request.base.repo.full_name == 'hpcaitech/ColossalAI' && github.event_name == 'pull_request' &&
54needs.detect-changed-doc.outputs.any_changed == 'true'
55name: Test the changed Doc
56needs: detect-changed-doc
57runs-on: [self-hosted, gpu]
58container:
59image: hpcaitech/pytorch-cuda:2.0.0-11.7.0
60options: --gpus all --rm
61timeout-minutes: 20
62defaults:
63run:
64shell: bash
65concurrency:
66group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-run-doctest
67cancel-in-progress: true
68steps:
69- name: Checkout ColossalAI-Documentation
70uses: actions/checkout@v2
71with:
72path: "./ColossalAI-Documentation"
73repository: "hpcaitech/ColossalAI-Documentation"
74
75- name: Install Docer
76run: |
77pip install -v ./ColossalAI-Documentation/doc-build/third_party/hf-doc-builder
78pip install -v ./ColossalAI-Documentation/doc-build
79
80- name: Checkout ColossalAI
81uses: actions/checkout@v3
82
83- name: Install Doc Test Requirements
84run: |
85source activate pytorch
86conda env update --file docs/conda-doc-test-deps.yml --prune
87pip install -r docs/requirements-doc-test.txt
88
89- name: Install ColossalAI
90run: |
91source activate pytorch
92BUILD_EXT=1 pip install -v .
93
94- name: Test the Doc
95run: |
96source activate pytorch
97for file in ${{ needs.detect-changed-doc.outputs.changed_files }}; do
98echo "Testing $file now..."
99docer test -p $file
100done
101env:
102NCCL_SHM_DISABLE: 1
103