.cargo_test_template: &cargo_test
  stage: test
  script:
    - cargo test --verbose --jobs 1
    - kcov --exclude-pattern=/.cargo,/usr/lib,./test --exclude-region='#[cfg(test)]:#[cfg(testkcovstopmarker)]' --verify target/cov target/debug/libcratesio-*
    - COVERAGE=$(grep -Po 'covered":.*?[^\\]"' target/cov/index.json | grep "[0-9]*\.[0-9]" -o)
    - echo "Coverage:" $COVERAGE

stages:
  - test
  - deploy

stable:cargo:
  image: rustdocker/rust:stable
  <<: *cargo_test

beta:cargo:
  image: rustdocker/rust:beta
  <<: *cargo_test

nightly:cargo:
  image: rustdocker/rust:nightly
  <<: *cargo_test

.pages:
  image: rustdocker/rust:stable
  stage: deploy
  only:
    - master
  script:
    - cargo doc
    - rm -rf public
    - mkdir public
    - cp -R target/doc/* public
  artifacts:
    paths:
    - public

.cargo_test_kcov_template: &cargo_test_kcov
  stage: test
  script:
    - cargo test --verbose --jobs 1
    - kcov --exclude-pattern=/.cargo,/usr/lib,./test --exclude-region='#[cfg(test)]:#[cfg(testkcovstopmarker)]' --verify target/cov target/debug/libcratesio-*
    - COVERAGE=$(grep -Po 'covered":.*?[^\\]"' target/cov/index.json | grep "[0-9]*\.[0-9]" -o)
    - echo "Coverage:" $COVERAGE

.cargo_test_template: &cargo_test
  stage: test
  script:
    - cargo test --verbose --jobs 1

stages:
  - test
  - deploy

stable:cargo:
  image: rustdocker/rust:stable
  <<: *cargo_test

beta:cargo:
  image: rustdocker/rust:beta
  <<: *cargo_test

nightly:cargo:
  image: rustdocker/rust:nightly
  <<: *cargo_test

.pages:
  image: rustdocker/rust:stable
  stage: deploy
  only:
    - master
  script:
    - cargo doc
    - rm -rf public
    - mkdir public
    - cp -R target/doc/* public
  artifacts:
    paths:
    - public

Split kcov into a separate template
Split kcov into a separate template
