forked from JeromeMaslowski/bbs-hypercube-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodebuild_build.yml
More file actions
40 lines (38 loc) · 1.86 KB
/
codebuild_build.yml
File metadata and controls
40 lines (38 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
version: 0.2
env:
variables:
DOCUUID: "29dc2abb-fc26-403e-bad0-0088c7640168"
phases:
install:
commands:
# Setting up Docker
- echo "Starting the Docker daemon"
- nohup /usr/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay&
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
pre_build:
commands:
- echo "Running Unit Tests"
- pip install pyjwt
- python -m unittest discover -s $CODEBUILD_SRC_DIR/tests -p "*_test.py" -v
- echo "Logging into Amazon ECR..."
- $(aws ecr get-login --no-include-email --region eu-central-1)
- echo "Setup Twine"
- aws s3 cp s3://ops.hcube.cool/pypi/password.txt ./password.txt && export TWINE_USERNAME=admin && export TWINE_PASSWORD=$(cat password.txt) && export TWINE_REPOSITORY_URL=https://pypi.hcube.cool/simple
build:
commands:
- export GIT_SOURCE_VERSION=$(git rev-parse HEAD)
- export WHEEL_FILENAME="HyperAPI-$PACKAGE_VERSION-py3-none-any.whl"
- echo "Building HyperAPI Wheel"
- python setup.py sdist bdist_wheel
- twine upload $CODEBUILD_SRC_DIR/dist/$WHEEL_FILENAME
- echo "Installing HyperAPI's environment"
- pip install -r build_requirements.txt
- echo "Generating HyperAPI documentation sources"
- cd $CODEBUILD_SRC_DIR/docs; chmod +x generate_doc.sh; ./generate_doc.sh $CODEBUILD_SRC_DIR/HyperAPI/hyper_api $DOCUUID
- python $CODEBUILD_SRC_DIR/scripts/deploy.py -b hyperapi.hcube.cool -p $CODEBUILD_SRC_DIR/docs/$DOCUUID -r eu-central-1
- echo "Building HyperAPI Docker image"
- cd $CODEBUILD_SRC_DIR/dist
- docker build -t hyperapi . --build-arg hyperapiversion=$PACKAGE_VERSION
- docker tag hyperapi:latest $ECR_TARGET:$GIT_SOURCE_VERSION
- docker push $ECR_TARGET:$GIT_SOURCE_VERSION
- echo "Build Done"