duroxide-cdb 0.1.10

A CosmosDB-based provider implementation for Duroxide, a durable task orchestration framework
Documentation
name: Tests

# Runs cargo tests against a remote Azure CosmosDB on PRs and pushes to main.
#
# Required repository secrets:
#   COSMOS_ENDPOINT  - https://<account>.documents.azure.com:443/
#   COSMOS_KEY       - account primary key
#   COSMOS_DATABASE  - database name (tests use this database; containers are
#                      created/destroyed per test)
#
# If any secret is missing, the workflow exits early with a clear message
# rather than failing in a confusing way.

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

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Run Cargo Tests (CosmosDB)
    runs-on: ubuntu-latest
    permissions:
      contents: read

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Verify CosmosDB secrets are configured
        env:
          COSMOS_ENDPOINT: ${{ secrets.COSMOS_ENDPOINT }}
          COSMOS_KEY: ${{ secrets.COSMOS_KEY }}
          COSMOS_DATABASE: ${{ secrets.COSMOS_DATABASE }}
        run: |
          missing=()
          [ -z "$COSMOS_ENDPOINT" ] && missing+=("COSMOS_ENDPOINT")
          [ -z "$COSMOS_KEY" ]      && missing+=("COSMOS_KEY")
          [ -z "$COSMOS_DATABASE" ] && missing+=("COSMOS_DATABASE")
          if [ ${#missing[@]} -ne 0 ]; then
            echo "::error::Missing required secrets: ${missing[*]}"
            echo "Configure them under repo Settings → Secrets and variables → Actions."
            exit 1
          fi

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable

      - name: Strip local path overrides (use crates.io duroxide)
        run: |
          find . -name Cargo.toml -not -path './target/*' -exec sed -i 's|, path = "\(\.\./\)\+duroxide"||g' {} +
          grep -rn '^duroxide' --include=Cargo.toml . || true

      - name: Install nextest
        uses: taiki-e/install-action@nextest

      - name: Cache cargo registry
        uses: actions/cache@v4
        with:
          path: ~/.cargo/registry
          key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-cargo-registry-

      - name: Cache cargo index
        uses: actions/cache@v4
        with:
          path: ~/.cargo/git
          key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-cargo-index-

      - name: Cache cargo build
        uses: actions/cache@v4
        with:
          path: target
          key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-cargo-build-target-

      - name: Run tests
        env:
          COSMOS_ENDPOINT: ${{ secrets.COSMOS_ENDPOINT }}
          COSMOS_KEY: ${{ secrets.COSMOS_KEY }}
          COSMOS_DATABASE: ${{ secrets.COSMOS_DATABASE }}
        # Cap concurrency at 4 — matches local guidance, avoids 429s from Cosmos.
        run: cargo nextest run --all-features --test-threads=4