name: Test

on:
  push:
    branches:
      - '**'
    tags-ignore:
      - '**'
  pull_request:
  workflow_call:

jobs:
  load-config:
    name: Load CI Configuration
    runs-on: ubuntu-latest
    outputs:
      targets: ${{ steps.config.outputs.targets }}
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      
      - name: Load configuration
        id: config
        run: |
          TARGETS=$(jq -c '.targets' .github/config.json)
          echo "targets=$TARGETS" >> $GITHUB_OUTPUT

  test:
    name: Test
    runs-on: ubuntu-latest
    needs: load-config
    strategy:
      fail-fast: false
      matrix:
        target: ${{ fromJson(needs.load-config.outputs.targets) }}

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

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

      # - name: Run tests
      #   run: cargo test --target ${{ matrix.target }} --all-features -- --nocapture

      # - name: Run doc tests
      #   run: cargo test --target ${{ matrix.target }} --doc
      - name: Run tests
        run: echo "Tests are skipped!"
