version: 0.2
#this build spec assumes the manylinux1 image for pypi
#additional packages we installed: cmake 3.5, libcrypto 1.1.0j, gcc 4.8.4
env:
  shell: bash
  variables:
    CANARY_DURATION: 25200
    CANARY_THREADS: 3
    CANARY_TPS: 50
    CANARY_CLIENT_COUNT: 10
    CANARY_LOG_FILE: 'canary_log.txt'
    CANARY_LOG_LEVEL: 'ERROR'
    BUILDER_VERSION: v0.9.21
    BUILDER_SOURCE: releases
    BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
    PACKAGE_NAME: aws-crt-python
    CANARY_TEST_EXE: 'python -m unittest --failfast --verbose 2>&1 | tee /tmp/tests.log test.test_mqtt5_canary'
    CANARY_SERVER_ARN: Mqtt5MosquittoSever
phases:
  install:
    commands:
      - add-apt-repository ppa:ubuntu-toolchain-r/test
      - apt-get update -y
      - apt-get install gcc-7 cmake ninja-build python3 -y
      - python3 -m pip install psutil
      - python3 -m pip install boto3
  pre_build:
    commands:
      - export CC=gcc-7
  build:
    commands:
      - echo Build started on `date`
      - source ./codebuild/mqtt5_test_setup.sh s3://aws-crt-test-stuff/TestIotProdMQTT5EnvironmentVariables.txt us-east-1
      - export ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "$CANARY_SERVER_ARN" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')
      - export GIT_HASH=$(git rev-parse HEAD)
      - $CODEBUILD_SRC_DIR/codebuild/mqtt5-python-canary-test.sh
  post_build:
    commands:
      - echo Build completed on `date`