Unverified Commit 0af79383 authored by Frank Lee's avatar Frank Lee Committed by GitHub
Browse files

[workflow] fixed changed file detection (#2515)

parent a6a10616
...@@ -25,9 +25,21 @@ jobs: ...@@ -25,9 +25,21 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
- name: Locate base commit
id: locate-base-sha
run: |
curBranch=$(git rev-parse --abbrev-ref HEAD)
commonCommit=$(git merge-base origin/main $curBranch)
echo $commonCommit
echo "baseSHA=$commonCommit" >> $GITHUB_OUTPUT
- name: Get all changed example files - name: Get all changed example files
id: changed-files id: changed-files
uses: tj-actions/changed-files@v35 uses: tj-actions/changed-files@v35
with:
base_sha: ${{ steps.locate-base-sha.outputs.baseSHA }}
- name: setup matrix - name: setup matrix
id: setup-matrix id: setup-matrix
run: | run: |
...@@ -67,9 +79,11 @@ jobs: ...@@ -67,9 +79,11 @@ jobs:
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Colossal-AI - name: Install Colossal-AI
run: | run: |
pip install -v . pip install -v .
- name: Test the example - name: Test the example
run: | run: |
example_dir=${{ matrix.directory }} example_dir=${{ matrix.directory }}
...@@ -90,6 +104,7 @@ jobs: ...@@ -90,6 +104,7 @@ jobs:
steps: steps:
- name: 📚 Checkout - name: 📚 Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: setup matrix - name: setup matrix
id: setup-matrix id: setup-matrix
run: | run: |
...@@ -113,9 +128,11 @@ jobs: ...@@ -113,9 +128,11 @@ jobs:
steps: steps:
- name: 📚 Checkout - name: 📚 Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Install Colossal-AI - name: Install Colossal-AI
run: | run: |
pip install -v . pip install -v .
- name: Traverse all files - name: Traverse all files
run: | run: |
example_dir=${{ matrix.diretory }} example_dir=${{ matrix.diretory }}
......
...@@ -21,14 +21,25 @@ jobs: ...@@ -21,14 +21,25 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
- name: Locate base commit
id: locate-base-sha
run: |
curBranch=$(git rev-parse --abbrev-ref HEAD)
commonCommit=$(git merge-base origin/main $curBranch)
echo $commonCommit
echo "baseSHA=$commonCommit" >> $GITHUB_OUTPUT
- name: Find the changed files - name: Find the changed files
id: find-changed-files id: find-changed-files
uses: tj-actions/changed-files@v35 uses: tj-actions/changed-files@v35
with: with:
base_sha: ${{ steps.locate-base-sha.outputs.baseSHA }}
files: | files: |
op_builder/** op_builder/**
colossalai/kernel/** colossalai/kernel/**
setup.py setup.py
- name: List changed files - name: List changed files
run: | run: |
for file in ${{ steps.find-changed-files.outputs.all_changed_files }}; do for file in ${{ steps.find-changed-files.outputs.all_changed_files }}; do
......
...@@ -12,9 +12,23 @@ jobs: ...@@ -12,9 +12,23 @@ jobs:
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
# the PR branch and the hpcaitech/colossal-ai main branch
# must share a common commit, we need to locate that commit,
# which is the commit checked-out or forked when the PR branch is created
# such that we can look for files changed since that commit
- name: Locate base commit
id: locate-base-sha
run: |
curBranch=$(git rev-parse --abbrev-ref HEAD)
commonCommit=$(git merge-base origin/main $curBranch)
echo $commonCommit
echo "baseSHA=$commonCommit" >> $GITHUB_OUTPUT
- name: Find the changed files - name: Find the changed files
id: find-changed-files id: find-changed-files
uses: tj-actions/changed-files@v35 uses: tj-actions/changed-files@v35
with:
base_sha: ${{ steps.locate-base-sha.outputs.baseSHA }}
- name: List all changed files - name: List all changed files
run: | run: |
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment