Add bashrc and set default shell to bash in devcontainer #94
Workflow file for this run
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
name: C++ API | |
on: | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-20.04, ubuntu-22.04, ubuntu-24.04 ] | |
fail-fast: false | |
steps: | |
- name: Fetch the package's repository | |
uses: actions/checkout@v4 | |
- name: Setup CMake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: '3.18' | |
- name: Setup ccache | |
uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: ${{ secrets.CCACHE_CACHE_VERSION }}|${{ matrix.os }}-gcc-release | |
create-symlink: true | |
- name: Configure CMake | |
working-directory: ${{github.workspace}} | |
run: cmake -B build -DCMAKE_BUILD_TYPE=Release library/cpp | |
- name: Build | |
working-directory: ${{github.workspace}} | |
run: | | |
echo "::add-matcher::./.github/problem-matchers/gcc.json" | |
cmake --build build --parallel --config Release | |
echo "::remove-matcher owner=problem-matcher-gcc::" | |
test: | |
name: Test | |
needs: build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-20.04, ubuntu-22.04, ubuntu-24.04 ] | |
fail-fast: false | |
steps: | |
- name: Fetch the package's repository | |
uses: actions/checkout@v4 | |
- name: Setup CMake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: '3.18' | |
- name: Setup ccache | |
uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: ${{ secrets.CCACHE_CACHE_VERSION }}|${{ matrix.os }}-gcc-release | |
create-symlink: true | |
- name: Setup GTest | |
run: | | |
sudo apt-get update | |
sudo apt-get install -yq --no-install-recommends libgtest-dev | |
- name: Configure CMake | |
working-directory: ${{github.workspace}} | |
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=ON library/cpp | |
- name: Build tests | |
working-directory: ${{github.workspace}} | |
run: | | |
echo "::add-matcher::./.github/problem-matchers/gcc.json" | |
cmake --build build --parallel --config Release | |
echo "::remove-matcher owner=problem-matcher-gcc::" | |
- name: Run tests | |
working-directory: ${{github.workspace}} | |
run: | | |
all_tests_passed=1 | |
for f in `find build/test/src/*/test_* -executable`; do | |
$f --gtest_color=yes || all_tests_passed=0 | |
done | |
if [ $all_tests_passed -ne 1 ]; then | |
echo "Not all tests passed!" | |
exit 1 | |
fi | |
clang-tidy: | |
name: Clang tidy | |
needs: build | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Fetch the package's repository | |
uses: actions/checkout@v4 | |
- name: Setup CMake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: '3.18' | |
- name: Setup clang-tidy and system deps | |
run: | | |
sudo apt-get update | |
sudo apt-get install -q -y --no-install-recommends clang-tidy | |
# NOTE: The following deps are installed s.t. clang-tidy correctly treats them as system deps | |
sudo apt-get install -q -y --no-install-recommends libeigen3-dev libgoogle-glog-dev libboost-dev | |
- name: Configure CMake | |
working-directory: ${{github.workspace}} | |
run: cmake -B build -DCMAKE_BUILD_TYPE=Release library/cpp | |
- name: Run clang-tidy | |
working-directory: ${{github.workspace}}/build | |
run: | | |
echo "::add-matcher::./.github/problem-matchers/clang-tidy.json" | |
run-clang-tidy -quiet -header-filter="*include/wavemap/*" | |
echo "::remove-matcher owner=problem-matcher-clang-tidy::" | |
valgrind: | |
name: Valgrind memcheck | |
needs: test | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Fetch the package's repository | |
uses: actions/checkout@v4 | |
- name: Setup CMake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: '3.18' | |
- name: Setup ccache | |
uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: ${{ secrets.CCACHE_CACHE_VERSION }}|ubuntu-20.04-gcc-release | |
create-symlink: true | |
- name: Setup GTest and Valgrind | |
run: | | |
sudo apt-get update | |
sudo apt-get install -yq --no-install-recommends libgtest-dev valgrind | |
- name: Configure CMake | |
working-directory: ${{github.workspace}} | |
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=ON library/cpp | |
- name: Build tests | |
working-directory: ${{github.workspace}} | |
run: | | |
echo "::add-matcher::./.github/problem-matchers/gcc.json" | |
cmake --build build --parallel --config Release | |
echo "::remove-matcher owner=problem-matcher-gcc::" | |
- name: Check unit tests with Valgrind memcheck | |
working-directory: ${{github.workspace}} | |
run: | | |
all_tests_passed=1 | |
echo "::add-matcher::./.github/problem-matchers/valgrind.json" | |
for f in `find build/test/src/*/test_* -executable`; do | |
valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=20 --track-origins=yes --show-possibly-lost=no --errors-for-leak-kinds=definite,indirect --error-exitcode=1 --xml=yes --xml-file=valgrind-log.xml $f --gtest_color=yes || all_tests_passed=0 | |
grep -Poz '(?<=<error>)(.*\n)*.*(?=</error>)' valgrind-log.xml || true | |
done | |
echo "::remove-matcher owner=problem-matcher-valgrind::" | |
if [ $all_tests_passed -ne 1 ]; then | |
echo "Not all tests passed!" | |
exit 1 | |
fi | |
sanitize: | |
name: Sanitize ${{ matrix.sanitizer.detects }} | |
needs: test | |
runs-on: ${{ matrix.sanitizer.os }} | |
strategy: | |
matrix: | |
sanitizer: | |
- { name: UBSAN, detects: 'undefined behavior', os: ubuntu-20.04 } | |
- { name: ASAN, detects: 'addressability and leaks', os: ubuntu-20.04 } | |
- { name: TSAN, detects: 'data races and deadlocks', os: ubuntu-22.04 } | |
# NOTE: We run TSAN on Ubuntu 22.04 since it's broken on 20.04, see: | |
# https://bugs.launchpad.net/ubuntu/+source/gcc-10/+bug/2029910. | |
# NOTE: MSAN is not used for now since it also requires all deps to be | |
# instrumented (recompiled with clang and the MSan flags, LLVM's | |
# stdlib instead of GCCs,...). We therefore use Valgrind to | |
# check for uninitialized memory usage errors instead. | |
fail-fast: false | |
steps: | |
- name: Fetch the package's repository | |
uses: actions/checkout@v4 | |
- name: Setup CMake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: '3.18' | |
- name: Setup ccache | |
uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: ${{ secrets.CCACHE_CACHE_VERSION }}|${{ matrix.sanitizer.os }}-gcc-${{ matrix.sanitizer.name }} | |
create-symlink: true | |
- name: Setup GTest | |
run: | | |
sudo apt-get update | |
sudo apt-get install -yq --no-install-recommends libgtest-dev | |
- name: Configure CMake | |
working-directory: ${{github.workspace}} | |
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=ON -DUSE_${{ matrix.sanitizer.name }}=ON library/cpp | |
- name: Build tests | |
working-directory: ${{github.workspace}} | |
run: | | |
echo "::add-matcher::./.github/problem-matchers/gcc.json" | |
cmake --build build --parallel --config Release | |
echo "::remove-matcher owner=problem-matcher-gcc::" | |
- name: Check unit tests with ${{ matrix.sanitizer.name }} | |
working-directory: ${{github.workspace}} | |
env: | |
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1 | |
ASAN_OPTIONS: halt_on_error=1:detect_leaks=1:detect_stack_use_after_return=1 | |
TSAN_OPTIONS: halt_on_error=1:second_deadlock_stack=1 | |
run: | | |
all_tests_passed=1 | |
echo "::add-matcher::./.github/problem-matchers/gcc-sanitizers.json" | |
for f in `find build/test/src/*/test_* -executable`; do | |
$f --gtest_color=yes || all_tests_passed=0 | |
done | |
if [ $all_tests_passed -ne 1 ]; then | |
echo "Not all tests passed!" | |
exit 1 | |
fi | |
echo "::remove-matcher owner=problem-matcher-gcc-ubsan::" | |
echo "::remove-matcher owner=problem-matcher-gcc-asan::" | |
echo "::remove-matcher owner=problem-matcher-gcc-tsan::" |