diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000000..fc4ef446df8 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,130 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +pr: + - main + +pool: wenjiao-test + +variables: + VAL_PATH: /home2/wenjiaoy/sxh/val/frameworks.ai.lpot.lpot-validation + target_path: "neural_compressor" + +stages: +# - stage: pylint +# dependsOn: [] +# jobs: +# - job: pylint_test +# steps: +# - task: Bash@3 +# inputs: +# targetType: "inline" +# script: | +# pip install pylint==2.12.1 +# pip install intel-tensorflow +# python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime ./neural_compressor #> $(Build.SourcesDirectory)/lpot-pylint.json +# exit_code=$? +# if [ ${exit_code} -ne 0 ] ; then +# echo "PyLint exited with non-zero exit code."; exit 1 +# fi +# exit 0 + + # - stage: bandit + # dependsOn: [] + # jobs: + # - job: bandit_test + # steps: + # - task: Bash@3 + # inputs: + # targetType: "inline" + # script: | + # pip install bandit + # python -m bandit -r -lll -iii neural_compressor > $(Build.SourcesDirectory)/lpot-bandit.log + # exit_code=$? + # if [ ${exit_code} -ne 0 ] ; then + # echo "Bandit exited with non-zero exit code."; exit 1 + # fi + # exit 0 + +# - stage: pyspelling +# dependsOn: [] +# jobs: +# - job: pyspelling_test +# steps: +# - task: Bash@3 +# inputs: +# targetType: "inline" +# script: | +# pip install pyspelling +# # Update paths to validation and lpot repositories +# LPOT_REPO=$(WORKSPACE) +# REPO_DIR=$(WORKSPACE) +# VAL_REPO=$(VAL_PATH) + +# # sed -i "s|\${VAL_REPO}|$(VAL_REPO)|g" $(VAL_REPO)/neural_coder/pyspelling_conf.yaml +# # sed -i "s|\${LPOT_REPO}|$(REPO_DIR)|g" $(VAL_REPO)/neural_coder/pyspelling_conf.yaml +# sed -i "s|\${TEST_REPO}|$(VAL_PATH)|g" $(VAL_PATH)/neural_coder/pyspelling_conf.yaml +# sed -i "s|\${LPOT_REPO}|$(WORKSPACE)|g" $(VAL_PATH)/neural_coder/pyspelling_conf.yaml +# echo "Modified config:" +# cat $(VAL_PATH)/neural_coder/pyspelling_conf.yaml +# pyspelling -c $(VAL_PATH)/neural_coder/pyspelling_conf.yaml > $(Build.SourcesDirectory)/pyspelling_output.log +# exit_code=$? +# if [ ${exit_code} -ne 0 ] ; then +# echo "Pyspelling exited with non-zero exit code."; exit 1 +# fi +# exit 0 + + - stage: copyright + dependsOn: [] + jobs: + - job: copyright_check + steps: + - task: Bash@3 + inputs: + targetType: "inline" + script: | + # echo $(System.PullRequest.SourceBranch) + # echo $(System.PullRequest.TargetBranch) + supported_extensions=(py, sh, yaml) + + echo $(Build.SourcesDirectory) + echo $(Agent.BuildDirectory) + echo $(Pipeline.Workspace) + echo $(System.DefaultWorkingDirectory) + pwd + + set -xe + git --no-pager diff --name-only $(git show-ref -s remotes/origin/$(System.PullRequest.TargetBranch)) ./$(target_path) > $(WORKSPACE)/diff.log + cat $(WORKSPACE)/diff.log + files=$(cat $(WORKSPACE)/diff.log | awk '!a[$0]++') + + for file in ${files} + do + echo "hello world 1" + if [[ "${supported_extensions[@]}" =~ "${file##*.}" ]]; then + echo "hello world 2" + echo "Checking license in ${file}" + + if [ $(grep -E -c "Copyright \\(c\\) ([0-9]{4})(-[0-9]{4})? Intel Corporation" ${file}) = 0 ]; then + echo "hello world 3" + echo ${files} >> $(Build.SourcesDirectory)/copyright_issue_summary.log + fi + else + echo "Skipping ${file}" + fi + done + - job: status_check + dependsOn: copyright_check + steps: + - task: Bash@3 + inputs: + targetType: "inline" + script: | + ls $(Build.SourcesDirectory)/copyright_issue_summary.log + exit_code=$? + if [ ${exit_code} -ne 0 ] ; then + echo "------------------Check for wrong file list !!!!!!!!!!!!!!!!!!!!!!!"; exit 1 + fi + exit 0 diff --git a/neural_compressor/objective.py b/neural_compressor/objective.py index b6e656ff0a9..a7561cbd02b 100644 --- a/neural_compressor/objective.py +++ b/neural_compressor/objective.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2021 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/neural_compressor/version.py b/neural_compressor/version.py index e0bf7e5f61f..63d74ff42f9 100644 --- a/neural_compressor/version.py +++ b/neural_compressor/version.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2021 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.