Skip to content

ci: verify that the Git and Scalar executables work in Nano Server #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/nano-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Windows Nano Server tests

on: [workflow_dispatch, push]

jobs:
test-nano-server:
if: github.event.repository.fork == false || github.event_name == 'workflow_dispatch'
runs-on: windows-2022
env:
REF: ${{github.ref}}
WINDBG_DIR: "C:/Program Files (x86)/Windows Kits/10/Debuggers/x64"
IMAGE: mcr.microsoft.com/powershell:nanoserver-ltsc2022

steps:
- name: partial clone
shell: bash
run: |
# cannot use `git clone` directly, to allow for PR's refs to be fetched
git clone --no-checkout --single-branch -b ${REF#refs/heads/} --filter=blob:none --depth=1 \
https://github.com/${{github.repository}} . &&
git sparse-checkout set .github/workflows mingw64/bin &&
git checkout HEAD
- name: pull nanoserver image
shell: bash
run: docker pull $IMAGE
- name: run nano-server test
shell: bash
run: |
docker pull $IMAGE
docker run \
--user "ContainerAdministrator" \
-v "$WINDBG_DIR:C:/dbg" \
-v "$(cygpath -aw mingw64/bin):C:/test" \
-v "$(cygpath -aw .github/workflows/nano-server):C:/script" \
$IMAGE pwsh.exe C:/script/run-tests.ps1
34 changes: 34 additions & 0 deletions .github/workflows/nano-server/run-tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Each exectuable to test is run with the `version` subcommand; It is
# expected to return with exit code 0.

$executables_to_test = @(
'C:\test\git.exe',
'C:\test\scalar.exe'
)

foreach ($executable in $executables_to_test)
{
Write-Output "Now testing $($executable)"
&$executable 'version'
if ($LASTEXITCODE -ne 0) {
# If the command failed, run the debugger to find out what function or
# DLL could not be found and then exit the script with failure. The
# missing DLL or EXE will be referenced near the end of the output

# Set flag to ask the debugger to
# - show loader stub dianostics,
# - enable system critical breaks,
# - stop on exception, and
# - stop on unhandled user-mode exception
#
# For further details, see
# https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/gflags-flag-table
C:\dbg\gflags -i $executable +SLS +SCB +SOE +SUE

C:\dbg\cdb.exe -c "g" -c "q" $executable 'version'

exit 1
}
}

exit 0