From d3cb00f979b52a92dd8409546de51be402060a2f Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Fri, 10 Sep 2021 13:32:40 +0200 Subject: [PATCH] gh actions: enable ccache --- .github/workflows/build-and-test-all.yml | 36 ++++++++++++++++++++++++ build-scripts/gh-actions-setup-inv | 2 +- tasks.py | 8 ++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test-all.yml b/.github/workflows/build-and-test-all.yml index 317e67a6d5..5a4e365f38 100644 --- a/.github/workflows/build-and-test-all.yml +++ b/.github/workflows/build-and-test-all.yml @@ -19,6 +19,17 @@ jobs: with: fetch-depth: 5 submodules: recursive + - name: get timestamp for cache + id: get-stamp + run: | + echo "::set-output name=stamp::$(/bin/date +%s)" + shell: bash + - name: let GitHub cache our ccache data + uses: actions/cache@v2 + with: + path: ~/.ccache + key: auth-ccache-${{ steps.get-stamp.outputs.stamp }} + restore-keys: auth-ccache- - run: build-scripts/gh-actions-setup-inv # this runs apt update+upgrade - run: inv install-clang - run: inv install-auth-build-deps @@ -29,6 +40,7 @@ jobs: - run: inv ci-auth-install-remotebackend-ruby-deps - run: inv ci-auth-run-unit-tests - run: inv ci-make-install + - run: ccache -s - name: Store the binaries uses: actions/upload-artifact@v2 # this takes 30 seconds, maybe we want to tar with: @@ -50,6 +62,17 @@ jobs: with: fetch-depth: 5 submodules: recursive + - name: get timestamp for cache + id: get-stamp + run: | + echo "::set-output name=stamp::$(/bin/date +%s)" + shell: bash + - name: let GitHub cache our ccache data + uses: actions/cache@v2 + with: + path: ~/.ccache + key: recursor-ccache-${{ steps.get-stamp.outputs.stamp }} + restore-keys: recursor-ccache- - run: ../../build-scripts/gh-actions-setup-inv # this runs apt update+upgrade - run: inv apt-fresh - run: inv install-clang @@ -60,6 +83,7 @@ jobs: # FIXME: save ccache here? - run: inv ci-rec-run-unit-tests - run: inv ci-make-install + - run: ccache -s - name: Store the binaries uses: actions/upload-artifact@v2 # this takes 30 seconds, maybe we want to tar with: @@ -85,6 +109,17 @@ jobs: with: fetch-depth: 5 submodules: recursive + - name: get timestamp for cache + id: get-stamp + run: | + echo "::set-output name=stamp::$(/bin/date +%s)" + shell: bash + - name: let GitHub cache our ccache data + uses: actions/cache@v2 + with: + path: ~/.ccache + key: dnsdist-${{ matrix.sanitizers }}-ccache-${{ steps.get-stamp.outputs.stamp }} + restore-keys: dnsdist-${{ matrix.sanitizers }}-ccache- - run: ../../build-scripts/gh-actions-setup-inv # this runs apt update+upgrade - run: inv apt-fresh - run: inv install-clang @@ -95,6 +130,7 @@ jobs: # FIXME: save ccache here? - run: inv ci-dnsdist-run-unit-tests - run: inv ci-make-install + - run: ccache -s - name: Store the binaries uses: actions/upload-artifact@v2 # this takes 30 seconds, maybe we want to tar with: diff --git a/build-scripts/gh-actions-setup-inv b/build-scripts/gh-actions-setup-inv index de9bf0c4b3..02e5a231e2 100755 --- a/build-scripts/gh-actions-setup-inv +++ b/build-scripts/gh-actions-setup-inv @@ -2,4 +2,4 @@ sudo apt-get update sudo apt-get -qq -y dist-upgrade sudo apt-get -qq -y --no-install-recommends install python3-pip -sudo pip3 install git+https://github.com/pyinvoke/invoke@faa5728a6f76199a3da1750ed952e7efee17c1da \ No newline at end of file +sudo pip3 install git+https://github.com/pyinvoke/invoke@faa5728a6f76199a3da1750ed952e7efee17c1da diff --git a/tasks.py b/tasks.py index aafa977514..e66e394bb5 100644 --- a/tasks.py +++ b/tasks.py @@ -6,6 +6,7 @@ import sys import time all_build_deps = [ + 'ccache', 'libboost-all-dev', 'libluajit-5.1-dev', 'libsodium-dev', @@ -366,3 +367,10 @@ def test_dnsdist(c): c.run('ls -al /var/agentx/master') with c.cd('regression-tests.dnsdist'): c.run('DNSDISTBIN=/opt/dnsdist/bin/dnsdist ./runtests') + +# this is run always +def setup(): + if '/usr/lib/ccache' not in os.environ['PATH']: + os.environ['PATH']='/usr/lib/ccache:'+os.environ['PATH'] + +setup() -- 2.47.2