mirror of https://github.com/hpcaitech/ColossalAI
[CI] Fix pre-commit workflow (#3238)
parent
280fcdc485
commit
1653063fce
|
@ -8,4 +8,4 @@ contact_links:
|
||||||
about: This issue tracker is not for technical support. Please use WeChat, and ask the community for help.
|
about: This issue tracker is not for technical support. Please use WeChat, and ask the community for help.
|
||||||
- name: 😊 Advanced question - GitHub Discussions
|
- name: 😊 Advanced question - GitHub Discussions
|
||||||
url: https://github.com/hpcaitech/ColossalAI/discussions
|
url: https://github.com/hpcaitech/ColossalAI/discussions
|
||||||
about: Use GitHub Discussions for advanced and unanswered technical questions, requiring a maintainer's answer.
|
about: Use GitHub Discussions for advanced and unanswered technical questions, requiring a maintainer's answer.
|
||||||
|
|
|
@ -22,7 +22,7 @@ body:
|
||||||
If applicable, add screenshots to help explain your problem.
|
If applicable, add screenshots to help explain your problem.
|
||||||
**Suggest a potential alternative/fix**
|
**Suggest a potential alternative/fix**
|
||||||
Tell us how we could improve this project.
|
Tell us how we could improve this project.
|
||||||
**Optional: Affiliation**
|
**Optional: Affiliation**
|
||||||
Institution/email information helps better analyze and evaluate users to improve the project. Welcome to establish in-depth cooperation.
|
Institution/email information helps better analyze and evaluate users to improve the project. Welcome to establish in-depth cooperation.
|
||||||
placeholder: |
|
placeholder: |
|
||||||
A clear and concise description of your idea.
|
A clear and concise description of your idea.
|
||||||
|
|
|
@ -71,7 +71,7 @@ jobs:
|
||||||
|
|
||||||
- name: Checkout ColossalAI
|
- name: Checkout ColossalAI
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install Doc Test Requirements
|
- name: Install Doc Test Requirements
|
||||||
run: |
|
run: |
|
||||||
source activate pytorch
|
source activate pytorch
|
||||||
|
|
|
@ -82,7 +82,7 @@ jobs:
|
||||||
|
|
||||||
# create pull request
|
# create pull request
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
if: steps.commit.outputs.status == 'success'
|
if: steps.commit.outcome == 'success'
|
||||||
id: cpr
|
id: cpr
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v4
|
||||||
with:
|
with:
|
||||||
|
@ -90,7 +90,7 @@ jobs:
|
||||||
title: "[format] applied code formatting on changed files in PR ${{ github.event.pull_request.number }}"
|
title: "[format] applied code formatting on changed files in PR ${{ github.event.pull_request.number }}"
|
||||||
|
|
||||||
- name: Enable Auto-merge for the New PR
|
- name: Enable Auto-merge for the New PR
|
||||||
if: steps.commit.outputs.status == 'success'
|
if: steps.commit.outcome == 'success'
|
||||||
uses: peter-evans/enable-pull-request-automerge@v2
|
uses: peter-evans/enable-pull-request-automerge@v2
|
||||||
with:
|
with:
|
||||||
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
|
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
def check_inputs(input_list):
|
def check_inputs(input_list):
|
||||||
for path in input_list:
|
for path in input_list:
|
||||||
real_path = os.path.join('examples', path)
|
real_path = os.path.join('examples', path)
|
||||||
if not os.path.exists(real_path):
|
if not os.path.exists(real_path):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-f', '--fileNameList', type=str, help="List of file names")
|
parser.add_argument('-f', '--fileNameList', type=str, help="List of file names")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
name_list = args.fileNameList.split(",")
|
name_list = args.fileNameList.split(",")
|
||||||
is_correct = check_inputs(name_list)
|
is_correct = check_inputs(name_list)
|
||||||
|
|
||||||
if is_correct:
|
if is_correct:
|
||||||
print('success')
|
print('success')
|
||||||
else:
|
else:
|
||||||
print('failure')
|
print('failure')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,37 +1,37 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
def show_files(path, all_files):
|
def show_files(path, all_files):
|
||||||
# Traverse all the folder/file in current directory
|
# Traverse all the folder/file in current directory
|
||||||
file_list = os.listdir(path)
|
file_list = os.listdir(path)
|
||||||
# Determine the element is folder or file. If file, pass it into list, if folder, recurse.
|
# Determine the element is folder or file. If file, pass it into list, if folder, recurse.
|
||||||
for file_name in file_list:
|
for file_name in file_list:
|
||||||
# Get the abs directory using os.path.join() and store into cur_path.
|
# Get the abs directory using os.path.join() and store into cur_path.
|
||||||
cur_path = os.path.join(path, file_name)
|
cur_path = os.path.join(path, file_name)
|
||||||
# Determine whether folder
|
# Determine whether folder
|
||||||
if os.path.isdir(cur_path):
|
if os.path.isdir(cur_path):
|
||||||
show_files(cur_path, all_files)
|
show_files(cur_path, all_files)
|
||||||
else:
|
else:
|
||||||
all_files.append(cur_path)
|
all_files.append(cur_path)
|
||||||
return all_files
|
return all_files
|
||||||
|
|
||||||
|
|
||||||
def join(input_list, sep=None):
|
def join(input_list, sep=None):
|
||||||
return (sep or ' ').join(input_list)
|
return (sep or ' ').join(input_list)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
contents = show_files('examples/', [])
|
contents = show_files('examples/', [])
|
||||||
all_loc = []
|
all_loc = []
|
||||||
for file_loc in contents:
|
for file_loc in contents:
|
||||||
split_loc = file_loc.split('/')
|
split_loc = file_loc.split('/')
|
||||||
# must have two sub-folder levels after examples folder, such as examples/images/vit is acceptable, examples/images/README.md is not, examples/requirements.txt is not.
|
# must have two sub-folder levels after examples folder, such as examples/images/vit is acceptable, examples/images/README.md is not, examples/requirements.txt is not.
|
||||||
if len(split_loc) >= 4:
|
if len(split_loc) >= 4:
|
||||||
re_loc = '/'.join(split_loc[1:3])
|
re_loc = '/'.join(split_loc[1:3])
|
||||||
if re_loc not in all_loc:
|
if re_loc not in all_loc:
|
||||||
all_loc.append(re_loc)
|
all_loc.append(re_loc)
|
||||||
print(all_loc)
|
print(all_loc)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-f', '--fileNameList', type=str, help="The list of changed files")
|
parser.add_argument('-f', '--fileNameList', type=str, help="The list of changed files")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
name_list = args.fileNameList.split(":")
|
name_list = args.fileNameList.split(":")
|
||||||
folder_need_check = set()
|
folder_need_check = set()
|
||||||
for loc in name_list:
|
for loc in name_list:
|
||||||
# Find only the sub-sub-folder of 'example' folder
|
# Find only the sub-sub-folder of 'example' folder
|
||||||
# the examples folder structure is like
|
# the examples folder structure is like
|
||||||
# - examples
|
# - examples
|
||||||
# - area
|
# - area
|
||||||
# - application
|
# - application
|
||||||
# - file
|
# - file
|
||||||
if loc.split("/")[0] == "examples" and len(loc.split("/")) >= 4:
|
if loc.split("/")[0] == "examples" and len(loc.split("/")) >= 4:
|
||||||
folder_need_check.add('/'.join(loc.split("/")[1:3]))
|
folder_need_check.add('/'.join(loc.split("/")[1:3]))
|
||||||
# Output the result using print. Then the shell can get the values.
|
# Output the result using print. Then the shell can get the values.
|
||||||
print(list(folder_need_check))
|
print(list(folder_need_check))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue