diff options
| author | Egor Tensin <egor@tensin.name> | 2026-10-19 04:48:26 +0300 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-10-19 05:23:15 +0300 |
| commit | b1bfbd3501b6521d3204b5d060f88a8f6153f945 (patch) | |
| tree | bf2d3869023e1dd20bf395d5dca52f4b6b2b4f39 /.github/actions/check-runtime-library | |
| parent | workflows/lint: add a zizmor job (diff) | |
| download | cmake-common-b1bfbd3501b6521d3204b5d060f88a8f6153f945.tar.gz cmake-common-b1bfbd3501b6521d3204b5d060f88a8f6153f945.zip | |
{actions,workflows}: fail on unset environment variables
The $env:NAME syntax fails to produce an error if $NAME is not defined,
regardless of Set-StrictMode/Set-PSDebug.
Also, while I'm at it, clean up the actions/workflows code a little bit.
Diffstat (limited to '.github/actions/check-runtime-library')
| -rw-r--r-- | .github/actions/check-runtime-library/action.yml | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/.github/actions/check-runtime-library/action.yml b/.github/actions/check-runtime-library/action.yml index be4823d..bedebb5 100644 --- a/.github/actions/check-runtime-library/action.yml +++ b/.github/actions/check-runtime-library/action.yml @@ -1,16 +1,16 @@ name: Verify runtime library linkage description: Verify runtime library linkage (static or shared) inputs: - path: + install_dir: description: Installation directory required: true runs: using: composite steps: - env: - ARG_PATH: ${{ inputs.path }} + ARG_INSTALL_DIR: ${{ inputs.install_dir }} run: | - $path = $env:ARG_PATH + $install_dir = (Get-ChildItem env:ARG_INSTALL_DIR).Value function Parse-DllLine { param( @@ -87,14 +87,14 @@ runs: ) $objdump = 'objdump' - if ($env:CI_HOST_WINDOWS) { + if ((Get-ChildItem env:CI_HOST_WINDOWS).Value) { $objdump = Get-Objdump } - if ($env:CI_TARGET_PE) { + if ((Get-ChildItem env:CI_TARGET_PE).Value) { & $objdump -x $ExePath | Parse-PeHeaders | echo } - if ($env:CI_TARGET_ELF) { + if ((Get-ChildItem env:CI_TARGET_ELF).Value) { & $objdump -x $ExePath | Parse-ElfHeaders | echo } } @@ -127,18 +127,18 @@ runs: ) $windows_forbidden = @('msvcrt.dll') - if ($env:CI_MINGW) { - if (!$env:CI_HOST_WINDOWS) { + if ((Get-ChildItem env:CI_MINGW).Value) { + if (!(Get-ChildItem env:CI_HOST_WINDOWS).Value) { $windows_forbidden = @() } } $linux_forbidden = @() - if ($env:CI_TARGET_WINDOWS) { + if ((Get-ChildItem env:CI_TARGET_WINDOWS).Value) { Do-ValidateLinkedLibraries ` -Actual $Actual ` -Forbidden $windows_forbidden - } elseif ($env:CI_TARGET_LINUX) { + } elseif ((Get-ChildItem env:CI_TARGET_LINUX).Value) { Do-ValidateLinkedLibraries ` -Actual $Actual ` -Forbidden $linux_forbidden @@ -147,7 +147,8 @@ runs: } } - $exe_path = (Join-Path $path 'bin' 'foo') + $env:CI_EXE_EXT - $libraries = Get-LinkedLibraries $exe_path + $name = 'foo' + (Get-ChildItem env:CI_EXE_EXT).Value + $path = Join-Path $install_dir 'bin' $name + $libraries = Get-LinkedLibraries $path Validate-LinkedLibraries $libraries shell: pwsh |
