version: 2
jobs:
  build:
    branches:
      ignore:
        # Skip staging CI if branch name starts with `docs-`.
        - /docs-.*/

    docker:
      - image: msheiny/pressfreedomci:latest
        environment:
          FPF_CI: true
          CI_SD_ENV: staging
          CI_AWS_TYPE: t2.small
          FPF_GRSEC: false
          TEST_REPORTS: /root/sd
    working_directory: /root/sd

    steps:
      - checkout

      - run:
          name: Installation pre-reqs
          command: pip install -U -r ./testinfra/requirements.txt

      - setup_remote_docker

      - run:
          name: Run molecule and manage tests
          command: make ci-go

      - run:
          name: Teardown environment
          command: make ci-teardown
          when: always

      - store_test_results:
          path: /root/sd/junit

      - store_artifacts:
          path: /root/sd/junit

---
version: 2
jobs:
  docs-lint:
    docker:
      - image: msheiny/pressfreedomci:latest

    steps:
      - checkout

      - run:
          name: Installation pre-reqs
          command: pip install -U -r securedrop/requirements/develop-requirements.txt

      - run:
          name: Run docs lint
          command: make docs-lint

  staging-test:
    docker:
      - image: msheiny/pressfreedomci:latest
        environment:
          FPF_CI: true
          CI_SD_ENV: staging
          CI_AWS_TYPE: t2.small
          FPF_GRSEC: false
          TEST_REPORTS: /root/sd
    working_directory: /root/sd

    steps:
      - checkout

      - run:
          name: Installation pre-reqs
          command: pip install -U -r ./testinfra/requirements.txt

      - setup_remote_docker

      - run:
          name: Run molecule and manage tests
          command: make ci-go

      - run:
          name: Teardown environment
          command: make ci-teardown
          when: always

      - store_test_results:
          path: /root/sd/junit

      - store_artifacts:
          path: /root/sd/junit

workflows:
  version: 2
  securedrop_ci:
    jobs:
      - docs-lint
      - staging-test:
          filters:
            branches:
              ignore: /^docs-.*/
          requires:
            - docs-lint

Add CI workflow, prevent staging on docs branches
Add CI workflow, prevent staging on docs branches
