use `ccache` for Linux gcc make CI builds (#4411)

This commit is contained in:
Oliver Stöneberg 2022-09-03 21:21:24 +02:00 committed by GitHub
parent 253c764a0c
commit 070bae871a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 68 additions and 3 deletions

View File

@ -78,6 +78,8 @@ jobs:
if: matrix.image == 'centos:7' if: matrix.image == 'centos:7'
run: | run: |
yum install -y gcc-c++ make which python3 pcre-devel yum install -y gcc-c++ make which python3 pcre-devel
yum --enablerepo=extras install -y epel-release
yum install -y ccache
- name: Install missing software on ubuntu - name: Install missing software on ubuntu
if: matrix.image != 'centos:7' if: matrix.image != 'centos:7'
@ -85,12 +87,25 @@ jobs:
apt-get update apt-get update
apt-get install -y g++ make python3 libxml2-utils libpcre3-dev apt-get install -y g++ make python3 libxml2-utils libpcre3-dev
# needs to be called after the package installation since
# - it doesn't call "apt-get update"
# - it doesn't support centos
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
if: matrix.image != 'ubuntu:14.04' # no support for --set-config
with:
key: ${{ github.workflow }}-${{ matrix.image }}
- name: Build cppcheck - name: Build cppcheck
run: | run: |
# "/usr/lib64" for centos / "/usr/lib" for ubuntu
export PATH="/usr/lib64/ccache:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j$(nproc) HAVE_RULES=yes make -j$(nproc) HAVE_RULES=yes
- name: Build test - name: Build test
run: | run: |
# "/usr/lib64" for centos / "/usr/lib" for ubuntu
export PATH="/usr/lib64/ccache:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j$(nproc) testrunner HAVE_RULES=yes make -j$(nproc) testrunner HAVE_RULES=yes
- name: Run test - name: Run test

View File

@ -107,6 +107,12 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
if: contains(matrix.os, 'ubuntu')
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
# coreutils contains "nproc" # coreutils contains "nproc"
- name: Install missing software on macos - name: Install missing software on macos
if: contains(matrix.os, 'macos') if: contains(matrix.os, 'macos')
@ -115,6 +121,7 @@ jobs:
- name: Build with Unsigned char - name: Build with Unsigned char
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j$(nproc) CXXFLAGS=-funsigned-char testrunner make -j$(nproc) CXXFLAGS=-funsigned-char testrunner
- name: Test with Unsigned char - name: Test with Unsigned char
@ -133,6 +140,12 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
if: contains(matrix.os, 'ubuntu')
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
# coreutils contains "nproc" # coreutils contains "nproc"
- name: Install missing software on macos - name: Install missing software on macos
if: contains(matrix.os, 'macos') if: contains(matrix.os, 'macos')
@ -141,6 +154,7 @@ jobs:
- name: Build with TEST_MATHLIB_VALUE - name: Build with TEST_MATHLIB_VALUE
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE all make -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE all
- name: Test with TEST_MATHLIB_VALUE - name: Test with TEST_MATHLIB_VALUE
@ -194,9 +208,16 @@ jobs:
run: | run: |
brew install coreutils qt@5 brew install coreutils qt@5
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
if: contains(matrix.os, 'ubuntu')
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Build GUI on ubuntu - name: Build GUI on ubuntu
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
pushd gui pushd gui
qmake CONFIG+=debug HAVE_QCHART=yes qmake CONFIG+=debug HAVE_QCHART=yes
make -j$(nproc) make -j$(nproc)
@ -204,6 +225,7 @@ jobs:
- name: Run GUI tests on ubuntu - name: Run GUI tests on ubuntu
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
pushd gui/test/cppchecklibrarydata pushd gui/test/cppchecklibrarydata
qmake CONFIG+=debug qmake CONFIG+=debug
make -j$(nproc) make -j$(nproc)
@ -241,6 +263,7 @@ jobs:
- name: Build triage on ubuntu - name: Build triage on ubuntu
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
pushd tools/triage pushd tools/triage
qmake CONFIG+=debug qmake CONFIG+=debug
make -j$(nproc) make -j$(nproc)
@ -275,6 +298,12 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
if: contains(matrix.os, 'ubuntu')
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Install missing software on ubuntu - name: Install missing software on ubuntu
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')
run: | run: |
@ -300,10 +329,12 @@ jobs:
- name: Build cppcheck - name: Build cppcheck
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j$(nproc) HAVE_RULES=yes make -j$(nproc) HAVE_RULES=yes
- name: Build test - name: Build test
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j$(nproc) testrunner HAVE_RULES=yes make -j$(nproc) testrunner HAVE_RULES=yes
- name: Run test - name: Run test
@ -395,6 +426,11 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Install missing software on ubuntu - name: Install missing software on ubuntu
run: | run: |
sudo apt-get update sudo apt-get update
@ -402,6 +438,7 @@ jobs:
- name: Self check (build) - name: Self check (build)
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
# compile with verification and ast matchers # compile with verification and ast matchers
make -j$(nproc) -s CPPFLAGS="-DCHECK_INTERNAL" CXXFLAGS="-g -O2" MATCHCOMPILER=yes VERIFY=1 make -j$(nproc) -s CPPFLAGS="-DCHECK_INTERNAL" CXXFLAGS="-g -O2" MATCHCOMPILER=yes VERIFY=1

View File

@ -15,6 +15,11 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ runner.os }}
- name: Install missing software on ubuntu - name: Install missing software on ubuntu
run: | run: |
sudo apt-get update sudo apt-get update
@ -26,6 +31,7 @@ jobs:
- name: Compile instrumented - name: Compile instrumented
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j$(nproc) test CXXFLAGS="-g -fprofile-arcs -ftest-coverage" HAVE_RULES=yes make -j$(nproc) test CXXFLAGS="-g -fprofile-arcs -ftest-coverage" HAVE_RULES=yes
- name: Generate coverage report - name: Generate coverage report

