name: Type check (make)
on:
  workflow_call:
    inputs:
      erlang_version:
        required: true
        type: string
      elixir_version:
        required: true
        type: string
jobs:
  type-check-plugin:
    name: Type check plugins
    strategy:
      fail-fast: false
      matrix:
        plugin:
          # These are using plugin-specific test jobs.
          - rabbit
          - rabbitmq_mqtt
          - rabbitmq_peer_discovery_aws
          # These are from the test-plugin test job.
          - amqp10_client
          - amqp10_common
          - amqp_client
          - oauth2_client
          - rabbit_common
          - rabbitmq_amqp_client
          - rabbitmq_auth_backend_cache
          - rabbitmq_auth_backend_http
          - rabbitmq_auth_backend_ldap
          - rabbitmq_auth_backend_oauth2
          - rabbitmq_auth_mechanism_ssl
          - rabbitmq_aws
          - rabbitmq_consistent_hash_exchange
          - rabbitmq_event_exchange
          - rabbitmq_federation
          - rabbitmq_federation_management
          - rabbitmq_federation_prometheus
          - rabbitmq_jms_topic_exchange
          - rabbitmq_management
          - rabbitmq_management_agent
          - rabbitmq_peer_discovery_common
          - rabbitmq_peer_discovery_consul
          # @todo We are getting errors because of wrong types
          # in the eetcd dep. But upgrading requires using gun 2.0,
          # which we can't because another app's dep, emqtt, requires
          # gun 1.3.x. So for now we don't type check this plugin.
          #- rabbitmq_peer_discovery_etcd
          - rabbitmq_peer_discovery_k8s
          - rabbitmq_prelaunch
          - rabbitmq_prometheus
          - rabbitmq_recent_history_exchange
          - rabbitmq_sharding
          - rabbitmq_shovel
          - rabbitmq_shovel_management
          - rabbitmq_shovel_prometheus
          - rabbitmq_stomp
          - rabbitmq_stream
          - rabbitmq_stream_common
          - rabbitmq_stream_management
          - rabbitmq_tracing
          - rabbitmq_trust_store
          - rabbitmq_web_dispatch
          - rabbitmq_web_mqtt
          - rabbitmq_web_stomp
          # This one we do not want to run tests so no corresponding test job.
          - rabbitmq_ct_helpers
          # These do not have tests at this time so no corresponding test job.
          - rabbitmq_ct_client_helpers
          - rabbitmq_random_exchange
          - rabbitmq_top
          - rabbitmq_web_mqtt_examples
          - rabbitmq_web_stomp_examples
          - trust_store_http
    uses: ./.github/workflows/test-make-target.yaml
    with:
      erlang_version: ${{ inputs.erlang_version }}
      elixir_version: ${{ inputs.elixir_version }}
      metadata_store: khepri # Not actually used.
      make_target: dialyze
      plugin: ${{ matrix.plugin }}
