diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-06-11 19:34:24 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-06-11 19:34:24 +0200 |
| commit | 7bfd70a8283f89eb149d88a8a1f8560e6b9fee27 (patch) | |
| tree | 46b10221e1adc6daebc01a13b4bbf8c6efda472e /.github | |
| parent | 4aec582a05a5df06f10345ec77df5941b7e30564 (diff) | |
Add code coverage check
Inspired by PR #4928
Diffstat (limited to '.github')
| -rw-r--r-- | .github/cover.yml | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/.github/cover.yml b/.github/cover.yml new file mode 100644 index 000000000..c3352ec53 --- /dev/null +++ b/.github/cover.yml @@ -0,0 +1,59 @@ +name: Test Coverage +on: [push, pull_request, workflow_dispatch] + +jobs: + build_linux_amd64: + runs-on: ubuntu-22.04 + name: Linux AMD64 Test Coverage + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + + - name: Download LLVM (Ubuntu) + if: matrix.os == 'ubuntu-latest' + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 20 + echo "/usr/lib/llvm-20/bin" >> $GITHUB_PATH + + - name: Install kcov + run: | + sudo apt-get update + sudo apt-get install binutils-dev build-essential cmake libssl-dev libcurl4-openssl-dev libelf-dev libstdc++-12-dev zlib1g-dev libdw-dev libiberty-dev + git clone git@github.com:SimonKagstrom/kcov.git + mkdir kcov/build + cd kcov/build + cmake .. + sudo make + sudo make install + cd ../.. + kcov + + - name: Build Odin + run: ./build_odin.sh release + + - name: Odin report + run: ./odin report + + - name: Normal Core library tests + run: | + ./odin build tests/core/normal.odin -build-mode:test -debug -file -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true -target:linux_amd64 + mkdir kcov-out + kcov --exclude-path=tests --exclude-path=/usr kcov-out ./normal.bin . + + - name: Optimized Core library tests + run: | + ./odin build tests/core/speed.odin -build-mode:test -debug -file -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true -target:linux_amd64 + kcov --exclude-path=tests --exclude-path=/usr kcov-out ./speed.bin . + + - name: Internals tests + run: | + ./odin build tests/internal -build-mode:test -debug -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true -target:linux_amd64 + kcov --exclude-path=tests --exclude-path=/usr kcov-out ./internal . + + - name: Report + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: | + bash <(curl -s https://codecov.io/bash) -s kcov-out
\ No newline at end of file |