valorant_api 0.0.4

A library for interacting with the ingame Valorant-API.
Documentation
variables:
  GIT_STRATEGY: clone
  DEBIAN_FRONTEND: noninteractive
  CARGO_HOME: ${CI_PROJECT_DIR}/.cargo

workflow:
  rules:
  - if: '$CI_COMMIT_BRANCH && $CI_PIPELINE_SOURCE == "push" && $CI_OPEN_MERGE_REQUESTS'
    when: never
  - when: always

default:
  image: rust:slim-buster
  timeout: 1 hours
  retry:
    max: 2
    when:
    - runner_system_failure
    - stuck_or_timeout_failure
    - unknown_failure
  before_script:
  - apt-get update && apt-get install -y --no-install-recommends ca-certificates curl git make
    libssl-dev pkg-config

cache:
  key: global-cache
  paths:
  - target/
  - .cargo/

stages:
- lint
- build
- test

clippy:
  stage: lint
  needs: []
  script:
  - rustup component add clippy
  - cargo clippy --examples -- -D warnings

format:
  stage: lint
  needs: []
  script:
  - rustup component add rustfmt
  - cargo fmt --check

pre-commit:
  image: rust:slim
  stage: lint
  needs: []
  script:
  - apt update && apt install -y --no-install-recommends pre-commit
  - rustup component add rustfmt clippy
  - pre-commit run --all-files

build-release:
  stage: build
  needs: []
  rules:
  - if: '$CI_COMMIT_BRANCH == "master"'
  - if: '$CI_COMMIT_BRANCH && $CI_PIPELINE_SOURCE == "push" && $CI_OPEN_MERGE_REQUESTS'
    when: never
  script:
  - cargo build --release

build-debug:
  stage: build
  needs: []
  script:
  - cargo build

build-documentation-production:
  stage: build
  needs: []
  rules:
  - if: '$CI_COMMIT_BRANCH == "master"'
  - if: '$CI_COMMIT_BRANCH && $CI_PIPELINE_SOURCE == "push" && $CI_OPEN_MERGE_REQUESTS'
    when: never
  script:
  - cargo doc --no-deps
  artifacts:
    paths:
    - target/doc/valorant_api
    expire_in: 2 weeks

build-documentation-development:
  stage: build
  needs: []
  script:
  - cargo doc --no-deps --document-private-items
  artifacts:
    paths:
    - target/doc/valorant_api
    expire_in: 2 weeks

test-release:
  stage: test
  needs: []
  rules:
  - if: '$CI_COMMIT_BRANCH == "master"'
  - if: '$CI_COMMIT_BRANCH && $CI_PIPELINE_SOURCE == "push" && $CI_OPEN_MERGE_REQUESTS'
    when: never
  script:
  - cargo test --release

test-debug:
  stage: test
  needs: []
  tags:
  - unconfined
  script:
  - cargo install cargo-tarpaulin
  - cargo tarpaulin -o xml --skip-clean
  coverage: /\d+.\d+\% coverage/
  artifacts:
    reports:
      coverage_report:
        coverage_format: cobertura
        path: cobertura.xml

include:
- template: Code-Quality.gitlab-ci.yml
- template: Security/Secret-Detection.gitlab-ci.yml

code_quality:
  rules:
  - if: '$CI_COMMIT_BRANCH == "master"'
  - if: '$CI_OPEN_MERGE_REQUESTS'
  variables:
    CODE_QUALITY_IMAGE: "$CI_REGISTRY/valorant-api/rust-valorant-api/ci/codequality:latest"
  tags:
  - docker
  before_script:
  - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY

secret_detection:
  needs: []
  rules:
  - if: '$CI_COMMIT_BRANCH == "master"'
  - if: '$CI_OPEN_MERGE_REQUESTS'
  before_script: []