View File

@ -19,7 +19,7 @@ jobs:
- name: ccache - name: ccache
uses: hendrikmuhs/ccache-action@v1.2 uses: hendrikmuhs/ccache-action@v1.2
with: with:
key: scriptcheck-${{ runner.os }} key: ${{ github.workflow }}-${{ runner.os }}
- name: Cache Cppcheck - name: Cache Cppcheck
uses: actions/cache@v2 uses: actions/cache@v2

View File

@ -21,7 +21,7 @@ jobs:
- name: ccache - name: ccache
uses: hendrikmuhs/ccache-action@v1.2 uses: hendrikmuhs/ccache-action@v1.2
with: with:
key: selfcheck-${{ runner.os }} key: ${{ github.workflow }}-${{ runner.os }}
- name: Cache Qt ${{ env.QT_VERSION }} - name: Cache Qt ${{ env.QT_VERSION }}
id: cache-qt id: cache-qt

View File

@ -16,6 +16,11 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ runner.os }}
- name: Prepare - name: Prepare
run: | run: |
sudo apt-get update sudo apt-get update
@ -38,10 +43,12 @@ jobs:
- name: Build cppcheck - name: Build cppcheck
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
CXXFLAGS="-O1 -g" make -j$(nproc) HAVE_RULES=yes MATCHCOMPILER=yes CXXFLAGS="-O1 -g" make -j$(nproc) HAVE_RULES=yes MATCHCOMPILER=yes
- name: Build test - name: Build test
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
CXXFLAGS="-O1 -g" make -j$(nproc) testrunner HAVE_RULES=yes MATCHCOMPILER=yes CXXFLAGS="-O1 -g" make -j$(nproc) testrunner HAVE_RULES=yes MATCHCOMPILER=yes
- name: Run valgrind - name: Run valgrind