forked from aws/amazon-sagemaker-examples
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Zero code change automation (aws#128)
* changes for automatic zero_code_changes_testing. This is first step towards automated release
- Loading branch information
Showing
4 changed files
with
110 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Build Spec for AWS CodeBuild CI | ||
|
||
version: 0.2 | ||
env: | ||
variables: | ||
## below enviornment variables are overridden in respective code build. | ||
# for example for pytorch build run_pytest_pytorch and run_integration_pytest_pytorch will be enabled | ||
run_pytest_pytorch: "disable" | ||
run_pytest_mxnet: "enable" | ||
run_pytest_tensorflow: "disable" | ||
run_pytest_xgboost: "disable" | ||
run_integration_pytest_pytorch: "disable" | ||
run_integration_pytest_mxnet: "enable" | ||
run_integration_pytest_tensorflow: "disable" | ||
run_integration_pytest_xgboost: "disable" | ||
# below needs to be enabled | ||
zero_code_change_test: "enable" | ||
phases: | ||
install: | ||
commands: | ||
- . config/change_branch.sh | ||
- su && apt-get update | ||
- apt-get install sudo -qq -o=Dpkg::Use-Pty=0 # silence output: https://askubuntu.com/a/668859/724247 | ||
- sudo apt-get update -qq -o=Dpkg::Use-Pty=0 | ||
- sudo apt-get install unzip -qq -o=Dpkg::Use-Pty=0 | ||
- cd $CODEBUILD_SRC_DIR && chmod +x config/protoc_downloader.sh && ./config/protoc_downloader.sh | ||
- pip install -U pip | ||
- pip install -q pytest wheel pyYaml pytest-html pre-commit | ||
|
||
build: | ||
commands: | ||
- cd $CODEBUILD_SRC_DIR && chmod +x config/install_smdebug.sh && chmod +x config/check_smdebug_install.sh && ./config/install_smdebug.sh && cd .. | ||
- cd $RULES_CODEBUILD_SRC_DIR && python setup.py bdist_wheel --universal && pip install dist/*.whl && cd .. | ||
- cd $CODEBUILD_SRC_DIR && chmod +x config/tests.sh && ./config/tests.sh && mkdir -p upload/$CURRENT_COMMIT_PATH/wheels && cp ./dist/*.whl upload/$CURRENT_COMMIT_PATH/wheels && cd .. | ||
- cd $RULES_CODEBUILD_SRC_DIR && chmod +x config/tests.sh && mkdir -p upload/$CURRENT_COMMIT_PATH/wheels && ./config/tests.sh && cp ./dist/*.whl upload/$CURRENT_COMMIT_PATH/wheels && cd .. | ||
|
||
post_build: | ||
commands: | ||
- . $CODEBUILD_SRC_DIR/config/upload_on_end.sh | ||
- rm -rf $CODEBUILD_SRC_DIR/upload/$CURRENT_COMMIT_PATH | ||
- rm -rf $RULES_CODEBUILD_SRC_DIR/upload/$CURRENT_COMMIT_PATH | ||
- if [ "$CODEBUILD_BUILD_SUCCEEDING" -eq 0 ]; then echo "ERROR BUILD FAILED " && exit 1 ; fi | ||
- if [ "$CODEBUILD_BUILD_SUCCEEDING" -eq 1 ]; then echo "INFO BUILD SUCCEEDED !!! " ; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
set -ex | ||
set -o pipefail | ||
python -c "import smdebug" | ||
res="$?" | ||
echo "output of import smdebug is: $res" | ||
|
||
#version=python -c "exec(\"import smdebug\nprint(smdebug.__version__)\")` | ||
version="$(python -c "exec(\"import smdebug\nprint(smdebug.__version__)\")")" | ||
# force check version, you can set this env variable in build env when releasing | ||
|
||
if [ "$force_check_smdebug_version" ] && [ "$force_check_smdebug_version" != "${version}" ]; then | ||
echo "force_check_version $force_check_smdebug_version doesn't match version found: ${version}" | ||
exit 1 | ||
fi | ||
|
||
if [ $1 ]; then | ||
python -c "import $1" | ||
res="$?" | ||
echo "output of import $1 is: $res" | ||
exit $res | ||
fi | ||
exit $res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
set -ex | ||
set -o pipefail | ||
|
||
|
||
cd $CODEBUILD_SRC_DIR | ||
# you can provide bip binary as s3 path in the build environment | ||
if [ "$SMDEBUG_S3_BINARY" ]; then | ||
mkdir -p s3_pip_binary | ||
aws s3 cp "$SMDEBUG_S3_BINARY" s3_pip_binary | ||
pip install --force-reinstall --upgrade s3_pip_binary/*.whl | ||
else | ||
python setup.py bdist_wheel --universal && pip install --upgrade --force-reinstall dist/*.whl | ||
fi | ||
|
||
|
||
if [ "$run_pytest_mxnet" == 'enable' ]; then | ||
./config/check_smdebug_install.sh mxnet | ||
fi | ||
if [ "$run_pytest_tensorflow" == 'enable' ]; then | ||
./config/check_smdebug_install.sh tensorflow | ||
fi | ||
if [ "$run_pytest_pytorch" == 'enable' ]; then | ||
./config/check_smdebug_install.sh torch | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters