use `ccache` for Linux gcc CMake CI builds (#4426)

* modernized some CMake invocations

* CI-unixish.yml: use `ccache` for Linux gcc CMake builds

* CI-unixish-docker.yml: use `ccache` for Linux gcc CMake builds

* CI-unixish-docker.yml: enabled CMake build with tests for more images

* CI-unixish-docker.yml: adjusted some step checks
This commit is contained in:
Oliver Stöneberg 2022-09-04 10:27:20 +02:00 committed by GitHub
parent 31118fdce5
commit c433f906bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 38 deletions

View File

@ -27,9 +27,11 @@ jobs:
if: matrix.image == 'centos:7' if: matrix.image == 'centos:7'
run: | run: |
yum install -y cmake gcc-c++ make pcre-devel yum install -y cmake gcc-c++ make 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: contains(matrix.image, 'ubuntu')
run: | run: |
apt-get update apt-get update
apt-get install -y cmake g++ make libxml2-utils libpcre3-dev apt-get install -y cmake g++ make libxml2-utils libpcre3-dev
@ -40,24 +42,40 @@ jobs:
run: | run: |
sudo apt-get install qt5-default sudo apt-get install qt5-default
# tests require CMake 3.4 # 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 }}
# tests require CMake 3.9 - no ccache available
- name: Test CMake build (no tests) - name: Test CMake build (no tests)
if: matrix.image != 'ubuntu:22.10' if: matrix.image == 'ubuntu:14.04'
run: | run: |
mkdir cmake.output mkdir cmake.output
cd cmake.output cd cmake.output
cmake -G "Unix Makefiles" -DHAVE_RULES=On .. cmake -G "Unix Makefiles" -DHAVE_RULES=On ..
cmake --build . -- -j$(nproc) cmake --build . -- -j$(nproc)
cd ..
# tests require CMake 3.9 - ccache available
- name: Test CMake build (no tests)
if: matrix.image == 'centos:7' || matrix.image == 'ubuntu:16:04'
run: |
mkdir cmake.output
cd cmake.output
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ..
cmake --build . -- -j$(nproc)
- name: Test CMake build - name: Test CMake build
if: matrix.image == 'ubuntu:22.10' if: matrix.image != 'centos:7' && matrix.image != 'ubuntu:14.04' && matrix.image != 'ubuntu:16.04'
run: | run: |
mkdir cmake.output mkdir cmake.output
cd cmake.output cd cmake.output
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On .. cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On ..
cmake --build . --target check -- -j$(nproc) cmake --build . --target check -- -j$(nproc)
cd ..
build_make: build_make:
@ -82,7 +100,7 @@ jobs:
yum install -y ccache yum install -y ccache
- name: Install missing software on ubuntu - name: Install missing software on ubuntu
if: matrix.image != 'centos:7' if: contains(matrix.image, 'ubuntu')
run: | run: |
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

View File

@ -20,6 +20,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: |
@ -35,11 +41,8 @@ jobs:
- name: CMake build on ubuntu (with GUI / system tinyxml2) - name: CMake build on ubuntu (with GUI / system tinyxml2)
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')
run: | run: |
mkdir cmake.output.tinyxml2 cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cd cmake.output.tinyxml2 cmake --build cmake.output.tinyxml2 -- -j$(nproc)
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off ..
cmake --build . -- -j$(nproc)
cd ..
- name: Run CMake test (system tinyxml2) - name: Run CMake test (system tinyxml2)
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')
@ -58,6 +61,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: |
@ -73,18 +82,14 @@ jobs:
- name: CMake build on ubuntu (with GUI) - name: CMake build on ubuntu (with GUI)
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')
run: | run: |
mkdir cmake.output cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
pushd cmake.output cmake --build cmake.output -- -j$(nproc)
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On ..
cmake --build . -- -j$(nproc)
- name: CMake build on macos (with GUI) - name: CMake build on macos (with GUI)
if: contains(matrix.os, 'macos') if: contains(matrix.os, 'macos')
run: | run: |
mkdir cmake.output cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5
pushd cmake.output cmake --build cmake.output -- -j$(nproc)
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5 ..
cmake --build . -- -j$(nproc)
- name: Run CMake test - name: Run CMake test
run: | run: |

View File

@ -121,10 +121,8 @@ jobs:
- name: Build GUI release (CMake) - name: Build GUI release (CMake)
if: startsWith(matrix.qt_ver, '6') && matrix.arch == 'x64' if: startsWith(matrix.qt_ver, '6') && matrix.arch == 'x64'
run: | run: |
md build || exit /b !errorlevel! cmake -S . -B build -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_QT6=On || exit /b !errorlevel!
cd build || exit /b !errorlevel! cmake --build build --target cppcheck-gui || exit /b !errorlevel!
cmake -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_QT6=On .. || exit /b !errorlevel!
cmake --build . --target cppcheck-gui || exit /b !errorlevel!
# TODO: deploy with Qt6 # TODO: deploy with Qt6
@ -135,9 +133,7 @@ jobs:
if "${{ matrix.arch }}" == "x86" ( if "${{ matrix.arch }}" == "x86" (
set ARCH=Win32 set ARCH=Win32
) )
md build || exit /b !errorlevel! cmake -S . -B build -DBUILD_TESTS=On || exit /b !errorlevel!
cd build || exit /b !errorlevel!
cmake -DBUILD_TESTS=On .. || exit /b !errorlevel!
- name: Build CLI debug configuration using MSBuild - name: Build CLI debug configuration using MSBuild
if: matrix.qt_ver == '' if: matrix.qt_ver == ''

View File

@ -28,12 +28,10 @@ jobs:
run: | run: |
wget https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.72.0.tar.gz wget https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.72.0.tar.gz
tar xzvf uncrustify-0.72.0.tar.gz && cd uncrustify-uncrustify-0.72.0 tar xzvf uncrustify-0.72.0.tar.gz && cd uncrustify-uncrustify-0.72.0
mkdir build cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cd build cmake --build build -- -j$(nproc) -s
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . -- -j$(nproc) -s
mkdir ~/uncrustify mkdir ~/uncrustify
cp uncrustify ~/uncrustify/ cd build && cp uncrustify ~/uncrustify/
- name: Uncrustify check - name: Uncrustify check
run: | run: |

View File

@ -45,9 +45,7 @@ jobs:
- name: CMake - name: CMake
run: | run: |
mkdir cmake.output cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DCMAKE_GLOBAL_AUTOGEN_TARGET=On
pushd cmake.output
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DCMAKE_GLOBAL_AUTOGEN_TARGET=On ..
- name: Generate dependencies - name: Generate dependencies
run: | run: |
@ -69,9 +67,7 @@ jobs:
# the following steps are duplicated from above since setting up the build node in a parallel step takes longer than the actual steps # the following steps are duplicated from above since setting up the build node in a parallel step takes longer than the actual steps
- name: CMake (no test) - name: CMake (no test)
run: | run: |
mkdir cmake.output.notest cmake -S . -B cmake.output.notest -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=0 -DBUILD_GUI=ON -DWITH_QCHART=ON -DCMAKE_GLOBAL_AUTOGEN_TARGET=On
pushd cmake.output.notest
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=0 -DBUILD_GUI=ON -DWITH_QCHART=ON -DCMAKE_GLOBAL_AUTOGEN_TARGET=On ..
- name: Generate dependencies (no test) - name: Generate dependencies (no test)
run: | run: |