# Golang CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2

# common setup and steps
defaultEnv:
  &defaultEnv
  docker:
    # specify the version
    - image: docker.io/fortio/fortio.build:v63@sha256:5aa4391129408742ad58c82c642e57549980f06a6e2322044bb430babb490cb6
  working_directory: /build/fortio

jobs:
  unit-tests:
    <<: *defaultEnv
    steps:
      - checkout
      - run: make test
    # The resource_class feature allows configuring CPU and RAM resources for each job. Different resource classes are available for different executors. https://circleci.com/docs/2.0/configuration-reference/#resourceclass
    resource_class: large
  release-tests:
    <<: *defaultEnv
    steps:
      - setup_remote_docker:
          version: 20.10.12
      - checkout
      - run: make release-test
  linters:
    <<: *defaultEnv
    steps:
      - checkout
      # If ran with default we get random errors because OOM killer kills some linters
      - run: make local-lint DEBUG_LINTERS="--concurrency=2"
  # codecov:
  #   <<: *defaultEnv
  #   steps:
  #     - checkout
  #     - run: make coverage
  #   # The resource_class feature allows configuring CPU and RAM resources for each job. Different resource classes are available for different executors. https://circleci.com/docs/2.0/configuration-reference/#resourceclass
  #   resource_class: large

workflows:
  version: 2
  all:
    jobs:
      - unit-tests
      - release-tests
#      - codecov
      - linters
