From d37a93cd7d9e8b7ba7329e381f42e52dd0f774de Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Wed, 11 Jun 2025 19:43:42 +0200 Subject: Add code coverage --- .github/workflows/cover.yml | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/cover.yml (limited to '.github/workflows') diff --git a/.github/workflows/cover.yml b/.github/workflows/cover.yml new file mode 100644 index 000000000..c3352ec53 --- /dev/null +++ b/.github/workflows/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 -- cgit v1.2.3 From 05cba0aca5beb7e64cc1462d25fa948b6b2b7924 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Wed, 11 Jun 2025 19:53:49 +0200 Subject: Change kcov url --- .github/workflows/cover.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/cover.yml b/.github/workflows/cover.yml index c3352ec53..e456df3f2 100644 --- a/.github/workflows/cover.yml +++ b/.github/workflows/cover.yml @@ -21,7 +21,7 @@ jobs: 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 + git clone https://github.com/SimonKagstrom/kcov.git mkdir kcov/build cd kcov/build cmake .. -- cgit v1.2.3 From 3965b2e4b4dc5c30ccc081012442659ce9e60189 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Wed, 11 Jun 2025 19:58:01 +0200 Subject: kcov --version --- .github/workflows/cover.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/cover.yml b/.github/workflows/cover.yml index e456df3f2..985d6d1da 100644 --- a/.github/workflows/cover.yml +++ b/.github/workflows/cover.yml @@ -28,7 +28,7 @@ jobs: sudo make sudo make install cd ../.. - kcov + kcov --version - name: Build Odin run: ./build_odin.sh release -- cgit v1.2.3 From 921414aa74711a77cda4a24d61148d062cb5fc63 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Wed, 11 Jun 2025 20:04:07 +0200 Subject: Let's use the latest Ubuntu and a recent LLVM --- .github/workflows/cover.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/cover.yml b/.github/workflows/cover.yml index 985d6d1da..b113a9809 100644 --- a/.github/workflows/cover.yml +++ b/.github/workflows/cover.yml @@ -3,7 +3,7 @@ on: [push, pull_request, workflow_dispatch] jobs: build_linux_amd64: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest name: Linux AMD64 Test Coverage timeout-minutes: 60 steps: -- cgit v1.2.3 From 828d4c71d2b82f5786f63bdf7ac6a10fe92670ea Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Wed, 11 Jun 2025 20:33:12 +0200 Subject: Now? --- .github/workflows/cover.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/cover.yml b/.github/workflows/cover.yml index b113a9809..9d0fcfeb4 100644 --- a/.github/workflows/cover.yml +++ b/.github/workflows/cover.yml @@ -52,8 +52,9 @@ jobs: ./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 + - uses: codecov/codecov-action@v5 + with: + name: Ubuntu Coverage # optional + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true # optional (default = false + directory: kcov-out/kcov-merged \ No newline at end of file -- cgit v1.2.3