diff --git a/.github/workflows/test-e2e-windows.yml b/.github/workflows/test-e2e-windows.yml index 1d64fd049423..8871d03cf001 100644 --- a/.github/workflows/test-e2e-windows.yml +++ b/.github/workflows/test-e2e-windows.yml @@ -119,21 +119,64 @@ jobs: with: version: "0.7.22" + - name: Configure Git and normalize files + shell: pwsh + run: | + git config --global core.autocrlf false + git config --global core.eol lf + + # Normalize ALL package-lock.json files + Get-ChildItem -Path . -Name "package-lock.json" -Recurse | ForEach-Object { + Write-Host "Normalizing line endings in: $_" + $content = Get-Content $_ -Raw + $content = $content -replace "`r`n", "`n" + Set-Content $_ -Value $content -NoNewline + } + + - name: Cache node_modules, build, extensions, and remote + uses: ./.github/actions/cache-multi-paths + - name: Install node dependencies env: npm_config_arch: x64 PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 ELECTRON_SKIP_BINARY_DOWNLOAD: 1 POSITRON_GITHUB_RO_PAT: ${{ github.token }} + npm_config_msvs_version: 2022 shell: pwsh - # nvm on windows does not see .nvmrc - # - # the installation of the npm package windows-process-tree is known to fail - # intermittently in the Github Actions build environment, so we retry - # this step a few times if necessary. - # - # see https://github.com/posit-dev/positron/issues/3481 run: | + # # Use robocopy to reliably clear node_modules directories + # if (Test-Path "node_modules") { + # Write-Host "Clearing main node_modules with robocopy..." + # $null = New-Item -ItemType Directory -Path "empty_temp" -Force + # robocopy "empty_temp" "node_modules" /mir /r:0 /w:0 | Out-Null + # Remove-Item -Path "node_modules" -Force -ErrorAction SilentlyContinue + # Remove-Item -Path "empty_temp" -Force -ErrorAction SilentlyContinue + # } + + # if (Test-Path "test/e2e/node_modules") { + # Write-Host "Clearing e2e node_modules with robocopy..." + # $null = New-Item -ItemType Directory -Path "empty_temp" -Force + # robocopy "empty_temp" "test/e2e/node_modules" /mir /r:0 /w:0 | Out-Null + # Remove-Item -Path "test/e2e/node_modules" -Force -ErrorAction SilentlyContinue + # Remove-Item -Path "empty_temp" -Force -ErrorAction SilentlyContinue + # } + + # Clear node-gyp cache + if (Test-Path "$env:USERPROFILE\AppData\Local\node-gyp") { + Remove-Item -Path "$env:USERPROFILE\AppData\Local\node-gyp" -Recurse -Force -ErrorAction SilentlyContinue + } + + # Configure npm for better performance and single-threaded builds + npm config set audit false + npm config set fund false + npm config set prefer-offline true + npm config set msvs_version 2022 + + # Force single-threaded builds + $env:JOBS = "1" + $env:MSBUILD_ARGS = "/maxcpucount:1" + .\scripts\run-with-retry.ps1 -maxAttempts 5 -command "npm clean-install --fetch-timeout 120000" npm --prefix test/e2e ci @@ -211,76 +254,76 @@ jobs: - name: Send Results to GH Summary uses: ./.github/actions/gen-report-dir - - name: Run Extensions Test - id: extensions - continue-on-error: true - shell: bash - run: | - set +e - npm run test-extension -- -l positron-r - echo "exit_code=$?" >> $GITHUB_OUTPUT - - - name: Run Bootstrap Extensions Test - id: bootstrap - shell: bash - env: - POSITRON_PY_VER_SEL: 3.10.10 - POSITRON_R_VER_SEL: 4.4.0 - POSITRON_PY_ALT_VER_SEL: 3.13.0 - POSITRON_R_ALT_VER_SEL: 4.4.2 - PWTEST_BLOB_DO_NOT_REMOVE: 1 - run: npx playwright test test/e2e/tests/extensions/bootstrap-extensions.test.ts --project "e2e-windows" --reporter=null - - - name: Run Main Test Suite (Electron) - shell: bash - env: - POSITRON_PY_VER_SEL: 3.10.10 - POSITRON_R_VER_SEL: 4.4.0 - POSITRON_PY_ALT_VER_SEL: 3.13.0 - POSITRON_R_ALT_VER_SEL: 4.4.2 - CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }} - CURRENTS_CI_BUILD_ID: ${{ github.run_id }}-${{ github.run_attempt }} - COMMIT_INFO_MESSAGE: ${{ github.event.head_commit.message }} - PWTEST_BLOB_DO_NOT_REMOVE: 1 - CURRENTS_TAG: ${{ inputs.currents_tags || 'electron/win'}} - ENABLE_CURRENTS_REPORTER: ${{ inputs.report_currents }} - CURRENTS_PROJECT_ID: ${{ vars.CURRENTS_PROJECT_ID }} - CONNECT_API_KEY: ${{ secrets.CONNECT_API_KEY }} - run: | - echo "Processing skip_tags input: '${{ inputs.skip_tags }}'" - - # Convert comma-separated skip_tags input into a pipe-separated string - SKIP_TAGS_PATTERN=$(echo "${{ inputs.skip_tags }}" | sed 's/,/|/g') - - # Build a single lookahead regex pattern - if [ -n "$SKIP_TAGS_PATTERN" ]; then - SKIP_TAGS_REGEX="(?=.*($SKIP_TAGS_PATTERN|@:web-only))" - else - SKIP_TAGS_REGEX="(?=.*(@:web-only))" - fi - - # Build the --grep-invert argument if needed - GREP_INVERT_ARG="" - if [ -n "$SKIP_TAGS_REGEX" ]; then - GREP_INVERT_ARG="--grep-invert \"$SKIP_TAGS_REGEX\"" - fi - - # Build the --grep argument only if PW_TAGS is non-empty - if [ -z "${PW_TAGS}" ]; then - GREP_ARG="" - else - GREP_ARG="--grep \"${PW_TAGS}\"" - fi - - # Log the arguments - echo "Final --grep argument: $GREP_ARG" - echo "Final --grep-invert argument: $GREP_INVERT_ARG" - - export SKIP_BOOTSTRAP=true - export SKIP_CLONE=true - # Run the Playwright test command directly using eval - echo "Running: npx playwright test --project \"e2e-windows\" --workers 2 $GREP_ARG $GREP_INVERT_ARG --repeat-each ${{ inputs.repeat_each }} --max-failures 10" - eval npx playwright test --project \"e2e-windows\" --workers 2 $GREP_ARG $GREP_INVERT_ARG --repeat-each ${{ inputs.repeat_each }} --max-failures 10 + # - name: Run Extensions Test + # id: extensions + # continue-on-error: true + # shell: bash + # run: | + # set +e + # npm run test-extension -- -l positron-r + # echo "exit_code=$?" >> $GITHUB_OUTPUT + + # - name: Run Bootstrap Extensions Test + # id: bootstrap + # shell: bash + # env: + # POSITRON_PY_VER_SEL: 3.10.10 + # POSITRON_R_VER_SEL: 4.4.0 + # POSITRON_PY_ALT_VER_SEL: 3.13.0 + # POSITRON_R_ALT_VER_SEL: 4.4.2 + # PWTEST_BLOB_DO_NOT_REMOVE: 1 + # run: npx playwright test test/e2e/tests/extensions/bootstrap-extensions.test.ts --project "e2e-windows" --reporter=null + + # - name: Run Main Test Suite (Electron) + # shell: bash + # env: + # POSITRON_PY_VER_SEL: 3.10.10 + # POSITRON_R_VER_SEL: 4.4.0 + # POSITRON_PY_ALT_VER_SEL: 3.13.0 + # POSITRON_R_ALT_VER_SEL: 4.4.2 + # CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }} + # CURRENTS_CI_BUILD_ID: ${{ github.run_id }}-${{ github.run_attempt }} + # COMMIT_INFO_MESSAGE: ${{ github.event.head_commit.message }} + # PWTEST_BLOB_DO_NOT_REMOVE: 1 + # CURRENTS_TAG: ${{ inputs.currents_tags || 'electron/win'}} + # ENABLE_CURRENTS_REPORTER: ${{ inputs.report_currents }} + # CURRENTS_PROJECT_ID: ${{ vars.CURRENTS_PROJECT_ID }} + # CONNECT_API_KEY: ${{ secrets.CONNECT_API_KEY }} + # run: | + # echo "Processing skip_tags input: '${{ inputs.skip_tags }}'" + + # # Convert comma-separated skip_tags input into a pipe-separated string + # SKIP_TAGS_PATTERN=$(echo "${{ inputs.skip_tags }}" | sed 's/,/|/g') + + # # Build a single lookahead regex pattern + # if [ -n "$SKIP_TAGS_PATTERN" ]; then + # SKIP_TAGS_REGEX="(?=.*($SKIP_TAGS_PATTERN|@:web-only))" + # else + # SKIP_TAGS_REGEX="(?=.*(@:web-only))" + # fi + + # # Build the --grep-invert argument if needed + # GREP_INVERT_ARG="" + # if [ -n "$SKIP_TAGS_REGEX" ]; then + # GREP_INVERT_ARG="--grep-invert \"$SKIP_TAGS_REGEX\"" + # fi + + # # Build the --grep argument only if PW_TAGS is non-empty + # if [ -z "${PW_TAGS}" ]; then + # GREP_ARG="" + # else + # GREP_ARG="--grep \"${PW_TAGS}\"" + # fi + + # # Log the arguments + # echo "Final --grep argument: $GREP_ARG" + # echo "Final --grep-invert argument: $GREP_INVERT_ARG" + + # export SKIP_BOOTSTRAP=true + # export SKIP_CLONE=true + # # Run the Playwright test command directly using eval + # echo "Running: npx playwright test --project \"e2e-windows\" --workers 2 $GREP_ARG $GREP_INVERT_ARG --repeat-each ${{ inputs.repeat_each }} --max-failures 10" + # eval npx playwright test --project \"e2e-windows\" --workers 2 $GREP_ARG $GREP_INVERT_ARG --repeat-each ${{ inputs.repeat_each }} --max-failures 10 - name: Upload Playwright Report to S3 if: ${{ success() || failure() }}