captcha-sdk 0.0.1

Unified server-side CAPTCHA verification for Rust
Documentation
name: CI

on:
  pull_request:
  push:
    branches:
      - main
  merge_group:

concurrency:
  group: ci-${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  fmt:
    name: Format
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          persist-credentials: false
      - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
        with:
          components: rustfmt
      - run: cargo fmt --all --check

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          persist-credentials: false
      - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
        with:
          components: clippy
      - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
      - run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings

  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          persist-credentials: false
      - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
      - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
      - uses: taiki-e/install-action@cfdc41eb4dcb5a6d098e06c87a1e91076b799307 # nextest
      - run: cargo nextest run --workspace --all-features --locked --profile ci
      - run: cargo test --workspace --no-default-features --locked
      - run: cargo test --workspace --doc --all-features --locked
      - run: RUSTDOCFLAGS="-D warnings -D missing_docs" cargo doc --workspace --all-features --no-deps

  features:
    name: Feature ${{ matrix.feature }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: true
      matrix:
        feature:
          - turnstile
          - hcaptcha
          - recaptcha
          - friendlycaptcha
          - captchafox
          - mtcaptcha
          - procaptcha
          - prosopo
          - altcha
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          persist-credentials: false
      - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
      - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
      - run: cargo check --no-default-features --features ${{ matrix.feature }} --locked

  ci:
    name: CI
    runs-on: ubuntu-latest
    needs:
      - fmt
      - clippy
      - test
      - features
    if: always()
    steps:
      - name: Check required jobs
        uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
        with:
          jobs: ${{ toJSON(needs) }}