aboutsummaryrefslogblamecommitdiffstatshomepage
path: root/.github/actions/check-cc/action.yml
blob: 945966f6d3fd8dadd2da33784e2c07a8fca9079d (plain) (tree)
1
2
3
4
5
6
7
8
9

                         



                                          


                  
            





















                                                                                                                                                                                     
                 
name: Check cc/c++
description: Check cc/c++
inputs:
  version:
    description: Specific version to check
    required: false
runs:
  using: composite
  steps:
    - run: |
        $version = '${{ inputs.version }}'

        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?
            $($output | Select-String -Pattern "This is free software; see the source for copying conditions." -SimpleMatch -Quiet) -or $(throw "Unexpected `$Exe --version` output")

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

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