name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  python:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0  # v7.0.0
      - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1  # v6.3.0
        with:
          python-version: "3.12"
      - name: Install dependencies
        run: pip install -e ".[dev]" pytest pytest-asyncio
      - name: Run tests
        run: pytest tests/ -v -m "not slow"

  javascript:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0  # v7.0.0
      - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020  # v7.0.0
        with:
          node-version: 20
      - name: Install and build
        run: cd js && npm install && npm run build
      - name: Typecheck
        run: cd js && npm run typecheck
      - name: Run tests
        run: cd js && npm test

  dotnet:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0  # v7.0.0
      - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68  # v6.0.0
        with:
          dotnet-version: '8.0.x'
      - name: Build
        run: dotnet build dotnet/CloakBrowser.sln -c Release
      - name: Run tests
        run: dotnet test dotnet/CloakBrowser.sln -c Release --no-build
