cerbos 0.5.0

Rust SDK for working with Cerbos: an open core, language-agnostic, scalable authorization solution
Documentation
---
on:
  workflow_dispatch:
  pull_request:
    branches:
      - main
      - "v*"

name: Pull Request

defaults:
  run:
    shell: bash

permissions: {}

jobs:
  check:
    name: Check
    runs-on: ubuntu-latest
    steps:
      - name: Check out sources
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false

      - name: Install Protoc
        uses: cerbos/actions/install-tools@68b6dfbf9cc54c29a99f4bb9585af585fe6e12da # main
        with:
          tools: protoc

      - name: Install stable toolchain
        uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0
        with:
          override: true
          components: rustfmt, clippy

      - name: Run cargo check
        run: cargo check

      - name: Run cargo clippy
        run: cargo clippy --all-features -- -D warnings

      - name: Install Cerbos
        uses: cerbos/cerbos-setup-action@53d0a0d03111685bd355b2be6d75a2d0948c22de # v1.9.8
        with:
          version: latest

      - name: Run tests
        run: |
          cerbos run --set=storage.disk.directory=resources/store -- cargo test --test sdk_test
        env:
          CERBOS_NO_TELEMETRY: "1"

      - name: Run tests in testcontainers
        run: |
          cargo test --features testcontainers --test sdk_test
        env:
          CERBOS_NO_TELEMETRY: "1"

      - name: Run admin tests in testcontainers
        run: |
          cargo test --features admin,serde,testcontainers --test sdk_admin_test
        env:
          CERBOS_NO_TELEMETRY: "1"

      - name: Run Hub Store tests
        if: github.event.pull_request.head.repo.full_name == github.repository
        env:
          CERBOS_HUB_API_ENDPOINT: "${{ secrets.CERBOS_HUB_API_ENDPOINT }}"
          CERBOS_HUB_CLIENT_ID: "${{ secrets.CERBOS_HUB_CLIENT_ID }}"
          CERBOS_HUB_CLIENT_SECRET: "${{ secrets.CERBOS_HUB_CLIENT_SECRET }}"
          CERBOS_HUB_STORE_ID: "${{ secrets.CERBOS_HUB_STORE_ID }}"
        run: |
          cargo test --features hub --test store_integration_test -- --test-threads=1