Github 操作 - 如何将测试覆盖率报告上传到 codecov

时间:2021-03-24 12:03:06

标签: node.js github-actions test-coverage codecov

如何能够在 codecov 上记录测试覆盖率并显示徽章? 我的存储库是公开的,所以我通常不需要 codecov_token。但是,我确实补充说,bc 我用完了解决方案来使它工作 我已经在 codecov 仪表板上链接了存储库目标。 然而,什么也没显示。

谁能帮我解决这个问题。为什么存储库没有与 codecov 同步?

我想念什么东西?目前网上没有找到解决方案 这是我的 .yml 下面:

name: CI/CD

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [12.x]

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    - name: Set up Node.js ${{ matrix.noede-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}

  
    
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2 # Check out your repository
    - name: Install dependencies
      run: npm install
    
    - name: Install truffle
      run: npm install --save-dev truffle
    - run: yarn # Install dependencies
    - run: yarn test --coverage # Run test
    - run: bash <(curl -s https://codecov.io/bash) # Upload to Codecov
    - name: Run the tests and generate coverage report
      run: npx truffle test 

1 个答案:

答案 0 :(得分:0)

来自 Codecov 的 Tom,您可以链接到 GitHub 操作工作流程吗?