Skip to content

Commit

Permalink
Trying something with compiler hash on cache key backup as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerin Philip committed May 9, 2021
1 parent 1e5a536 commit 759d2c2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/native-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,28 @@ jobs:
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: Generate compiler unique hash
id: ccache_compiler_hash
shell: /bin/bash
run: |
echo "::set-output COMPILER_HASH=$(bash ${GITHUB_WORKSPACE}/scripts/ci/compiler-hash.sh)"
- name: Setup ccache environment variables
run: |
# Hash compiler content, mtime + size is modded everytime, so.
echo "CCACHE_COMPILERCHECK=${{ matrix.ccache_cmd }}" >> $GITHUB_ENV
echo "CCACHE_BASE_DIR=${{ github.workspace }}" >> $GITHUB_ENV
echo "CCACHE_DIR=${{ github.workspace }}/.ccache" >> $GITHUB_ENV
echo "CCACHE_COMPRESS=true" >> $GITHUB_ENV
echo "CCACHE_COMPRESSLEVEL=6" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=2G" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=5G" >> $GITHUB_ENV
- name: Cache-op for build-cache through ccache
uses: actions/cache@v2
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.name }}-ccache-${{ github.ref }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
key: ${{ matrix.name }}-ccache-${{ github.ref }}-${{steps.ccache_compiler_hash.outputs.compiler_hash }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
${{ matrix.name }}-ccache-${{ github.ref }}-${{ steps.ccache_compiler_hash.outputs.compiler_hash }}
${{ matrix.name }}-ccache-${{ github.ref }}-
${{ matrix.name }}-ccache-
Expand Down
4 changes: 3 additions & 1 deletion scripts/ci/compiler-hash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

COMPILER=$1

$COMPILER -march=native -E -v - </dev/null 2>&1 | grep cc1
$COMPILER -march=native -E -v - < /dev/null 2>&1 | grep cc1 \
| sha256sum | cut -c1-8

0 comments on commit 759d2c2

Please sign in to comment.