From c03bd7c6b25d29e3ecfa8b0d231be8a25e1bbc23 Mon Sep 17 00:00:00 2001 From: Hongxin Liu Date: Wed, 17 May 2023 11:17:37 +0800 Subject: [PATCH] [devops] make build on PR run automatically (#3748) * [devops] make build on PR run automatically * [devops] update build on pr condition --- .github/workflows/README.md | 2 +- .github/workflows/build_on_pr.yml | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index a46d8b1c2..8fc14e0d5 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -43,7 +43,7 @@ I will provide the details of each workflow below. | 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. | | `Report test coverage` | `report_test_coverage.yml` | This PR will put up a comment to report the test coverage results when `Build` is done. | diff --git a/.github/workflows/build_on_pr.yml b/.github/workflows/build_on_pr.yml index 7419b59ca..a9e50e231 100644 --- a/.github/workflows/build_on_pr.yml +++ b/.github/workflows/build_on_pr.yml @@ -2,7 +2,18 @@ name: Build on PR on: 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: detect: @@ -10,8 +21,7 @@ jobs: if: | github.event.pull_request.draft == false && github.base_ref == 'main' && - github.event.pull_request.base.repo.full_name == 'hpcaitech/ColossalAI' && - contains( github.event.pull_request.labels.*.name, 'Run Build and Test') + github.event.pull_request.base.repo.full_name == 'hpcaitech/ColossalAI' outputs: changedExtenisonFiles: ${{ steps.find-extension-change.outputs.all_changed_files }} anyExtensionFileChanged: ${{ steps.find-extension-change.outputs.any_changed }} @@ -66,6 +76,7 @@ jobs: build: name: Build and Test Colossal-AI needs: detect + if: needs.detect.outputs.anyLibraryFileChanged == 'true' runs-on: [self-hosted, gpu] container: 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/ - name: Install Colossal-AI - if: needs.detect.outputs.anyLibraryFileChanged == 'true' run: | CUDA_EXT=1 pip install -v -e . pip install -r requirements/requirements-test.txt @@ -127,7 +137,6 @@ jobs: fi - name: Execute Unit Testing - if: needs.detect.outputs.anyLibraryFileChanged == 'true' run: | CURL_CA_BUNDLE="" PYTHONPATH=$PWD pytest --testmon --testmon-cov=. tests/ env: