Merge pull request #2 from alibaba/gitflow

add citest workflow
pull/6/head
Cathy0908 2022-04-06 15:44:33 +08:00 committed by GitHub
commit cdaaa352e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 132 additions and 0 deletions

54
.github/hooks/pre-commit vendored 100755
View File

@ -0,0 +1,54 @@
#!/usr/bin/env bash
# File generated by pre-commit: https://pre-commit.com
# ID: 138fd403232d2ddd5efb44317e38bf03
# check ak leak
echo "Check for sensitive information leak:"
projectUrl=`git config --get remote.origin.url`
user=`git config --get user.name`
user_email=`git config --get user.email`
STAGE_FILES=$(git diff --cached --name-only)
stage_files=(${STAGE_FILES/ // })
keywords=("LTAI[a-zA-Z0-9]{20}" "LTAI[a-zA-Z0-9]{12}" "acs:ram::[0-9]{16}:role/")
result=0
for i in "${!stage_files[@]}"; do
if [ ! -e "${stage_files[i]}" ]
then
continue
fi
for index in "${!keywords[@]}"; do
grep -E -q ${keywords[index]} ${stage_files[i]}
if [ $? -eq 0 ]
then
echo "Check Failed, ${stage_files[i]} contain sensitive info: pattern=${keywords[index]}, details: "
grep -E ${keywords[index]} ${stage_files[i]}
result=1
break
fi
done
done
if [ $result -eq 0 ];then
echo "Sensitive Information Leak Check Passed."
else
echo "Sensitive Information Leak Check Failed"
exit 1
fi
# start templated
INSTALL_PYTHON=python
ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=pre-commit)
# end templated
HERE="$(cd "$(dirname "$0")" && pwd)"
ARGS+=(--hook-dir "$HERE" -- "$@")
if [ -x "$INSTALL_PYTHON" ]; then
exec "$INSTALL_PYTHON" -mpre_commit "${ARGS[@]}"
elif command -v pre-commit > /dev/null; then
exec pre-commit "${ARGS[@]}"
else
echo '`pre-commit` not found. Did you forget to activate your virtualenv?' 1>&2
exit 1
fi

55
.github/workflows/citest.yaml vendored 100644
View File

@ -0,0 +1,55 @@
name: citest
on:
push:
branches:
- master
- "release/**"
paths-ignore:
- "docs/**"
- "tools/**"
- "scripts/**"
- "README.md"
- "README_zh-CN.md"
pull_request:
paths-ignore:
- "docs/**"
- "tools/**"
- "scripts/**"
- "README.md"
- "README_zh-CN.md"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ut-torch180:
# The type of runner that the job will run on
runs-on: [unittest-t4]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run unittest
shell: bash
run: |
set -e
UNITTEST_OSS_CONFIG=~/.ossutilconfig.unittest
if [ ! -e $UNITTEST_OSS_CONFIG ]; then
echo "$UNITTEST_OSS_CONFIG does not exists"
exit
fi
export OSS_CONFIG_FILE=$UNITTEST_OSS_CONFIG
export PYTHONPATH=.
export TEST_DIR="/tmp/easycv_test_${USER}_`date +%s`"
# do not uncomments, casue faild in Online UT, install requirements by yourself on UT machine
# pip install -r requirements.txt
#run test
export CUDA_VISIBLE_DEVICES=6
source ~/workspace/anaconda2/etc/profile.d/conda.sh
conda activate evtorch_torch1.8.0
PYTHONPATH=. python tests/run.py

23
.github/workflows/lint.yaml vendored 100644
View File

@ -0,0 +1,23 @@
name: Lint test
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install pre-commit hook
run: |
pip install pre-commit
cp .github/hooks/pre-commit .git/hooks/
- name: Linting
run: pre-commit run --all-files