-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
305 add ccache to linux build (#994)
- Loading branch information
Showing
2 changed files
with
22 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
name: "Linux Build" | ||
description: "Build the C++ library on Linux. Produces artifact build-cpp-linux-$compiler-$version-$config." | ||
inputs: | ||
#take care to adapt the unique cache keys and artifact names below when adding new inputs that affect compilation | ||
#keys also need to be adapted in the other jobs of the pipeline that use the artifacts | ||
config: | ||
description: "Configuration to build (Release or Debug, see CMAKE_BUILD_TYPE)" | ||
required: true | ||
|
@@ -21,38 +23,22 @@ inputs: | |
description: "Turn coverage on (ON or OFF, default OFF)" | ||
required: false | ||
default: "OFF" | ||
sanitize-ub: | ||
description: "Turn on UB sanitzer (ON or OFF, default OFF)" | ||
required: false | ||
default: "OFF" | ||
sanitize-addr: | ||
description: "Turn on address sanitzer (ON or OFF, default OFF)" | ||
required: false | ||
default: "OFF" | ||
build-tests: | ||
description: "Build tests" | ||
required: false | ||
default: "ON" | ||
build-benchmarks: | ||
description: "Build benchmarks" | ||
sanitizers: | ||
description: "Turn on sanitzers (ON or OFF, default OFF)" | ||
required: false | ||
default: "OFF" | ||
openmp: | ||
description: "Enable Multithreading with OpenMP (ON or OFF, default OFF). If ON, adds `-omp` to the name of the artifact." | ||
required: false | ||
default: "OFF" | ||
enable-optimization: | ||
description: "Enable optimization with Ipopt (ON or OFF, default ON)" | ||
required: false | ||
default: "ON" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install dependencies | ||
shell: bash | ||
run: | | ||
sudo apt-get -qq update | ||
sudo apt-get -qq -y install lcov | ||
sudo apt-get -qq -y install lcov ccache | ||
if [[ "${{ inputs.optional-dependencies }}" == "ON" ]]; then | ||
sudo apt-get -qq -y install libhdf5-dev | ||
fi | ||
|
@@ -71,6 +57,21 @@ runs: | |
sudo apt-get -qq -y install clang-14 | ||
fi | ||
fi | ||
- name: ccache | ||
id: ccache | ||
uses: hendrikmuhs/[email protected] | ||
with: | ||
# free total space for cache available on github is limited to 10GB, so only save on main branch; | ||
# other branches will try to use cache from main, but branches that are too old won't benefit; | ||
save: ${{ github.ref_name == 'main' }} | ||
# set enough space per build cache to keep a few previous versions to be used by older branches | ||
# debug builds require more space | ||
max-size: ${{ inputs.config == 'Release' && '200M' || '1G' }} | ||
# saves cache as `ccache-<key>-<timestamp>` (timestamp added automatically, key must be unique, github caches are never overwritten) | ||
# key should be a composite of all options that affect the compilation | ||
key: linux-${{ inputs.compiler }}-${{ inputs.version }}-${{ inputs.config }}-cov${{ inputs.coverage }}-dep${{ inputs.optional-dependencies }}-omp${{ inputs.openmp }}-san${{ inputs.sanitizers }} | ||
# load most recent cache where a prefix of the key matches a restore-key, e.g. from the most recent nightly run of the same build | ||
restore-keys: linux-${{ inputs.compiler }}-${{ inputs.version }}-${{ inputs.config }}-cov${{ inputs.coverage }}-dep${{ inputs.optional-dependencies }}-omp${{ inputs.openmp }}-san${{ inputs.sanitizers }} | ||
- name: Build | ||
shell: bash | ||
run: | | ||
|
@@ -96,7 +97,7 @@ runs: | |
exit 1 | ||
fi | ||
mkdir -p build && cd build | ||
cmake -DCMAKE_BUILD_TYPE=${{ inputs.config }} -DMEMILIO_BUILD_TESTS=${{ inputs.build-tests }} -DMEMILIO_BUILD_BENCHMARKS=${{ inputs.build-benchmarks }} -DMEMILIO_ENABLE_IPOPT=${{ inputs.enable-optimization }} -DMEMILIO_TEST_COVERAGE=${{ inputs.coverage }} -DMEMILIO_SANITIZE_ADDRESS=${{ inputs.sanitize-addr }} -DMEMILIO_SANITIZE_UNDEFINED=${{ inputs.sanitize-ub }} -DMEMILIO_USE_BUNDLED_JSONCPP=${{ inputs.optional-dependencies }} -DMEMILIO_ENABLE_OPENMP=${{ inputs.openmp }} .. | ||
cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ inputs.config }} -DMEMILIO_ENABLE_IPOPT=ON -DMEMILIO_TEST_COVERAGE=${{ inputs.coverage }} -DMEMILIO_SANITIZE_ADDRESS=${{ inputs.sanitizers }} -DMEMILIO_SANITIZE_UNDEFINED=${{ inputs.sanitizers }} -DMEMILIO_USE_BUNDLED_JSONCPP=${{ inputs.optional-dependencies }} -DMEMILIO_ENABLE_OPENMP=${{ inputs.openmp }} .. | ||
make -j4 | ||
- name: create build dir archive | ||
shell: bash | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters