Skip to content
Merged
Show file tree
Hide file tree
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 Apr 5, 2024
3ffda58
no verbose flag for ccache
dabele Apr 6, 2024
424e37b
save ccache eplicitly
dabele Apr 6, 2024
793e805
fix github action script
dabele Apr 6, 2024
365d891
fix location of .ccache dir
dabele Apr 19, 2024
5994a3c
diagnostic ccache output
dabele Apr 19, 2024
af43be0
only save cache on main branch
dabele Apr 19, 2024
243c2cf
fix action.yml: missing shell
dabele Apr 19, 2024
e25a993
test save cache on this branch
dabele Apr 19, 2024
51cbba2
diagnostic ref name
dabele Apr 19, 2024
ce5d423
fix cache condition
dabele Apr 19, 2024
b4ee750
fix if condition
dabele Apr 19, 2024
9e84c09
try v2
dabele Apr 19, 2024
c6649c1
try v4
dabele Apr 19, 2024
b715334
dummy change for test, must be reverted
dabele Apr 19, 2024
b824fda
try hash of cache
dabele Apr 19, 2024
d28fbe5
fix hashFiles argument
dabele Apr 19, 2024
ca5a0bf
key keword is required
dabele Apr 19, 2024
7aff548
remove diagnostics
dabele Apr 19, 2024
1cace4f
exclude stats files from hash
dabele Apr 19, 2024
1e0061c
no stats log in old ccache version
dabele Apr 19, 2024
27bcf4a
print ccache version
dabele Apr 19, 2024
2baeebb
fix exclude stats files
dabele Apr 19, 2024
9853c12
dummy change for new run
dabele Apr 19, 2024
7b16e28
use ccache action instead of cache action
dabele May 17, 2024
d00f93a
Merge branch 'main' into 305-ccache-in-CI
dabele May 17, 2024
93109b4
add restore keys to ccache action
dabele May 17, 2024
2173cb8
fix restore-keys syntax
dabele May 17, 2024
bfbbe76
diagnostic ccache log
dabele May 17, 2024
4c8c704
fix ccache log path
dabele May 17, 2024
471e17f
enable ccache debug
dabele May 23, 2024
870cd3c
fix ambiguous restore key
dabele May 24, 2024
3f8419f
increase cache size for debug builds
dabele May 24, 2024
134ac60
fix ci syntax
dabele May 24, 2024
886317a
remove debug output and simplify key
dabele May 29, 2024
1bc9f09
test new cache key on development branch
dabele May 29, 2024
3d3f0a9
revert test code for CI ccache
dabele May 29, 2024
5c47821
add comment to update cache key when adding linux build inputs
dabele May 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions .github/actions/linux-build/action.yml
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
Expand All @@ -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
Expand All @@ -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' }}
Comment thread
reneSchm marked this conversation as resolved.
# 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 }}
Comment thread
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: |
Expand All @@ -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 }} ..
Comment thread
reneSchm marked this conversation as resolved.
make -j4
- name: create build dir archive
shell: bash
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ jobs:
config: ${{ matrix.config }}
version: ${{ matrix.version }}
coverage: ${{ (matrix.compiler == 'gcc' && matrix.config == 'Debug' && matrix.version == 'latest') && 'ON' || 'OFF' }} # `c && t || f` is (usually) equivalent to `c ? t : f`
sanitize-addr: ${{ (matrix.compiler == 'gcc' && matrix.config == 'Debug' && matrix.version == 'latest') && 'ON' || 'OFF' }}
sanitize-ub: ${{ (matrix.compiler == 'gcc' && matrix.config == 'Debug' && matrix.version == 'latest') && 'ON' || 'OFF' }}
sanitizers: ${{ (matrix.compiler == 'gcc' && matrix.config == 'Debug' && matrix.version == 'latest') && 'ON' || 'OFF' }}

build-cpp-gcc-no-optional-deps:
if: github.event.pull_request.draft == false
Expand Down