Skip to content

Commit

Permalink
Record coq version info to GITHUB_STEP_SUMMARY for easier access
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGross committed Apr 14, 2024
1 parent e752f1b commit 5824db7
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 12 deletions.
1 change: 1 addition & 0 deletions etc/ci/describe-system-config-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ group coqc --config
group coqc --version
group "true | coqtop"
group etc/machine.sh
etc/ci/github-actions-record-coq-info.sh
28 changes: 16 additions & 12 deletions etc/ci/describe-system-config-win.bat
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
@echo off
if not defined in_subprocess (cmd /k set in_subprocess=y ^& %0 %*) & exit )
if not defined in_subprocess (cmd /k set in_subprocess=y ^& %0 %*) & exit

SET "SCRIPT_DIR=%~dp0"

ECHO ::group::wmic cpu get caption, deviceid, name, numberofcores, maxclockspeed, status
wmic cpu get caption, deviceid, name, numberofcores, maxclockspeed, status
wmic cpu get caption, deviceid, name, numberofcores, maxclockspeed, status &
ECHO ::endgroup::
ECHO ::group::wmic cpu list /format:list
wmic cpu list /format:list
wmic cpu list /format:list &
ECHO ::endgroup::
ECHO ::group::git config -l
%CYGWIN_ROOT%\bin\bash.exe -l -c 'git config -l'
%CYGWIN_ROOT%\bin\bash.exe -l -c 'git config -l' &
ECHO ::endgroup::
ECHO ::group::git config --global -l
%CYGWIN_ROOT%\bin\bash.exe -l -c 'git config --global -l'
%CYGWIN_ROOT%\bin\bash.exe -l -c 'git config --global -l' &
ECHO ::endgroup::
ECHO ::group::opam list
opam list
opam list &
ECHO ::endgroup::
ECHO ::group::ocamlc -config
opam exec -- ocamlc -config
opam exec -- ocamlc -config &
ECHO ::endgroup::
ECHO ::group::coqc --config
opam exec -- coqc --config
opam exec -- coqc --config &
ECHO ::endgroup::
ECHO ::group::coqc --version
opam exec -- coqc --version
opam exec -- coqc --version &
ECHO ::endgroup::
ECHO ::group::coqtop version
echo | opam exec -- coqtop
opam exec -- coqtop <nul &
ECHO ::endgroup::
ECHO ::group::make printenv
%CYGWIN_ROOT%\bin\bash.exe -l -c 'cd "%cd%"; opam exec -- make printenv'
%CYGWIN_ROOT%\bin\bash.exe -l -c 'cd "%cd%"; opam exec -- make printenv' &
ECHO ::endgroup::
ECHO ::group::PATH
%CYGWIN_ROOT%\bin\bash.exe -l -c 'cd "%cd%"; echo "${PATH}"'
%CYGWIN_ROOT%\bin\bash.exe -l -c 'cd "%cd%"; echo "${PATH}"' &
ECHO ::endgroup::

powershell -ExecutionPolicy Bypass -File "%SCRIPT_DIR%github-actions-record-coq-info.ps1"
1 change: 1 addition & 0 deletions etc/ci/describe-system-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ group "true | coqtop"
group etc/machine.sh
group "echo PATH=$PATH"
group "echo SHELL=$SHELL"
etc/ci/github-actions-record-coq-info.sh
18 changes: 18 additions & 0 deletions etc/ci/github-actions-record-coq-info.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Get the short version of coqc
$COQC_VERSION_SHORT = & opam exec -- coqc --print-version 2>$null | Select-Object -First 1

# Get the full version of coqc, replace new lines with commas, and remove trailing comma
$COQC_VERSION = & opam exec -- coqc --version 2>$null | ForEach-Object { $_ -join ',' } | ForEach-Object { $_ -replace ',$', '' }

# Run coqtop and capture both stdout and stderr
$COQTOP_VERSION = "" | & opam exec -- coqtop 2>$null

# Check if GITHUB_STEP_SUMMARY and COQC_VERSION are not empty
if (![string]::IsNullOrEmpty($env:GITHUB_STEP_SUMMARY) -and ![string]::IsNullOrEmpty($COQC_VERSION)) {
# Append details to GITHUB_STEP_SUMMARY
"<details><summary>$COQC_VERSION</summary>" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
"``````" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
$COQTOP_VERSION | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
"``````" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
"</details>" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
}
12 changes: 12 additions & 0 deletions etc/ci/github-actions-record-coq-info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

# summarize coqc version to make it easier to read
COQC_VERSION_SHORT="$(coqc --print-version 2>/dev/null | cut -d " " -f 1)"
COQC_VERSION="$(coqc --version 2>/dev/null | tr '\n' ',' | sed 's/,$//g')"
COQTOP_VERSION="$(true | coqtop 2>&1)"
if [ ! -z "$GITHUB_STEP_SUMMARY" ] && [ ! -z "$COQC_VERSION" ]; then
printf '%s\n\n' "<details><summary>${COQC_VERSION}</summary>" >> "$GITHUB_STEP_SUMMARY"
printf '%s\n' '```' >> "$GITHUB_STEP_SUMMARY"
printf '%s\n' "${COQTOP_VERSION} >> "$GITHUB_STEP_SUMMARY"
printf '%s\n%s\n' '```' '</details>' >> "$GITHUB_STEP_SUMMARY"

This comment has been minimized.

Copy link
@andres-erbsen

andres-erbsen Apr 16, 2024

Contributor
etc/ci/github-actions-record-coq-info.sh: line 11: unexpected EOF while looking for matching ``'
etc/ci/github-actions-record-coq-info.sh: line 13: syntax error: unexpected end of file

https://github.com/mit-plv/fiat-crypto/actions/runs/8694265860/job/23842795253?pr=1864

This comment has been minimized.

Copy link
@andres-erbsen

andres-erbsen Apr 16, 2024

Contributor
etc/ci/github-actions-record-coq-info.sh: line 11: unexpected EOF while looking for matching ``'

https://github.com/mit-plv/fiat-crypto/actions/runs/8694265862/job/23842795257?pr=1864

This comment has been minimized.

Copy link
@JasonGross

JasonGross Apr 16, 2024

Author Collaborator

Oops, sorry

fi

0 comments on commit 5824db7

Please sign in to comment.