ffsend-api 0.6.2

A fully featured Firefox Send API client.
Documentation
image: "rust:slim"

stages:
  - check
  - test
  - release
  - trigger

# Variable defaults
variables:
  RUST_VERSION: stable

# Cache rust/cargo/build artifacts
cache:
  key: "$CI_PIPELINE_ID-$RUST_VERSION"
  paths:
    - /usr/local/cargo/registry/
    - /usr/local/rustup/toolchains/
    - /usr/local/rustup/update-hashes/
    - target/

# Install compiler and OpenSSL dependencies
before_script:
  - apt-get update
  - apt-get install -y --no-install-recommends build-essential pkg-config libssl-dev
  - |
    rustup install $RUST_VERSION
    rustup default $RUST_VERSION
  - |
    rustc --version
    cargo --version

# Check on stable, beta and nightly 
.check-base: &check-base
  stage: check
  script:
    - cargo check --verbose
check-stable:
  <<: *check-base
check-beta:
  <<: *check-base
  variables:
    RUST_VERSION: beta
check-nightly:
  <<: *check-base
  variables:
    RUST_VERSION: nightly
check-old:
  <<: *check-base
  variables:
    RUST_VERSION: "1.39.0"

# Run the unit tests through Cargo
cargo-test:
  stage: test
  needs:
    - check-stable
  dependencies: []
  script:
    # Test default configuration
    - cargo test --verbose

    # Test different Send API versions and crypto backends
    - cargo test --no-default-features --features send3,crypto-ring
    - cargo test --no-default-features --features send2,crypto-openssl
    - cargo test --no-default-features --features send3,crypto-openssl
    - cargo test --no-default-features --features send2,send3,crypto-openssl

# Cargo crate release
crate:
  stage: release
  only:
    - /^v(\d+\.)*\d+.*$/
  script:
    - echo "Creating release crate on crates.io..."
    - echo $CARGO_TOKEN | cargo login
    - echo "Publishing crate to crates.io..."
    - cargo publish --verbose

# Trigger an ffsend CLI client build when an update is released
trigger-ffsend:
  stage: trigger
  only:
    - "/^v([0-9]+\\.)*[0-9]+.*$/"
  script:
    - apt-get install -y --no-install-recommends curl
    - "curl -X POST -F token=$FFSEND_TOKEN -F ref=master https://gitlab.com/api/v4/projects/5664378/trigger/pipeline"