---
version: 2.1

jobs:
  lint:
    docker:
    - image: cimg/go:1.16
    steps:
    - checkout
    - run: make check_license
    - run: ./scripts/check_build_tags.sh
    - run: make fixtures
    - run: make update_fixtures
    - run: git diff --exit-code

  test:
    parameters:
      go_version:
        type: string
      os:
        type: string
      run_test:
        type: boolean
        default: true
    docker:
    - image: circleci/golang:<< parameters.go_version >>
    environment:
      GOOS: "<< parameters.os >>"
    steps:
    - checkout
    - run: make style lint
    - when:
        condition: << parameters.run_test >>
        steps:
        - run: make test

  codespell:
    docker:
    - image: circleci/python

    steps:
    - checkout
    - run: sudo pip install codespell
    - run: codespell --skip=".git,./vendor,ttar,fixtures.ttar,./fixtures,go.mod,go.sum" -L uint,packages\',ded,alo,als,te,sie,hart,hda

workflows:
  version: 2
  procfs:
    jobs:
    - lint
    - test:
        name: test-linux
        os: linux
        matrix:
          parameters:
            go_version:
            - "1.13"
            - "1.14"
            - "1.15"
            - "1.16"
    - test:
        name: test-windows
        os: windows
        run_test: false
        matrix:
          parameters:
            go_version:
            - "1.13"
            - "1.14"
            - "1.15"
            - "1.16"
    - codespell
