Skip to content

Commit 7fb4b21

Browse files
authored
Create describe-system-config-win.ps1 (#1865)
The batch file keeps quitting, let's try PowerShell
1 parent 6cb80fb commit 7fb4b21

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

.github/workflows/coq-windows.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ jobs:
6363

6464
- name: echo build params
6565
run: |
66-
%cd%\etc\ci\describe-system-config-win.bat
67-
shell: cmd
66+
.\etc\ci\describe-system-config-win.ps1
67+
shell: pwsh
6868
- name: deps
6969
run: |
7070
%CYGWIN_ROOT%\bin\bash.exe -l -c 'cd "%cd%"; opam exec -- etc/ci/github-actions-make.sh -j${NJOBS} deps'

etc/ci/describe-system-config-win.ps1

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Ensure this script is only running in a subprocess
2+
if (-not $env:in_subprocess) {
3+
$env:in_subprocess = "y"
4+
Start-Process PowerShell.exe -ArgumentList "-NoExit", "-File", "$PSCommandPath", "@args"
5+
exit
6+
}
7+
8+
# Set the script directory variable
9+
$SCRIPT_DIR = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
10+
11+
# Function to print groups for better readability in logs
12+
function Print-Group {
13+
param ($name, $command)
14+
Write-Host "::group::$name"
15+
& $command -ErrorAction Continue
16+
Write-Host "::endgroup::"
17+
}
18+
19+
# Using WMI to get CPU information
20+
Print-Group -name "wmic cpu get" -command { wmic cpu get caption, deviceid, name, numberofcores, maxclockspeed, status }
21+
Print-Group -name "wmic cpu list /format:list" -command { wmic cpu list /format:list }
22+
23+
# Running git configuration commands via bash
24+
$CYGWIN_ROOT = $env:CYGWIN_ROOT
25+
Print-Group -name "git config -l" -command { & "$CYGWIN_ROOT\bin\bash.exe" -l -c 'git config -l' }
26+
Print-Group -name "git config --global -l" -command { & "$CYGWIN_ROOT\bin\bash.exe" -l -c 'git config --global -l' }
27+
28+
# Using opam and OCaml tools
29+
Print-Group -name "opam list" -command { opam list }
30+
Print-Group -name "ocamlc -config" -command { opam exec -- ocamlc -config }
31+
Print-Group -name "coqc --config" -command { opam exec -- coqc --config }
32+
Print-Group -name "coqc --version" -command { opam exec -- coqc --version }
33+
Print-Group -name "coqtop version" -command { "" | opam exec -- coqtop }
34+
35+
# Using make with environmental variables
36+
Print-Group -name "make printenv" -command { & "$CYGWIN_ROOT\bin\bash.exe" -l -c 'cd "$PWD"; opam exec -- make printenv' }
37+
Print-Group -name "PATH" -command { & "$CYGWIN_ROOT\bin\bash.exe" -l -c 'cd "$PWD"; echo "${PATH}"' }
38+
39+
# Executing another PowerShell script
40+
& PowerShell.exe -ExecutionPolicy Bypass -File "$SCRIPT_DIR\github-actions-record-coq-info.ps1"

0 commit comments

Comments
 (0)