# This is a basic workflow to help you get started with Actions

name: Full Test Suite on Windows

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

env:
    SCONS_CACHE_MSVC_CONFIG: 1

jobs:
  runtest-win32:
    strategy:
      fail-fast: false
      matrix:
        os: ['windows-latest']

    runs-on: ${{ matrix.os }}

    steps:
      - uses: actions/checkout@v4

      - name: Set up Python 3.12 ${{ matrix.os }}
        uses: actions/setup-python@v5
        with:
          python-version: '3.12'
          cache: 'pip'

      - name: Install Python dependencies ${{ matrix.os }}
        run: |
          python -m pip install --progress-bar off --upgrade pip
          python -m pip install --progress-bar off -r requirements-dev.txt

      - name: Install Chocolatey packages ${{ matrix.os }}
        run: |
          choco install --yes --no-progress dmd winflexbison3

      - name: Populate MSVC cache ${{ matrix.os }}
        run: |
          python testing/ci/windows_msvc_cache.py

      - name: runtest ${{ matrix.os }}
        run: |
          python runtest.py --all --exclude-list=testing/ci/windows_ci_skip.txt --time --jobs=4

      - name: Archive Failed tests ${{ matrix.os }}
        uses: actions/upload-artifact@v4
        if: failure()
        with:
          name: ${{ matrix.os }}-failed-tests
          path: |
            failed_tests.log
