From 0282c2b54f79fa9063e03443369adfe1bc331eaf Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 4 May 2021 09:30:26 +0300 Subject: workflows: add run_foo.ps1, compact YAML --- .ci/run_foo.ps1 | 24 +++++++++++++++++++ .github/workflows/basic.yml | 31 +------------------------ .github/workflows/boost_clang_windows.yml | 4 ++-- .github/workflows/boost_download.yml | 7 ------ .github/workflows/ci_appveyor.yml | 35 ++++------------------------ .github/workflows/ci_github.yml | 38 ++++--------------------------- .github/workflows/ci_travis.yml | 35 ++++------------------------ 7 files changed, 39 insertions(+), 135 deletions(-) create mode 100644 .ci/run_foo.ps1 diff --git a/.ci/run_foo.ps1 b/.ci/run_foo.ps1 new file mode 100644 index 0000000..578911f --- /dev/null +++ b/.ci/run_foo.ps1 @@ -0,0 +1,24 @@ +param( + [Parameter(Mandatory=$true)] + [string] $FooPath +) + +$foo_path = [System.IO.Path]::GetFullPath($FooPath) +if ($IsWindows) { + $foo_path += '.exe' +} + +$relative = 'test.txt' +$absolute = Join-Path (Get-Location).Path $relative + +$actual = & $foo_path $relative +echo 'Actual output:' +echo $actual + +$expected = $foo_path,$absolute +echo 'Expected output:' +echo $expected + +if (Compare-Object $actual $expected -CaseSensitive) { + throw 'Unexpected output' +} diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index a5c4c6d..bfb6212 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -22,67 +22,38 @@ jobs: strategy: matrix: os: [ubuntu-18.04, windows-2016, windows-2019] - include: # Prettier run names. - {os: windows-2016, name: VS 2017} - {os: windows-2019, name: VS 2019} - {os: ubuntu-18.04, name: Ubuntu} - runs-on: '${{ matrix.os }}' - name: '${{ matrix.name }}' - defaults: run: shell: pwsh - steps: - name: Checkout uses: actions/checkout@v2 - - name: Set up Python uses: actions/setup-python@v2 with: python-version: '3.x' - - name: Cache Boost uses: actions/cache@v2 with: path: boost_*.tar.gz key: boost_1.72.0 - - name: Build Boost run: | python -m project.boost.download --cache . 1.72.0 python -m project.boost.build -- boost_1_72_0 --with-filesystem - - name: Build example project run: | $src_dir = Join-Path examples boost python -m project.cmake.build --boost boost_1_72_0 --install install -- $src_dir - - name: Run example project - run: | - $foo_path = Join-Path (Get-Location).Path install bin foo - if ('${{ runner.os }}' -eq 'Windows') { - $foo_path += '.exe' - } - - $relative = 'test.txt' - $absolute = Join-Path (Get-Location).Path $relative - - $actual = & $foo_path $relative - echo 'Actual output:' - echo $actual - - $expected = $foo_path,$absolute - echo 'Expected output:' - echo $expected - - if (Compare-Object $actual $expected -CaseSensitive) { - throw 'Unexpected output' - } + run: ./.ci/run_foo.ps1 (Join-Path (Get-Location).Path install bin foo) publish: # TODO: figure out how to add a dependency on the *toolsets workflows. diff --git a/.github/workflows/boost_clang_windows.yml b/.github/workflows/boost_clang_windows.yml index 8cb12f2..43dbe6d 100644 --- a/.github/workflows/boost_clang_windows.yml +++ b/.github/workflows/boost_clang_windows.yml @@ -17,8 +17,6 @@ on: jobs: build: - runs-on: windows-2019 - strategy: matrix: toolset: [clang, clang-cl] @@ -27,6 +25,8 @@ jobs: - {toolset: clang, b2_toolset: clang} - {toolset: clang-cl, b2_toolset: clang-win} + runs-on: windows-2019 + name: '${{ matrix.toolset }} / ${{ matrix.boost-version }}' steps: diff --git a/.github/workflows/boost_download.yml b/.github/workflows/boost_download.yml index a718f60..0cd7f94 100644 --- a/.github/workflows/boost_download.yml +++ b/.github/workflows/boost_download.yml @@ -13,29 +13,22 @@ jobs: strategy: matrix: boost-version: [1.58.0, 1.72.0] - runs-on: ubuntu-20.04 - name: 'Download / ${{ matrix.boost-version }}' - defaults: run: shell: pwsh - steps: - name: Checkout uses: actions/checkout@v2 - - name: Set up Python uses: actions/setup-python@v2 with: python-version: '3.x' - - name: Download Boost uses: ./.github/actions/download-boost with: boost-version: '${{ matrix.boost-version }}' no-retry: 1 - - name: Check that Boost was downloaded uses: ./.github/actions/check-boost-download diff --git a/.github/workflows/ci_appveyor.yml b/.github/workflows/ci_appveyor.yml index 3a53e2c..752d2d5 100644 --- a/.github/workflows/ci_appveyor.yml +++ b/.github/workflows/ci_appveyor.yml @@ -17,11 +17,11 @@ jobs: matrix: platform: [Win32, x64] configuration: [Debug, Release] - runs-on: windows-2019 - name: '${{ matrix.platform }} / ${{ matrix.configuration }}' - + defaults: + run: + shell: pwsh env: # https://www.appveyor.com/docs/environment-variables/ APPVEYOR: 'True' @@ -30,48 +30,21 @@ jobs: PLATFORM: '${{ matrix.platform }}' CONFIGURATION: '${{ matrix.configuration }}' BOOST_VERSION: 1.72.0 - - defaults: - run: - shell: pwsh - steps: - name: Checkout uses: actions/checkout@v2 - - name: Set up Python uses: actions/setup-python@v2 with: python-version: '3.x' - - name: Cache Boost uses: actions/cache@v2 with: path: '${{ github.workspace }}/examples/build/boost_*.tar.gz' key: 'boost_${{ env.BOOST_VERSION }}' - - name: Build Boost run: python -m project.ci.boost --hint AppVeyor -- --with-filesystem - - name: Build example project run: python -m project.ci.cmake --hint AppVeyor --install - - name: Run example project - run: | - cd "$env:APPVEYOR_BUILD_FOLDER/../build/install/bin" - $foo_path = Join-Path (Get-Location).Path foo.exe - - $relative = 'test.txt' - $absolute = Join-Path (Get-Location).Path $relative - - $actual = & $foo_path $relative - echo 'Actual output:' - echo $actual - - $expected = $foo_path,$absolute - echo 'Expected output:' - echo $expected - - if (Compare-Object $actual $expected -CaseSensitive) { - throw 'Unexpected output' - } + run: ./.ci/run_foo.ps1 (Join-Path $env:APPVEYOR_BUILD_FOLDER .. build install bin foo) diff --git a/.github/workflows/ci_github.yml b/.github/workflows/ci_github.yml index 53c47de..c5c6d10 100644 --- a/.github/workflows/ci_github.yml +++ b/.github/workflows/ci_github.yml @@ -19,61 +19,31 @@ jobs: - {os: ubuntu-18.04, toolset: msvc} - {os: windows-2019, toolset: gcc} - {os: windows-2019, toolset: clang} - runs-on: '${{ matrix.os }}' - name: '${{ matrix.os }} / ${{ matrix.toolset }} / ${{ matrix.configuration }}' - + defaults: + run: + shell: pwsh env: TOOLSET: '${{ matrix.toolset }}' PLATFORM: x64 CONFIGURATION: '${{ matrix.configuration }}' BOOST_VERSION: 1.72.0 - - defaults: - run: - shell: pwsh - steps: - name: Checkout uses: actions/checkout@v2 - - name: Set up Python uses: actions/setup-python@v2 with: python-version: '3.x' - - name: Cache Boost uses: actions/cache@v2 with: path: '${{ runner.workspace }}/build/boost_*.tar.gz' key: 'boost_${{ env.BOOST_VERSION }}' - - name: Build Boost run: python -m project.ci.boost -- --with-filesystem - - name: Build example project run: python -m project.ci.cmake --install --subdir examples/boost - - name: Run example project - run: | - cd "$env:GITHUB_WORKSPACE/../build/install/bin" - $foo_path = Join-Path (Get-Location).Path foo - if ('${{ runner.os }}' -eq 'Windows') { - $foo_path += '.exe' - } - - $relative = 'test.txt' - $absolute = Join-Path (Get-Location).Path $relative - - $actual = & $foo_path $relative - echo 'Actual output:' - echo $actual - - $expected = $foo_path,$absolute - echo 'Expected output:' - echo $expected - - if (Compare-Object $actual $expected -CaseSensitive) { - throw 'Unexpected output' - } + run: ./.ci/run_foo.ps1 (Join-Path $env:GITHUB_WORKSPACE .. build install bin foo) diff --git a/.github/workflows/ci_travis.yml b/.github/workflows/ci_travis.yml index 7acd8ed..801e9b1 100644 --- a/.github/workflows/ci_travis.yml +++ b/.github/workflows/ci_travis.yml @@ -16,11 +16,11 @@ jobs: strategy: matrix: configuration: [Debug, Release] - runs-on: ubuntu-18.04 - name: '${{ matrix.configuration }}' - + defaults: + run: + shell: pwsh env: # https://docs.travis-ci.com/user/environment-variables/#default-environment-variables TRAVIS: 'true' @@ -28,48 +28,21 @@ jobs: PLATFORM: x64 CONFIGURATION: '${{ matrix.configuration }}' BOOST_VERSION: 1.72.0 - - defaults: - run: - shell: pwsh - steps: - name: Checkout uses: actions/checkout@v2 - - name: Set up Python uses: actions/setup-python@v2 with: python-version: '3.x' - - name: Cache Boost uses: actions/cache@v2 with: path: '${{ github.workspace }}/examples/build/boost_*.tar.gz' key: 'boost_${{ env.BOOST_VERSION }}' - - name: Build Boost run: python -m project.ci.boost --hint Travis -- --with-filesystem - - name: Build example project run: python -m project.ci.cmake --hint Travis --install - - name: Run example project - run: | - cd "$env:TRAVIS_BUILD_DIR/../build/install/bin" - $foo_path = Join-Path (Get-Location).Path foo - - $relative = 'test.txt' - $absolute = Join-Path (Get-Location).Path $relative - - $actual = & $foo_path $relative - echo 'Actual output:' - echo $actual - - $expected = $foo_path,$absolute - echo 'Expected output:' - echo $expected - - if (Compare-Object $actual $expected -CaseSensitive) { - throw 'Unexpected output' - } + run: ./.ci/run_foo.ps1 (Join-Path $env:TRAVIS_BUILD_DIR .. build install bin foo) -- cgit v1.2.3