Skip to content

Commit

Permalink
Create describe-system-config-win.ps1 (#1865)
Browse files Browse the repository at this point in the history
The batch file keeps quitting, let's try PowerShell
  • Loading branch information
JasonGross authored Apr 16, 2024
1 parent 6cb80fb commit 7fb4b21
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/coq-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
40 changes: 40 additions & 0 deletions etc/ci/describe-system-config-win.ps1
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 7fb4b21

Please sign in to comment.