diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-04-17 19:03:10 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-04-17 19:03:10 +0300 |
commit | 883e56d254e86f3485aee0d1ee28e0a17c5907a5 (patch) | |
tree | 7010b8b4c5585826321cf5f2f12e29568903d356 | |
parent | workflows/test: add job for different platforms/configurations (diff) | |
download | build-boost-883e56d254e86f3485aee0d1ee28e0a17c5907a5.tar.gz build-boost-883e56d254e86f3485aee0d1ee28e0a17c5907a5.zip |
workflows/test: factor out a common step
-rw-r--r-- | .github/actions/check-libraries/action.yml | 38 | ||||
-rw-r--r-- | .github/workflows/test.yml | 31 |
2 files changed, 49 insertions, 20 deletions
diff --git a/.github/actions/check-libraries/action.yml b/.github/actions/check-libraries/action.yml new file mode 100644 index 0000000..8ef7c77 --- /dev/null +++ b/.github/actions/check-libraries/action.yml @@ -0,0 +1,38 @@ +name: Check that Boost libraries were built +description: Check that Boost libraries were built +inputs: + librarydir: + description: Directory with the library files + required: true + libraries: + description: Libraries to check + required: true + toolset: + description: Toolset used + required: false + default: auto +runs: + using: composite + steps: + - run: | + New-Variable os -Value '${{ runner.os }}' -Option Constant + New-Variable windows_host -Value ($os -eq 'Windows') -Option Constant + + New-Variable librarydir -Value '${{ inputs.librarydir }}' -Option Constant + New-Variable toolset -Value '${{ inputs.toolset }}' -Option Constant + + $prefix = 'libboost_' + $ext = '.a' + if ($windows_host -and $toolset -in @('auto', 'clang', 'msvc')) { + $ext = '.lib' + } + + $expected = '${{ inputs.libraries }}' + $expected = $expected.Split(' ', [System.StringSplitOptions]::RemoveEmptyEntries) + $expected = $expected | %{"$prefix$_$ext"} + + foreach ($lib in $expected) { + $path = Join-Path $librarydir $lib + $(Test-Path $path -Type Leaf) -or $(throw "Couldn't find Boost library at: $path") + } + shell: pwsh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 80b8694..579e3d8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -68,25 +68,11 @@ jobs: libraries: filesystem program_options system - name: Check libraries - run: | - New-Variable os -Value '${{ runner.os }}' -Option Constant - New-Variable windows_host -Value ($os -eq 'Windows') -Option Constant - - New-Variable toolset -Value '${{ matrix.toolset }}' -Option Constant - New-Variable librarydir -Value '${{ steps.build.outputs.librarydir }}' -Option Constant - - $prefix = 'libboost_' - $ext = '.a' - if ($windows_host -and $toolset -in @('auto', 'clang', 'msvc')) { - $ext = '.lib' - } - - $expected = @('filesystem', 'program_options', 'system') - $expected = $expected | %{"$prefix$_$ext"} - foreach ($lib in $expected) { - $path = Join-Path $librarydir $lib - $(Test-Path $path -Type Leaf) -or $(throw "Couldn't find Boost library at: $path") - } + uses: ./.github/actions/check-libraries + with: + toolset: '${{ matrix.toolset }}' + librarydir: '${{ steps.build.outputs.librarydir }}' + libraries: filesystem program_options system different_configurations: strategy: @@ -124,7 +110,12 @@ jobs: uses: ./ with: version: 1.66.0 - toolset: auto platform: '${{ matrix.platform }}' configuration: '${{ matrix.configuration }}' libraries: filesystem program_options system + + - name: Check libraries + uses: ./.github/actions/check-libraries + with: + librarydir: '${{ steps.build.outputs.librarydir }}' + libraries: filesystem program_options system |