From c300d8fcc7cbd386557e9dd2026db5011b52256d Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 13 Mar 2021 19:11:26 +0300 Subject: workflows: cache Boost downloads --- .github/actions/download-boost/action.yml | 20 ++++++++++---------- .github/workflows/basic.yml | 8 +++++++- .github/workflows/boost_clang_windows.yml | 6 ++++++ .github/workflows/boost_toolsets.yml | 6 ++++++ 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/.github/actions/download-boost/action.yml b/.github/actions/download-boost/action.yml index fc0be88..95f5793 100644 --- a/.github/actions/download-boost/action.yml +++ b/.github/actions/download-boost/action.yml @@ -11,30 +11,30 @@ runs: shell: pwsh - run: | $parent_dir = Split-Path $env:GITHUB_WORKSPACE - $unpack_dir = Join-Path $parent_dir 'boost' - echo "BOOST_UNPACK_DIR=$unpack_dir" >> $env:GITHUB_ENV + $cache_dir = Join-Path $parent_dir 'boost' + echo "BOOST_CACHE_DIR=$cache_dir" >> $env:GITHUB_ENV shell: pwsh - run: | $dir_name = "boost_$($env:BOOST_VERSION.Replace('.', '_'))" - $dir = Join-Path $env:BOOST_UNPACK_DIR $dir_name + $dir = Join-Path $env:BOOST_CACHE_DIR $dir_name echo "BOOST_DIR=$dir" >> $env:GITHUB_ENV shell: pwsh - run: | echo '' echo '----------------------------------------------------------------' - echo "BOOST_VERSION: $env:BOOST_VERSION" - echo "BOOST_UNPACK_DIR: $env:BOOST_UNPACK_DIR" - echo "BOOST_DIR: $env:BOOST_DIR" + echo "BOOST_VERSION: $env:BOOST_VERSION" + echo "BOOST_CACHE_DIR: $env:BOOST_CACHE_DIR" + echo "BOOST_DIR: $env:BOOST_DIR" echo '----------------------------------------------------------------' - New-Item $env:BOOST_UNPACK_DIR -Type Directory | Out-Null + New-Item $env:BOOST_CACHE_DIR -Force -Type Directory | Out-Null $python = 'python' - $unpack_dir = $env:BOOST_UNPACK_DIR + $cache_dir = $env:BOOST_CACHE_DIR if ($env:CI_HOST_CYGWIN) { $python = 'python3' - $unpack_dir = cygpath.exe -ua $unpack_dir + $cache_dir = cygpath.exe -ua $cache_dir } - & $python -m project.boost.download --unpack $unpack_dir -- $env:BOOST_VERSION + & $python -m project.boost.download --cache $cache_dir -- $env:BOOST_VERSION shell: pwsh diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index 6cdf983..2b29792 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -36,9 +36,15 @@ jobs: 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 1.72.0 + python -m project.boost.download --cache . 1.72.0 python -m project.boost.build -- boost_1_72_0 --with-filesystem - name: Build example project diff --git a/.github/workflows/boost_clang_windows.yml b/.github/workflows/boost_clang_windows.yml index d988269..dca79aa 100644 --- a/.github/workflows/boost_clang_windows.yml +++ b/.github/workflows/boost_clang_windows.yml @@ -34,6 +34,12 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Cache Boost + uses: actions/cache@v2 + with: + path: '${{ runner.workspace }}/boost/boost_*.tar.gz' + key: boost-${{ matrix.boost-version }} + - name: Clean up PATH uses: egor-tensin/cleanup-path@v1 if: runner.os == 'Windows' diff --git a/.github/workflows/boost_toolsets.yml b/.github/workflows/boost_toolsets.yml index 1319264..165bc47 100644 --- a/.github/workflows/boost_toolsets.yml +++ b/.github/workflows/boost_toolsets.yml @@ -110,6 +110,12 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Cache Boost + uses: actions/cache@v2 + with: + path: '${{ runner.workspace }}/boost/boost_*.tar.gz' + key: 'boost-${{ matrix.boost-version }}' + - name: Clean up PATH uses: egor-tensin/cleanup-path@v1 if: runner.os == 'Windows' -- cgit v1.2.3