aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/actions/check-symbols/action.yml
blob: abefda9701aa54c61e90ba943dc1c01e92937d01 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Check symbols
description: Check debug symbols
inputs:
  install_dir:
    description: Installation directory
    required: true
  expected:
    description: Expected symbols
    required: true
runs:
  using: composite
  steps:
    - env:
        ARG_INSTALL_DIR: ${{ inputs.install_dir }}
        ARG_EXPECTED: ${{ inputs.expected }}
      run: |
        $workspace = (Get-ChildItem env:GITHUB_WORKSPACE).Value
        $install_dir = (Get-ChildItem env:ARG_INSTALL_DIR).Value
        $expected = (Get-ChildItem env:ARG_EXPECTED).Value

        $bin_dir = Join-Path $install_dir 'bin'
        $lib_dir = Join-Path $install_dir 'lib'

        $script_path = if ((Get-ChildItem env:CI_TARGET_ELF).Value) {
            Join-Path $workspace 'test' 'scripts' 'verify_symbols.sh'
        } else {
            throw "Verifying symbols for PE executables is not implemented"
        }

        ConvertFrom-Json $expected | %{
            $target = $_.target
            $type = $_.type

            switch -Exact ($type) {
                'exe' {
                    $ext = (Get-ChildItem env:CI_EXT_EXT).Value
                    $file = $target + $ext
                    $path = Join-Path $bin_dir $file
                }
                'dll' {
                    $prefix = (Get-ChildItem env:CI_DLL_PREFIX).Value
                    $ext = (Get-ChildItem env:CI_DLL_EXT).Value
                    $file = $prefix + $target + $ext
                    $path = if ((Get-ChildItem env:CI_DLL_IN_BIN).Value) {
                        Join-Path $bin_dir $file
                    } else {
                        Join-Path $lib_dir $file
                    }
                }
                default { throw "Unrecognized type: $type" }
            }

            & $script_path $path $_.symbols
        }
      shell: pwsh