---
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use
# this file except in compliance with the License. A copy of the License is
# located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing permissions and
# limitations under the License.
version: 0.2

# Doc for batch https://docs.aws.amazon.com/codebuild/latest/userguide/batch-build-buildspec.html#build-spec.batch.build-list
batch:
  build-list:
    - identifier: sawHMACPlus
      buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_LARGE
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        variables:
          TESTS: sawHMACPlus
          SAW: true
          GCC_VERSION: NONE

    - identifier: s2nSawTls
      buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_LARGE
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        variables:
          TESTS: tls
          SAW: true
          GCC_VERSION: NONE

    # Other
    - identifier: s2nSidetrail
      buildspec: codebuild/spec/buildspec_sidetrail.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_2XLARGE
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu14codebuild
        variables:
          TESTS: sidetrail


    - identifier: s2nValgrindOpenSSL102Gcc6Fips
      buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_LARGE
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        variables:
          TESTS: valgrind
          GCC_VERSION: 6
          S2N_LIBCRYPTO: openssl-1.0.2-fips
          BUILD_S2N: true

    - identifier: s2nValgrindOpenSSL111Gcc9
      buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_LARGE
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        variables:
          TESTS: valgrind
          GCC_VERSION: 9
          S2N_LIBCRYPTO: openssl-1.1.1
          BUILD_S2N: true

    - identifier: s2nValgrindOpenssl102
      buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_LARGE
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        variables:
          TESTS: valgrind
          GCC_VERSION: '6'
          S2N_LIBCRYPTO: 'openssl-1.0.2'
          BUILD_S2N: 'true'

    - identifier: s2nValgrindAwslc
      buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_LARGE
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        variables:
          TESTS: valgrind
          GCC_VERSION: '6'
          S2N_LIBCRYPTO: 'awslc'
          BUILD_S2N: 'true'

    - identifier: s2nValgrindAwslcFips
      buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_LARGE
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        variables:
          TESTS: valgrind
          GCC_VERSION: '6'
          S2N_LIBCRYPTO: 'awslc-fips'
          BUILD_S2N: 'true'

    - identifier: s2nAsanOpenSSL111Coverage
      buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_LARGE
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        variables:
          TESTS: asan
          GCC_VERSION: '6'
          S2N_LIBCRYPTO: 'openssl-1.1.1'
          BUILD_S2N: 'true'
          S2N_COVERAGE: 'true'

    - identifier: s2nAsanOpenssl102
      buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_LARGE
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        variables:
          TESTS: asan
          GCC_VERSION: '6'
          S2N_LIBCRYPTO: 'openssl-1.0.2'
          BUILD_S2N: 'true'

    - identifier: s2nUnitNoPQ
      buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_SMALL
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        variables:
          TESTS: unit
          GCC_VERSION: '9'
          S2N_LIBCRYPTO: 'openssl-1.1.1'
          S2N_NO_PQ: 1
          BUILD_S2N: 'true'

    - identifier: s2nUnitAl2Arm
      buildspec: codebuild/spec/buildspec_amazonlinux2.yml
      env:
        type: ARM_CONTAINER
        compute-type: BUILD_GENERAL1_LARGE
        image: aws/codebuild/amazonlinux2-aarch64-standard:2.0
        privileged-mode: true
        variables:
          S2N_NO_PQ: 1
          TESTS: unit

    - identifier: s2nUnitAl2
      buildspec: codebuild/spec/buildspec_amazonlinux2.yml
      env:
        image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
        privileged-mode: true
        compute-type: BUILD_GENERAL1_SMALL
        variables:
          TESTS: unit
          S2N_NO_PQ: 1

    - identifier: s2nLibcryptoInterningOpenSSL
      buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_LARGE
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        variables:
          TESTS: interning
          BUILD_S2N: 'true'

    - identifier: s2nLibcryptoInterningAwslc
      buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_LARGE
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        variables:
          TESTS: interning
          BUILD_S2N: 'true'
          S2N_LIBCRYPTO: awslc

    - identifier: s2nUnitCRT
      buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        compute-type: BUILD_GENERAL1_LARGE
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        privileged-mode: true
        variables:
          GCC_VERSION: '6'
          TESTS: crt

    - identifier: s2nInstallSharedAndStatic
      buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        compute-type: BUILD_GENERAL1_SMALL
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        privileged-mode: true
        variables:
          TESTS: sharedandstatic
          # must use the libcrypto that's actually installed on the system
          S2N_LIBCRYPTO: openssl-1.1.1

    - buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        compute-type: BUILD_GENERAL1_LARGE
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        privileged-mode: true
        variables:
          BUILD_S2N: true
          GCC_VERSION: 6
          S2N_COVERAGE: true
          S2N_LIBCRYPTO: openssl-1.1.1
          TESTS: unit
      identifier: s2nUnitOpenSSL111Gcc6Coverage

    - buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        compute-type: BUILD_GENERAL1_SMALL
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        privileged-mode: true
        variables:
          BUILD_S2N: 'true'
          GCC_VERSION: '6'
          S2N_LIBCRYPTO: 'libressl'
          S2N_NO_PQ: 1
          TESTS: unit
      identifier: s2nUnitLibressl

    - buildspec: codebuild/spec/buildspec_ubuntu.yml
      env:
        compute-type: BUILD_GENERAL1_SMALL
        image: 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu18codebuild
        privileged-mode: true
        variables:
          BUILD_S2N: 'true'
          GCC_VERSION: '9'
          S2N_LIBCRYPTO: 'boringssl'
          S2N_NO_PQ: 1
          TESTS: unit
      identifier: s2nUnitBoringssl

    # Fuzz tests
    - identifier: s2nFuzzerOpenSSL111Coverage
      buildspec: codebuild/spec/buildspec_ubuntu_fuzz_artifacts.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_LARGE
        image: aws/codebuild/standard:5.0
        variables:
          S2N_LIBCRYPTO: openssl-1.1.1
          LATEST_CLANG: true
          TESTS: fuzz
          FUZZ_TIMEOUT_SEC: 60
          FUZZ_COVERAGE: true

    - identifier: s2nFuzzerOpenSSL102
      buildspec: codebuild/spec/buildspec_ubuntu_fuzz_artifacts.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_LARGE
        image: aws/codebuild/standard:5.0
        variables:
          S2N_LIBCRYPTO: openssl-1.0.2
          LATEST_CLANG: true
          TESTS: fuzz
          FUZZ_TIMEOUT_SEC: 60

    - identifier: s2nFuzzerOpenSSL102FIPS
      buildspec: codebuild/spec/buildspec_ubuntu_fuzz_artifacts.yml
      env:
        privileged-mode: true
        compute-type: BUILD_GENERAL1_LARGE
        image: aws/codebuild/standard:5.0
        variables:
          S2N_LIBCRYPTO: openssl-1.0.2-fips
          LATEST_CLANG: true
          TESTS: fuzz
          FUZZ_TIMEOUT_SEC: 60

