[devops] make build on PR run automatically (#3748)

* [devops] make build on PR run automatically

* [devops] update build on pr condition
pull/3729/head
Hongxin Liu 2023-05-17 11:17:37 +08:00 committed by GitHub
parent 1baeb39c72
commit c03bd7c6b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 6 deletions

View File

@ -43,7 +43,7 @@ I will provide the details of each workflow below.
| Workflow Name | File name | Description | | Workflow Name | File name | Description |
| ---------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Build on PR` | `build_on_pr.yml` | This workflow is triggered when the label `Run build and Test` is assigned to a PR. It will run all the unit tests in the repository with 4 GPUs. | | `Build on PR` | `build_on_pr.yml` | This workflow is triggered when a PR changes essential files. It will run all the unit tests in the repository with 4 GPUs. |
| `Build on Schedule` | `build_on_schedule.yml` | This workflow will run the unit tests everyday with 8 GPUs. The result is sent to Lark. | | `Build on Schedule` | `build_on_schedule.yml` | This workflow will run the unit tests everyday with 8 GPUs. The result is sent to Lark. |
| `Report test coverage` | `report_test_coverage.yml` | This PR will put up a comment to report the test coverage results when `Build` is done. | | `Report test coverage` | `report_test_coverage.yml` | This PR will put up a comment to report the test coverage results when `Build` is done. |

View File

@ -2,7 +2,18 @@ name: Build on PR
on: on:
pull_request: pull_request:
types: [synchronize, labeled] types: [synchronize, opened, reopened]
paths:
- '.github/workflows/build_on_pr.yml' # run command & env variables change
- 'colossalai/**' # source code change
- '!colossalai/**.md' # ignore doc change
- 'op_builder/**' # cuda extension change
- '!op_builder/**.md' # ignore doc change
- 'requirements/**' # requirements change
- 'tests/**' # test change
- '!tests/**.md' # ignore doc change
- 'pytest.ini' # test config change
- 'setup.py' # install command change
jobs: jobs:
detect: detect:
@ -10,8 +21,7 @@ jobs:
if: | if: |
github.event.pull_request.draft == false && github.event.pull_request.draft == false &&
github.base_ref == 'main' && github.base_ref == 'main' &&
github.event.pull_request.base.repo.full_name == 'hpcaitech/ColossalAI' && github.event.pull_request.base.repo.full_name == 'hpcaitech/ColossalAI'
contains( github.event.pull_request.labels.*.name, 'Run Build and Test')
outputs: outputs:
changedExtenisonFiles: ${{ steps.find-extension-change.outputs.all_changed_files }} changedExtenisonFiles: ${{ steps.find-extension-change.outputs.all_changed_files }}
anyExtensionFileChanged: ${{ steps.find-extension-change.outputs.any_changed }} anyExtensionFileChanged: ${{ steps.find-extension-change.outputs.any_changed }}
@ -66,6 +76,7 @@ jobs:
build: build:
name: Build and Test Colossal-AI name: Build and Test Colossal-AI
needs: detect needs: detect
if: needs.detect.outputs.anyLibraryFileChanged == 'true'
runs-on: [self-hosted, gpu] runs-on: [self-hosted, gpu]
container: container:
image: hpcaitech/pytorch-cuda:1.12.0-11.3.0 image: hpcaitech/pytorch-cuda:1.12.0-11.3.0
@ -110,7 +121,6 @@ jobs:
[ ! -z "$(ls -A /github/home/cuda_ext_cache/)" ] && cp -p -r /github/home/cuda_ext_cache/* /__w/ColossalAI/ColossalAI/ [ ! -z "$(ls -A /github/home/cuda_ext_cache/)" ] && cp -p -r /github/home/cuda_ext_cache/* /__w/ColossalAI/ColossalAI/
- name: Install Colossal-AI - name: Install Colossal-AI
if: needs.detect.outputs.anyLibraryFileChanged == 'true'
run: | run: |
CUDA_EXT=1 pip install -v -e . CUDA_EXT=1 pip install -v -e .
pip install -r requirements/requirements-test.txt pip install -r requirements/requirements-test.txt
@ -127,7 +137,6 @@ jobs:
fi fi
- name: Execute Unit Testing - name: Execute Unit Testing
if: needs.detect.outputs.anyLibraryFileChanged == 'true'
run: | run: |
CURL_CA_BUNDLE="" PYTHONPATH=$PWD pytest --testmon --testmon-cov=. tests/ CURL_CA_BUNDLE="" PYTHONPATH=$PWD pytest --testmon --testmon-cov=. tests/
env: env: