summaryrefslogtreecommitdiffstatshomepage
path: root/.github/actions/check-cc/action.yml
blob: c388819726e4dd2e84e172681fd6a3f869fa1709 (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
name: Check cc/c++
description: Check cc/c++
inputs:
  version:
    description: GCC version to grep for
    required: false
runs:
  using: composite
  steps:
    - env:
        ARG_VERSION: ${{ inputs.version }}
      run: |
        function Check-Exe {
            param(
                [Parameter(Mandatory=$true)]
                [string] $Exe
            )

            echo (Get-Command $Exe).Path
            $output = & $Exe --version
            echo $output

            # Is this really the most stable piece of `gcc --version` output?
            $pattern = "This is free software; see the source for copying conditions."
            $($output | Select-String -Pattern $pattern -SimpleMatch -Quiet) -or $(throw "Unexpected `$Exe --version` output")

            $version = $env:ARG_VERSION
            if ($version) {
                $($output | Select-String -Pattern $version -SimpleMatch -Quiet) -or $(throw "Unexpected `$Exe --version` output")
            }
        }

        Check-Exe cc
        Check-Exe c++
      shell: pwsh