From d5dd2276822216886c292b7b7ecd4af8e755ddd0 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Thu, 8 May 2025 22:31:23 +0300 Subject: [PATCH 01/11] chore(ci): Fix codecov coverage collection within CI jobs --- .github/workflows/push.yml | 4 ++-- codecov.yml | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index d02d112ad5f57..6e6094a0b2dad 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -125,7 +125,7 @@ jobs: if: (matrix.node-version == '22.x' && matrix.transpile-worker-threads == true) with: token: ${{ secrets.CODECOV_TOKEN }} - files: ./packages/*/coverage/* + files: ./packages/*/coverage/lcov.info verbose: true flags: cube-backend fail_ci_if_error: false @@ -501,7 +501,7 @@ jobs: if: (matrix.node-version == '22.x') with: token: ${{ secrets.CODECOV_TOKEN }} - files: ./packages/*/coverage/* + files: ./packages/*/coverage/lcov.info verbose: true flags: cube-backend fail_ci_if_error: false diff --git a/codecov.yml b/codecov.yml index 40a7db8564a95..8e148eb678161 100644 --- a/codecov.yml +++ b/codecov.yml @@ -10,3 +10,7 @@ coverage: patch: default: informational: true + +github_checks: + annotations: false + From 23689cab155cce7abbf053eb67551122fccc6d8c Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 9 May 2025 11:28:44 +0300 Subject: [PATCH 02/11] fix codecov to git paths --- codecov.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/codecov.yml b/codecov.yml index 8e148eb678161..5bd9b82bcce90 100644 --- a/codecov.yml +++ b/codecov.yml @@ -14,3 +14,6 @@ coverage: github_checks: annotations: false +fixes: + - "packages/([^/]*)/src/::packages/\\1/src/" + From b60ba58e694c4f67ad71d8e71dab8cbcfd7fe1f2 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 9 May 2025 12:43:04 +0300 Subject: [PATCH 03/11] fix codecov flags --- .github/workflows/push.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 6e6094a0b2dad..6ea21054f6acd 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -127,7 +127,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: ./packages/*/coverage/lcov.info verbose: true - flags: cube-backend + flags: cube_backend fail_ci_if_error: false lint: @@ -503,7 +503,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: ./packages/*/coverage/lcov.info verbose: true - flags: cube-backend + flags: cube_backend fail_ci_if_error: false integration-smoke: From 64d5804b0d014f45818de35e4cffb34db24009cb Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 9 May 2025 13:23:23 +0300 Subject: [PATCH 04/11] another try --- .github/actions/codecov-fix.sh | 15 +++++++++++++++ .github/workflows/push.yml | 12 ++++++++++-- codecov.yml | 4 ---- 3 files changed, 25 insertions(+), 6 deletions(-) create mode 100755 .github/actions/codecov-fix.sh diff --git a/.github/actions/codecov-fix.sh b/.github/actions/codecov-fix.sh new file mode 100755 index 0000000000000..bee413d37afdf --- /dev/null +++ b/.github/actions/codecov-fix.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../" && pwd)" + +for path in "$repo_root"/packages/*/coverage/lcov.info; do + [ -f "$path" ] || continue + + pkg_dir="$(dirname "$path")" # packages/foo/coverage + pkg_root="$(dirname "$pkg_dir")" # packages/foo + tmp_path="$pkg_dir/lcov.fixed.info" + + sed "s|SF:src/|SF:packages/$(basename "$pkg_root")/src/|g" "$path" > "$tmp_path" +done diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 6ea21054f6acd..b13fc4bfaf83a 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -120,15 +120,19 @@ jobs: run: yarn build - name: Lerna test run: yarn lerna run --concurrency 1 --stream --no-prefix unit + - name: Fix lcov paths + run: | + ./.github/actions/codecov-fix.sh - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v5 if: (matrix.node-version == '22.x' && matrix.transpile-worker-threads == true) with: token: ${{ secrets.CODECOV_TOKEN }} - files: ./packages/*/coverage/lcov.info + files: ./packages/*/coverage/lcov.fixed.info verbose: true flags: cube_backend fail_ci_if_error: false + plugins: noop lint: runs-on: ubuntu-24.04 @@ -496,15 +500,19 @@ jobs: # Snowflake DRIVERS_TESTS_SNOWFLAKE_CUBEJS_DB_USER: ${{ secrets.DRIVERS_TESTS_CUBEJS_DB_SNOWFLAKE_USER }} DRIVERS_TESTS_SNOWFLAKE_CUBEJS_DB_PASS: ${{ secrets.DRIVERS_TESTS_CUBEJS_DB_SNOWFLAKE_PASS }} + - name: Fix lcov paths + run: | + ./.github/actions/codecov-fix.sh - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v5 if: (matrix.node-version == '22.x') with: token: ${{ secrets.CODECOV_TOKEN }} - files: ./packages/*/coverage/lcov.info + files: ./packages/*/coverage/lcov.fixed.info verbose: true flags: cube_backend fail_ci_if_error: false + plugins: noop integration-smoke: needs: [latest-tag-sha, build-cubestore, build-native-linux] diff --git a/codecov.yml b/codecov.yml index 5bd9b82bcce90..1d7a74c66db57 100644 --- a/codecov.yml +++ b/codecov.yml @@ -13,7 +13,3 @@ coverage: github_checks: annotations: false - -fixes: - - "packages/([^/]*)/src/::packages/\\1/src/" - From 6c28bc3be4acc139a09328a02e0233965a3b93b8 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 9 May 2025 13:48:39 +0300 Subject: [PATCH 05/11] another try --- .github/workflows/push.yml | 72 +++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 20 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index b13fc4bfaf83a..5be0c21b69dc4 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -123,16 +123,30 @@ jobs: - name: Fix lcov paths run: | ./.github/actions/codecov-fix.sh - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v5 - if: (matrix.node-version == '22.x' && matrix.transpile-worker-threads == true) - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./packages/*/coverage/lcov.fixed.info - verbose: true - flags: cube_backend - fail_ci_if_error: false - plugins: noop + - name: Debug coverage files + run: | + ls -al ./packages/*/coverage/lcov.fixed.info + cat ./packages/*/coverage/lcov.fixed.info || true + - name: Install Codecov CLI + run: | + curl -Os https://uploader.codecov.io/latest/linux/codecov + chmod +x codecov + mv codecov /usr/local/bin/ + - name: Combine all fixed LCOV files + run: | + echo "" > ./combined.lcov + for f in ./packages/*/coverage/lcov.fixed.info; do + cat "$f" >> ./combined.lcov + done + - name: Upload coverage to Codecov + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: | + codecov --token "$CODECOV_TOKEN" \ + --file ./combined.lcov \ + --flags cube_backend \ + --name "cube backend coverage" \ + --verbose lint: runs-on: ubuntu-24.04 @@ -503,16 +517,34 @@ jobs: - name: Fix lcov paths run: | ./.github/actions/codecov-fix.sh - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v5 - if: (matrix.node-version == '22.x') - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./packages/*/coverage/lcov.fixed.info - verbose: true - flags: cube_backend - fail_ci_if_error: false - plugins: noop + - name: Debug coverage files + run: | + ls -al ./packages/*/coverage/lcov.fixed.info + cat ./packages/*/coverage/lcov.fixed.info || true + - name: Debug coverage files + run: | + ls -al ./packages/*/coverage/lcov.fixed.info + cat ./packages/*/coverage/lcov.fixed.info || true + - name: Install Codecov CLI + run: | + curl -Os https://uploader.codecov.io/latest/linux/codecov + chmod +x codecov + mv codecov /usr/local/bin/ + - name: Combine all fixed LCOV files + run: | + echo "" > ./combined.lcov + for f in ./packages/*/coverage/lcov.fixed.info; do + cat "$f" >> ./combined.lcov + done + - name: Upload coverage to Codecov + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: | + codecov --token "$CODECOV_TOKEN" \ + --file ./combined.lcov \ + --flags cube_backend \ + --name "cube backend coverage" \ + --verbose integration-smoke: needs: [latest-tag-sha, build-cubestore, build-native-linux] From a3aea322a734e82b1b8bc427a1c05efb7f9e5852 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 9 May 2025 14:11:47 +0300 Subject: [PATCH 06/11] remove debug --- .github/workflows/push.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 5be0c21b69dc4..671874af0a628 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -123,10 +123,6 @@ jobs: - name: Fix lcov paths run: | ./.github/actions/codecov-fix.sh - - name: Debug coverage files - run: | - ls -al ./packages/*/coverage/lcov.fixed.info - cat ./packages/*/coverage/lcov.fixed.info || true - name: Install Codecov CLI run: | curl -Os https://uploader.codecov.io/latest/linux/codecov @@ -144,9 +140,8 @@ jobs: run: | codecov --token "$CODECOV_TOKEN" \ --file ./combined.lcov \ - --flags cube_backend \ + --flags cube-backend \ --name "cube backend coverage" \ - --verbose lint: runs-on: ubuntu-24.04 @@ -521,10 +516,6 @@ jobs: run: | ls -al ./packages/*/coverage/lcov.fixed.info cat ./packages/*/coverage/lcov.fixed.info || true - - name: Debug coverage files - run: | - ls -al ./packages/*/coverage/lcov.fixed.info - cat ./packages/*/coverage/lcov.fixed.info || true - name: Install Codecov CLI run: | curl -Os https://uploader.codecov.io/latest/linux/codecov @@ -542,9 +533,8 @@ jobs: run: | codecov --token "$CODECOV_TOKEN" \ --file ./combined.lcov \ - --flags cube_backend \ + --flags cube-backend \ --name "cube backend coverage" \ - --verbose integration-smoke: needs: [latest-tag-sha, build-cubestore, build-native-linux] From 55ac285018a2a23fa5ba8e8514ee9339c2e4059c Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 9 May 2025 16:28:22 +0300 Subject: [PATCH 07/11] another try --- .github/workflows/push.yml | 71 ++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 671874af0a628..aa3dc7894ab59 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -123,25 +123,17 @@ jobs: - name: Fix lcov paths run: | ./.github/actions/codecov-fix.sh - - name: Install Codecov CLI - run: | - curl -Os https://uploader.codecov.io/latest/linux/codecov - chmod +x codecov - mv codecov /usr/local/bin/ - name: Combine all fixed LCOV files run: | - echo "" > ./combined.lcov + echo "" > ./combined-unit.lcov for f in ./packages/*/coverage/lcov.fixed.info; do - cat "$f" >> ./combined.lcov + cat "$f" >> ./combined-unit.lcov done - - name: Upload coverage to Codecov - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: | - codecov --token "$CODECOV_TOKEN" \ - --file ./combined.lcov \ - --flags cube-backend \ - --name "cube backend coverage" \ + - name: Upload coverage artifact + uses: actions/upload-artifact@v4 + with: + name: coverage-unit + path: ./combined-unit.lcov lint: runs-on: ubuntu-24.04 @@ -512,29 +504,17 @@ jobs: - name: Fix lcov paths run: | ./.github/actions/codecov-fix.sh - - name: Debug coverage files - run: | - ls -al ./packages/*/coverage/lcov.fixed.info - cat ./packages/*/coverage/lcov.fixed.info || true - - name: Install Codecov CLI - run: | - curl -Os https://uploader.codecov.io/latest/linux/codecov - chmod +x codecov - mv codecov /usr/local/bin/ - name: Combine all fixed LCOV files run: | - echo "" > ./combined.lcov + echo "" > ./combined-integration.lcov for f in ./packages/*/coverage/lcov.fixed.info; do - cat "$f" >> ./combined.lcov + cat "$f" >> ./combined-integration.lcov done - - name: Upload coverage to Codecov - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: | - codecov --token "$CODECOV_TOKEN" \ - --file ./combined.lcov \ - --flags cube-backend \ - --name "cube backend coverage" \ + - name: Upload coverage artifact + uses: actions/upload-artifact@v4 + with: + name: coverage-integration + path: ./combined-integration.lcov integration-smoke: needs: [latest-tag-sha, build-cubestore, build-native-linux] @@ -817,3 +797,26 @@ jobs: with: name: cypress-screenshots-docker-dev-${{ matrix.name }} path: packages/cubejs-testing/cypress/screenshots + + upload-coverage: + name: Upload merged coverage to Codecov + needs: [unit, integration] + runs-on: ubuntu-latest + steps: + - name: Install Codecov CLI + run: | + curl -Os https://uploader.codecov.io/latest/linux/codecov + chmod +x codecov + - name: Download all coverage artifacts + uses: actions/download-artifact@v4 + with: + path: all-coverage + - name: Merge all coverage files + run: | + find all-coverage -name '*.lcov' -exec cat {} + > merged-coverage.info + - name: Upload merged coverage to Codecov + run: | + ./codecov --token "${{ secrets.CODECOV_TOKEN }}" \ + --file ./merged-coverage.info \ + --flags cube-backend \ + --name "cube backend coverage" From 4c0bd9be1fe96cdadbcd5e6f4192933be0b33538 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 9 May 2025 16:32:09 +0300 Subject: [PATCH 08/11] Potential fix for code scanning alert no. 416: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .github/workflows/push.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index aa3dc7894ab59..928080732d977 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -802,6 +802,9 @@ jobs: name: Upload merged coverage to Codecov needs: [unit, integration] runs-on: ubuntu-latest + permissions: + contents: read + actions: read steps: - name: Install Codecov CLI run: | From dd2a12b1e997969bf791424aaed30352ea72ab63 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 9 May 2025 17:37:07 +0300 Subject: [PATCH 09/11] fix --- .github/workflows/push.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 928080732d977..fa3d030cd2822 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -121,15 +121,18 @@ jobs: - name: Lerna test run: yarn lerna run --concurrency 1 --stream --no-prefix unit - name: Fix lcov paths + if: (matrix.node-version == '22.x' && matrix.transpile-worker-threads == true) run: | ./.github/actions/codecov-fix.sh - name: Combine all fixed LCOV files + if: (matrix.node-version == '22.x' && matrix.transpile-worker-threads == true) run: | echo "" > ./combined-unit.lcov for f in ./packages/*/coverage/lcov.fixed.info; do cat "$f" >> ./combined-unit.lcov done - name: Upload coverage artifact + if: (matrix.node-version == '22.x' && matrix.transpile-worker-threads == true) uses: actions/upload-artifact@v4 with: name: coverage-unit From 668368142082bdcd59555c715d6659207e882d4b Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 9 May 2025 18:09:22 +0300 Subject: [PATCH 10/11] fix --- .github/workflows/push.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index fa3d030cd2822..8bb968e96f877 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -509,15 +509,15 @@ jobs: ./.github/actions/codecov-fix.sh - name: Combine all fixed LCOV files run: | - echo "" > ./combined-integration.lcov + echo "" > ./combined-integration-${{ matrix.db }}.lcov for f in ./packages/*/coverage/lcov.fixed.info; do - cat "$f" >> ./combined-integration.lcov + cat "$f" >> ./combined-integration-${{ matrix.db }}.lcov done - name: Upload coverage artifact uses: actions/upload-artifact@v4 with: - name: coverage-integration - path: ./combined-integration.lcov + name: coverage-integration-${{ matrix.db }} + path: ./combined-integration-${{ matrix.db }}.lcov integration-smoke: needs: [latest-tag-sha, build-cubestore, build-native-linux] From 40b6a30e04ee697d818a5651cce129410b58cd6a Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 9 May 2025 18:39:28 +0300 Subject: [PATCH 11/11] another fix --- .github/workflows/push.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 8bb968e96f877..b1d622e22c8a3 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -128,9 +128,7 @@ jobs: if: (matrix.node-version == '22.x' && matrix.transpile-worker-threads == true) run: | echo "" > ./combined-unit.lcov - for f in ./packages/*/coverage/lcov.fixed.info; do - cat "$f" >> ./combined-unit.lcov - done + find ./packages -type f -name lcov.fixed.info -exec cat {} + >> ./combined-unit.lcov || true - name: Upload coverage artifact if: (matrix.node-version == '22.x' && matrix.transpile-worker-threads == true) uses: actions/upload-artifact@v4 @@ -510,9 +508,7 @@ jobs: - name: Combine all fixed LCOV files run: | echo "" > ./combined-integration-${{ matrix.db }}.lcov - for f in ./packages/*/coverage/lcov.fixed.info; do - cat "$f" >> ./combined-integration-${{ matrix.db }}.lcov - done + find ./packages -type f -name lcov.fixed.info -exec cat {} + >> ./combined-integration-${{ matrix.db }}.lcov || true - name: Upload coverage artifact uses: actions/upload-artifact@v4 with: