From 7fb4b21a62849e0755b1e29674c6979fe30f604f Mon Sep 17 00:00:00 2001 From: Jason Gross Date: Tue, 16 Apr 2024 04:15:06 -0700 Subject: [PATCH] Create describe-system-config-win.ps1 (#1865) The batch file keeps quitting, let's try PowerShell --- .github/workflows/coq-windows.yml | 4 +-- etc/ci/describe-system-config-win.ps1 | 40 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 etc/ci/describe-system-config-win.ps1 diff --git a/.github/workflows/coq-windows.yml b/.github/workflows/coq-windows.yml index 196d8d4369..d7f0df845f 100644 --- a/.github/workflows/coq-windows.yml +++ b/.github/workflows/coq-windows.yml @@ -63,8 +63,8 @@ jobs: - name: echo build params run: | - %cd%\etc\ci\describe-system-config-win.bat - shell: cmd + .\etc\ci\describe-system-config-win.ps1 + shell: pwsh - name: deps run: | %CYGWIN_ROOT%\bin\bash.exe -l -c 'cd "%cd%"; opam exec -- etc/ci/github-actions-make.sh -j${NJOBS} deps' diff --git a/etc/ci/describe-system-config-win.ps1 b/etc/ci/describe-system-config-win.ps1 new file mode 100644 index 0000000000..24ec77f21e --- /dev/null +++ b/etc/ci/describe-system-config-win.ps1 @@ -0,0 +1,40 @@ +# Ensure this script is only running in a subprocess +if (-not $env:in_subprocess) { + $env:in_subprocess = "y" + Start-Process PowerShell.exe -ArgumentList "-NoExit", "-File", "$PSCommandPath", "@args" + exit +} + +# Set the script directory variable +$SCRIPT_DIR = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition + +# Function to print groups for better readability in logs +function Print-Group { + param ($name, $command) + Write-Host "::group::$name" + & $command -ErrorAction Continue + Write-Host "::endgroup::" +} + +# Using WMI to get CPU information +Print-Group -name "wmic cpu get" -command { wmic cpu get caption, deviceid, name, numberofcores, maxclockspeed, status } +Print-Group -name "wmic cpu list /format:list" -command { wmic cpu list /format:list } + +# Running git configuration commands via bash +$CYGWIN_ROOT = $env:CYGWIN_ROOT +Print-Group -name "git config -l" -command { & "$CYGWIN_ROOT\bin\bash.exe" -l -c 'git config -l' } +Print-Group -name "git config --global -l" -command { & "$CYGWIN_ROOT\bin\bash.exe" -l -c 'git config --global -l' } + +# Using opam and OCaml tools +Print-Group -name "opam list" -command { opam list } +Print-Group -name "ocamlc -config" -command { opam exec -- ocamlc -config } +Print-Group -name "coqc --config" -command { opam exec -- coqc --config } +Print-Group -name "coqc --version" -command { opam exec -- coqc --version } +Print-Group -name "coqtop version" -command { "" | opam exec -- coqtop } + +# Using make with environmental variables +Print-Group -name "make printenv" -command { & "$CYGWIN_ROOT\bin\bash.exe" -l -c 'cd "$PWD"; opam exec -- make printenv' } +Print-Group -name "PATH" -command { & "$CYGWIN_ROOT\bin\bash.exe" -l -c 'cd "$PWD"; echo "${PATH}"' } + +# Executing another PowerShell script +& PowerShell.exe -ExecutionPolicy Bypass -File "$SCRIPT_DIR\github-actions-record-coq-info.ps1"