Skip to content

Commit

Permalink
test: fix code coverage (#6410)
Browse files Browse the repository at this point in the history
* Fix ci coverage

* Update the CI tasks to remove warning

* Fix coverage path

* Remove the coverage for spec-test-util

* Update the ci tasks to clear warnings

* Use latest codecov uploader

* Add codecov token

* Update the code coverage task

* Add the badge

* Remove a temp task

* Split badges to two lines

* Remove the token from the badge
  • Loading branch information
nazarhussain authored Feb 8, 2024
1 parent cb99fc4 commit c98a48a
Show file tree
Hide file tree
Showing 25 changed files with 74 additions and 132 deletions.
6 changes: 6 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@ ignore:
- "supporting-docs"
- "docker"
- ".github"

flags:
unit:
paths:
- ".*"
carryforward: true
2 changes: 1 addition & 1 deletion .github/actions/core-dump/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runs:
shell: sh

- name: Backup core dump
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: core-dump
path: /cores/*
4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-debug-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
working-directory: 'nodejs'

- name: Upload build to artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: nodejs-debug-build-${{ github.event.inputs.version }}
path: nodejs-debug-build-${{ github.event.inputs.version }}
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
runs-on: ubuntu-latest
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
echo "Deploying ref: $DEPLOY_REF"
# Checkout the correct ref being deployed
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ env.DEPLOY_REF }}

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
runs-on: buildjet-4vcpu-ubuntu-2204
needs: npm
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -49,10 +49,10 @@ jobs:
if: needs.tag.outputs.is_rc == 'true'
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Needs full depth for changelog generation
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
needs: [tag, npm]
if: needs.tag.outputs.is_rc == 'true'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: scripts/await-release.sh ${{ needs.tag.outputs.tag }} rc 900
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -55,10 +55,10 @@ jobs:
if: needs.tag.outputs.is_stable == 'true'
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Needs full depth for changelog generation
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
needs: [tag, npm]
if: needs.tag.outputs.is_stable == 'true'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: scripts/await-release.sh ${{ needs.tag.outputs.tag }} latest 900
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-sim-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:

- name: Upload debug log test files
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: debug-test-logs
path: packages/beacon-node/test-logs
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:

- name: Upload debug log test files
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: debug-test-logs
path: packages/beacon-node/test-logs
6 changes: 3 additions & 3 deletions .github/workflows/test-sim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ jobs:
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:

- name: Upload debug log test files for "packages/cli"
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: debug-test-logs-cli
path: packages/cli/test-logs
51 changes: 28 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
node: [20]
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{matrix.node}}
check-latest: true
Expand All @@ -36,7 +36,7 @@ jobs:
id: node
run: echo "v8CppApiVersion=$(node --print "process.versions.modules")" >> $GITHUB_OUTPUT
- name: Restore build
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
id: cache-build-restore
with:
path: |
Expand Down Expand Up @@ -81,15 +81,15 @@ jobs:
matrix:
node: [20]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
- name: Restore build cache
id: cache-primes-restore
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: |
node_modules
Expand Down Expand Up @@ -119,15 +119,15 @@ jobs:
matrix:
node: [20]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
- name: Restore build cache
id: cache-primes-restore
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: |
node_modules
Expand All @@ -153,8 +153,8 @@ jobs:
matrix:
node: [20]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true
Expand All @@ -165,7 +165,7 @@ jobs:

- name: Restore build cache
id: cache-primes-restore
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: |
node_modules
Expand Down Expand Up @@ -194,7 +194,12 @@ jobs:
# if: ${{ failure() && steps.unit_tests.conclusion == 'failure' }}

- name: Upload coverage data
run: yarn coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true # optional (default = false)
flags: "unit"

e2e-tests:
name: E2E Tests
Expand All @@ -206,15 +211,15 @@ jobs:
node: [20]
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{matrix.node}}
check-latest: true
cache: yarn
- name: Restore build cache
id: cache-primes-restore
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: |
node_modules
Expand All @@ -238,7 +243,7 @@ jobs:

- name: Upload debug log test for test env
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: debug-e2e-test-logs-node-${{matrix.node}}
path: test-logs/e2e-test-env
Expand All @@ -253,15 +258,15 @@ jobs:
node: [20]
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{matrix.node}}
check-latest: true
cache: yarn
- name: Restore build cache
id: cache-primes-restore
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: |
node_modules
Expand Down Expand Up @@ -290,15 +295,15 @@ jobs:
matrix:
node: [20]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{matrix.node}}
check-latest: true
cache: yarn
- name: Restore build cache
id: cache-primes-restore
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: |
node_modules
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
[![npm](https://img.shields.io/npm/v/@chainsafe/lodestar)](https://www.npmjs.com/package/@chainsafe/lodestar)
[![Docker Image Version (latest by date)](https://img.shields.io/docker/v/chainsafe/lodestar?color=blue&label=Docker&sort=semver)](https://hub.docker.com/r/chainsafe/lodestar)
[![Ethereum Consensus Spec v1.1.10](https://img.shields.io/badge/ETH%20consensus--spec-1.1.10-blue)](https://github.com/ethereum/consensus-specs/releases/tag/v1.1.10)
<br/>
![ES Version](https://img.shields.io/badge/ES-2021-yellow)
![Node Version](https://img.shields.io/badge/node-20.x-green)
[![codecov](https://codecov.io/gh/ChainSafe/lodestar/graph/badge.svg)](https://codecov.io/gh/ChainSafe/lodestar)
[![gitpoap badge](https://public-api.gitpoap.io/v1/repo/ChainSafe/lodestar/badge)](https://www.gitpoap.io/gh/ChainSafe/lodestar)

[Lodestar](https://lodestar.chainsafe.io) is a TypeScript implementation of the [Ethereum Consensus specification](https://github.com/ethereum/consensus-specs) developed by [ChainSafe Systems](https://chainsafe.io).
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"check-readme": "lerna run check-readme",
"check-types": "lerna run check-types",
"check-spelling": "pyspelling -c .pyspelling.yml -v",
"coverage": "lerna run coverage",
"docs:install": "pip install --user -r docs/requirements.txt",
"docs:build": "lerna run check-readme && lerna run docs:build && ./scripts/prepare-docs.sh",
"docs:lint": "prettier '**/*.md' --check",
Expand Down Expand Up @@ -54,7 +53,6 @@
"@typescript-eslint/parser": "6.7.2",
"@vitest/coverage-v8": "^1.2.1",
"@vitest/browser": "^1.2.1",
"codecov": "^3.8.3",
"crypto-browserify": "^3.12.0",
"electron": "^26.2.2",
"eslint": "^8.50.0",
Expand Down
1 change: 0 additions & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"build:release": "yarn clean && yarn run build",
"check-build": "node -e \"(async function() { await import('./lib/index.js') })()\"",
"check-types": "tsc",
"coverage": "codecov -F lodestar-api",
"lint": "eslint --color --ext .ts src/ test/",
"lint:fix": "yarn run lint --fix",
"test": "yarn test:unit",
Expand Down
Loading

0 comments on commit c98a48a

Please sign in to comment.