name: Windows Smoke

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

concurrency:
  group: windows-smoke-${{ github.ref }}
  cancel-in-progress: true

jobs:
  smoke:
    runs-on: windows-latest
    timeout-minutes: 15

    steps:
      - name: Checkout
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Setup Python
        uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
        with:
          python-version: "3.12"

      - name: Install package
        shell: pwsh
        run: |
          python -m pip install --upgrade pip setuptools wheel
          python -m pip install .

      - name: Run smoke checks
        shell: pwsh
        run: |
          lore version

          $testRepo = Join-Path $env:RUNNER_TEMP "lore-smoke-project"
          New-Item -ItemType Directory -Path $testRepo -Force | Out-Null
          Set-Location $testRepo

          lore init .
          lore add facts "windows smoke memory"
          lore trust refresh --dry-run
          lore export --format chronicle

          if (-not (Test-Path (Join-Path $testRepo "CHRONICLE.md"))) {
            throw "CHRONICLE.md was not generated"
          }
