tweaked HIP build #49
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: audit | |
on: | |
push: | |
branches: | |
- v4 | |
pull_request: | |
branches: | |
- v4 | |
jobs: | |
# run LLVM address sanitiser | |
sanitisation-test: | |
name: address sanitisation [${{ matrix.precision }}] | |
runs-on: macos-latest | |
# try all precisions without aborting | |
strategy: | |
fail-fast: false | |
matrix: | |
precision: [1, 2, 4] | |
# constants (which I cannot split overlines, GRR) | |
env: | |
build_dir: "build" | |
sanitiser_flags: -g -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address -fsanitize-address-use-after-scope | |
# perform the job | |
steps: | |
- name: Get QuEST | |
uses: actions/checkout@v4 | |
# compile QuEST using clang address sanitiser, foregoing all parallelisations | |
- name: Configure CMake to use sanitiser | |
run: > | |
cmake -B ${{ env.build_dir }} | |
-DCMAKE_CXX_COMPILER=clang++ | |
-DENABLE_TESTING=ON | |
-DENABLE_MULTITHREADING=OFF | |
-DFLOAT_PRECISION=${{ matrix.precision }} | |
-DCMAKE_CXX_FLAGS="${{ env.sanitiser_flags }}" | |
-DCMAKE_EXE_LINKER_FLAGS="${{ env.sanitiser_flags }}" | |
- name: Compile with sanitiser | |
run: cmake --build ${{ env.build_dir }} | |
# run unit tests in random order, excluding the integration tests | |
# TODO: | |
# ctest currently doesn't know of our Catch2 tags, so we | |
# are manually excluding each integration test by name | |
- name: Run unit tests with active sanitiser | |
run: ctest -j2 --output-on-failure --schedule-random -E "density evolution" | |
working-directory: ${{ env.build_dir }} | |
# run valgrind | |
memory-leak-test: | |
name: memory checks [${{ matrix.precision }}] | |
runs-on: ubuntu-latest | |
# try all precisions without aborting | |
strategy: | |
fail-fast: false | |
matrix: | |
precision: [1, 2, 4] | |
# constants (which I cannot split overlines, GRR) | |
env: | |
build_dir: "build" | |
# perform the job | |
steps: | |
- name: Get QuEST | |
uses: actions/checkout@v4 | |
# compile QuEST like normal albeit without parallelisations | |
- name: Configure CMake | |
run: > | |
cmake -B ${{ env.build_dir }} | |
-DENABLE_TESTING=ON | |
-DENABLE_MULTITHREADING=OFF | |
-DFLOAT_PRECISION=${{ matrix.precision }} | |
- name: Compile QuEST | |
run: cmake --build ${{ env.build_dir }} | |
- name: Install valgrind | |
run: sudo apt install -y valgrind | |
# make valgrind fail CI if detecting issue when running unit tests in a randomised order | |
# TODO: | |
# ctest currently doesn't know of our Catch2 tags, so we are | |
# manually excluding each integration test by name | |
- name: Run unit tests under valgrind | |
run: > | |
valgrind --leak-check=full --error-exitcode=1 | |
ctest -j2 --output-on-failure --schedule-random -E "density evolution" | |
working-directory: ${{ env.build_dir }} | |
# run lcov | |
coverage-test: | |
name: code coverage | |
# test only serial double-precision QuEST on Ubuntu | |
runs-on: ubuntu-latest | |
# constants: CI will fail if coverage less than below percent | |
# TODO: this is currently so low (1%) because we really need | |
# to run in MPI + GPU mode for reliable coverage statistics | |
env: | |
min_coverage: 1 # % | |
tracefile: "coverage.info" | |
# perform the job | |
steps: | |
- name: Get QuEST | |
uses: actions/checkout@v4 | |
# work in a build directory to reduce verbosity below | |
- run: > | |
mkdir build; | |
cd build | |
# compile QuEST and unit tests in coverage mode. We opt to use | |
# Release mode (rather than Debug) and permit e.g. inlining for | |
# performance (else the runner times out), though this could | |
# corrupt the statistics in the future (it doesn't now, strangely) | |
- name: Configure CMake | |
run: > | |
cmake -B . | |
-DCMAKE_BUILD_TYPE=Release | |
-DENABLE_TESTING=ON | |
-DENABLE_MULTITHREADING=OFF | |
-DCMAKE_CXX_FLAGS="--coverage" | |
-DCMAKE_EXE_LINKER_FLAGS="--coverage" | |
- name: Compile unit tests | |
run: make | |
# run the unit tests, saving coverage data to file | |
- name: Run unit tests | |
run: ctest -j2 --output-on-failure | |
# analyse the unit test coverage | |
- name: Setup LCOV | |
uses: hrishikesh-kadam/setup-lcov@v1 | |
- name: Run LCOV | |
run: lcov --directory . --capture --output-file ${{ env.tracefile }} --ignore-errors source | |
# remove standard-library and testing and code from coverage data | |
- name: Filter LCOV results | |
run: lcov --remove ${{ env.tracefile }} '/usr/*' '*/tests/*' '*/_deps/*' --output-file ${{ env.tracefile }} | |
# TODO: temporarily remove MPI and GPU files from coverage stats, since unused | |
- name: Remove MPI and GPU coverage | |
run: lcov --remove ${{ env.tracefile }} '*/comm/*' '*/gpu/*' --output-file ${{ env.tracefile }} | |
# touched files are correct but percentages are strangely reported wrong in preview, | |
# even though the subsequent reporting below is correct - weird! | |
- name: Preview LCOV results (percentages are wrong) | |
run: lcov --list ${{ env.tracefile }} | |
# report coverage of remaining files in the triggering PR | |
- name: Report code coverage | |
uses: zgosalvez/github-actions-report-lcov@v4 | |
with: | |
artifact-name: code-coverage-report | |
update-comment: true | |
coverage-files: ./${{ env.tracefile }} | |
minimum-coverage: ${{ env.min_coverage }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} |