-
Notifications
You must be signed in to change notification settings - Fork 23
305 add ccache to linux build #994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
6dc55d9
add ccache to linux build
dabele 3ffda58
no verbose flag for ccache
dabele 424e37b
save ccache eplicitly
dabele 793e805
fix github action script
dabele 365d891
fix location of .ccache dir
dabele 5994a3c
diagnostic ccache output
dabele af43be0
only save cache on main branch
dabele 243c2cf
fix action.yml: missing shell
dabele e25a993
test save cache on this branch
dabele 51cbba2
diagnostic ref name
dabele ce5d423
fix cache condition
dabele b4ee750
fix if condition
dabele 9e84c09
try v2
dabele c6649c1
try v4
dabele b715334
dummy change for test, must be reverted
dabele b824fda
try hash of cache
dabele d28fbe5
fix hashFiles argument
dabele ca5a0bf
key keword is required
dabele 7aff548
remove diagnostics
dabele 1cace4f
exclude stats files from hash
dabele 1e0061c
no stats log in old ccache version
dabele 27bcf4a
print ccache version
dabele 2baeebb
fix exclude stats files
dabele 9853c12
dummy change for new run
dabele 7b16e28
use ccache action instead of cache action
dabele d00f93a
Merge branch 'main' into 305-ccache-in-CI
dabele 93109b4
add restore keys to ccache action
dabele 2173cb8
fix restore-keys syntax
dabele bfbbe76
diagnostic ccache log
dabele 4c8c704
fix ccache log path
dabele 471e17f
enable ccache debug
dabele 870cd3c
fix ambiguous restore key
dabele 3f8419f
increase cache size for debug builds
dabele 134ac60
fix ci syntax
dabele 886317a
remove debug output and simplify key
dabele 1bc9f09
test new cache key on development branch
dabele 3d3f0a9
revert test code for CI ccache
dabele 5c47821
add comment to update cache key when adding linux build inputs
dabele File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 }} | ||
|
dabele marked this conversation as resolved.
|
||
| # 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 }} .. | ||
|
reneSchm marked this conversation as resolved.
|
||
| make -j4 | ||
| - name: create build dir archive | ||
| shell: bash | ||
|
|
||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.