hook0-api 0.1.0

Core REST API of Hook0 — Open-Source Webhooks as a service for SaaS
include:
  - component: $CI_SERVER_HOST/CleverCloud/clever-cloud-pipeline/deploy-to-prod@1.0.4
    inputs:
      stage: release
      environment: staging
      step_name: deploy api to staging
      app_id: $CLEVERCLOUD_STAGING_APP_ID
      when: manual
  - component: $CI_SERVER_HOST/CleverCloud/clever-cloud-pipeline/deploy-to-prod@1.0.4
    inputs:
      stage: release
      environment: production
      step_name: deploy api to production
      app_id: $CLEVERCLOUD_PRODUCTION_APP_ID
      when: manual


api.check:
  stage: test
  dependencies: []
  image: rust:$RUST_VERSION
  rules:
    - changes:
        - api/**/*
        - sentry-integration/**/*
        - clients/rust/**/*
        - Cargo.*
  variables:
    SQLX_OFFLINE: "true"
  services:
    - postgres:$PG_VERSION
  before_script:
    - rustc --version && cargo --version
    - rustup component add clippy
    - rustup component add rustfmt
  script:
    - pushd api
    - cargo fmt --all -- --check
    - cargo clippy --all-targets --all-features -- -D warnings
    - cargo test

api.semver-checks:
  stage: test
  dependencies: []
  image: rust:$RUST_VERSION
  rules:
    - changes:
        - api/**/*
        - sentry-integration/**/*
        - clients/rust/**/*
        - Cargo.*
  before_script:
    - rustc --version && cargo --version
    - cargo install cargo-semver-checks --locked
  script:
    - pushd api
    - cargo semver-checks

api.documentation:
  stage: documentation
  dependencies: []
  environment:
    name: production-api
    url: https://app.hook0.com/api/v1
  rules:
    - if: $CI_COMMIT_BRANCH == "master"
      changes:
        - api/**
        - Cargo.*
  image: node:$NODE_VERSION
  script:
    - npx --yes rdme@8.3.0 openapi --id=${README_IO_ID} --key=${README_IO_KEY} --update https://app.hook0.com/api/v1/swagger.json