name: E2E Test Windows

# Building on windows is really slow, so this workflow is separate from e2e.yml and only builds on changes
# to the cli itself. They're more likely to introduce issues on windows, compared to changes to core and yarn.lock.
on:
  pull_request:
    paths:
      - '.github/workflows/e2e-win.yml'
      - 'packages/cli/**'
      - 'packages/e2e/**'
      - 'packages/create-app/**'

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

    strategy:
      matrix:
        os: [windows-latest]
        node-version: [14.x, 16.x]

    env:
      CI: true
      NODE_OPTIONS: --max-old-space-size=4096

    name: Node ${{ matrix.node-version }} on ${{ matrix.os }}
    steps:
      # In order to have the create-app template function as if it was downloaded from NPM
      # we need to make sure we checkout files with LF line endings only
      - name: Set git to use LF
        run: |
          git config --global core.autocrlf false
          git config --global core.eol lf

      - uses: actions/checkout@v2

      - name: use node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: Add msbuild to PATH
        uses: microsoft/setup-msbuild@v1.0.2
      - name: yarn install
        run: yarn install --frozen-lockfile

      - run: yarn tsc
      - name: yarn build
        run: yarn build --ignore example-app --ignore example-backend --ignore @techdocs/cli
      - name: run E2E test
        run: yarn e2e-test run
