rs-zero 0.2.8

Rust-first microservice framework inspired by go-zero engineering practices
Documentation
name: external-integrations

on:
  workflow_dispatch:
    inputs:
      target:
        description: Integration target to run
        required: false
        default: all
        type: choice
        options:
          - all
          - redis
          - redis-fault
          - redis-recovery
          - redis-cluster
          - linux-cpu
          - etcd
          - kubernetes
          - otlp
          - pyroscope
          - mysql
          - postgres
  schedule:
    - cron: "17 20 * * 0"

permissions:
  contents: read

concurrency:
  group: external-integrations-${{ github.ref }}-${{ github.event.inputs.target || 'schedule' }}
  cancel-in-progress: false

jobs:
  external:
    name: ${{ matrix.target }}
    runs-on: ubuntu-latest
    timeout-minutes: 35
    strategy:
      fail-fast: false
      matrix:
        target: [redis, redis-fault, redis-recovery, redis-cluster, linux-cpu, etcd, kubernetes, otlp, pyroscope, mysql, postgres]
    steps:
      - name: Skip unselected target
        if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target != 'all' && github.event.inputs.target != matrix.target }}
        run: |
          echo "Skipping ${{ matrix.target }} because workflow_dispatch target is ${{ github.event.inputs.target }}."

      - name: Checkout
        if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.target == 'all' || github.event.inputs.target == matrix.target }}
        uses: actions/checkout@v4

      - name: Install Rust
        if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.target == 'all' || github.event.inputs.target == matrix.target }}
        uses: dtolnay/rust-toolchain@stable

      - name: Cache cargo
        if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.target == 'all' || github.event.inputs.target == matrix.target }}
        uses: Swatinem/rust-cache@v2

      - name: Install KinD and kubectl
        if: ${{ (github.event_name != 'workflow_dispatch' || github.event.inputs.target == 'all' || github.event.inputs.target == matrix.target) && matrix.target == 'kubernetes' }}
        run: |
          set -euo pipefail
          curl -fsSLo kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64
          chmod +x kind
          sudo mv kind /usr/local/bin/kind
          curl -fsSLo kubectl https://dl.k8s.io/release/v1.30.0/bin/linux/amd64/kubectl
          chmod +x kubectl
          sudo mv kubectl /usr/local/bin/kubectl

      - name: Run external integration target
        if: ${{ matrix.target != 'redis-cluster' && (github.event_name != 'workflow_dispatch' || github.event.inputs.target == 'all' || github.event.inputs.target == matrix.target) }}
        env:
          CARGO_TERM_COLOR: always
        run: |
          set -euo pipefail
          echo "::group::external integration ${{ matrix.target }}"
          scripts/external-integration.sh "${{ matrix.target }}"
          echo "::endgroup::"

      - name: Skip Redis Cluster target without startup nodes
        if: ${{ matrix.target == 'redis-cluster' && (github.event_name != 'workflow_dispatch' || github.event.inputs.target == 'all' || github.event.inputs.target == matrix.target) }}
        run: |
          echo "Redis Cluster external test requires RS_ZERO_TEST_REDIS_CLUSTER_URL."
          echo "Run scripts/external-integration.sh redis-cluster with a local Redis Cluster."

      - name: Collect docker diagnostics
        if: ${{ failure() && (github.event_name != 'workflow_dispatch' || github.event.inputs.target == 'all' || github.event.inputs.target == matrix.target) }}
        run: |
          docker ps -a || true
          docker compose -f examples/production-adapters/docker-compose.external.yml ps || true
          docker compose -f examples/production-adapters/docker-compose.external.yml logs --tail=200 || true

      - name: Collect Kubernetes diagnostics
        if: ${{ failure() && matrix.target == 'kubernetes' && (github.event_name != 'workflow_dispatch' || github.event.inputs.target == 'all' || github.event.inputs.target == matrix.target) }}
        run: |
          kubectl cluster-info --context kind-rs-zero-external || true
          kubectl get endpointslices -A --context kind-rs-zero-external || true