如何使用Github Action配置工作服? [英] How to configure Coveralls with Github Action?

查看:49
本文介绍了如何使用Github Action配置工作服?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的github回购配置遇到问题.在这里-

  • 覆盖率信息的不同之处在于,测试后笑话向我显示的内容以及工作服统计数据中显示的内容(即在工作服中其表示开发人员的首次构建率为90.072%,但根本没有这样的百分比!覆盖的行为 93.43%,平均所有内容为 89.4%)
  • 无论我尝试更改什么,盖章徽章都是未知的"
  • 我在做错什么,我应该怎么做才能解决这个问题?

    解决方案

    我也尝试了很多事情,最后,

    直接方法(不起作用):

     -名称:发布到Coveralls.io运行:cat./coverage/lcov.info./node_modules/coveralls/bin/coveralls.js 

    使用GH市场中的操作"应用程序(有效):

     -名称:发布到Coveralls.io用途:coverallsapp/github-action@v1.1.2和:github-令牌:$ {{github.token}} 

    这是上的工作方法.yml配置,希望它也会对其他人有所帮助.

    请记住,我需要介绍的场景有些棘手,我们有多个需要覆盖的覆盖范围结果,需要将它们组合起来,然后再作为单个输出结果用于Coveralls.io.

    如果有人好奇,这是我尝试过但失败的事情:

    • 使用NODE_ENV进行发布-

      运行: NODE_ENV = test cat ./coverage/lcov.info |./node_modules/coveralls/bin/coveralls.js

    • 指定确切的节点版本 11.8.0及更高版本

    • 为步骤指定 github.token,repo和env :

    • 创建单独的 Github Actions作业.

       用途:actions/setup-node @ v1和:回购令牌:$ {{github.token}}仓库:$ {{github.repository}}GITHUB_TOKEN:$ {{github.token}} 

    I'm experiencing problems with my github repo configuration. Here it is - umbress. I have Github Actions CI enabled and configured and I want to have the coverage badge in my repo so everyone who wants to use my code in their projects knows that my code is well-tested. But it seems that I missing something because my coverage badge has an "unknown" status for a long time already.

    CI steps are:

    1. Run build
    2. Run tests and generate coverage (jest --coverage --config config/jest.js). This will generate ./coverage/lcov.info in root directory
    3. Finally Coveralls GitHub Action should upload coverage to their website and display the results

    There are a few issues:

    1. When I run builds on pull requests, it says "First build" (but it's not, I've ran a lot of builds on this branch already)
    2. Coverage info is differs in what jest shows me after tests and what is displaying in Coveralls stats (i.e. in Coveralls it says FIRST BUILD ON DEVELOPER AT 90.072%, but there's no such percentage at all! Lines covered is 93.43% and everything in average is 89.4%)
    3. Coverage badge is "unknown" no matter I try to change

    What am I doing wrong and what should I do to fix this?

    解决方案

    I've tried many things as well and in the end, the usage of the coverallsapp/github-action@v1.1.2 helped! Now I can successfully publish the coverage results to coveralls.io

    Unfortunately, the straightforward approach was either leading to "Bad Response 422 - Couldn't find a repository matching this job" or "Error from lcovParse: 'Failed to parse string'".

    Straightforward approach (not working):

    - name: Publish to coveralls.io
      run: cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
    

    Using Actions app from GH marketplace (working):

    - name: Publish to coveralls.io
      uses: coverallsapp/github-action@v1.1.2
      with:
        github-token: ${{ github.token }}
    

    This is the working .yml configuration, hope it will help someone else as well.

    Keep in mind that the scenario that I needed to cover was a little bit tricky, we have multiple coverage results that needed to be combined and later on used as a single output result to coveralls.io.

    If someone is curious, here are the things that I've tried, but failed:

    • Use of NODE_ENV for publishing -

      run: NODE_ENV=test cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js

    • Specifying exact node version 11.8.0 and above

    • Specifying a github.token, repo and env for the steps:

    • Creating a separate Github Actions Job.

      uses: actions/setup-node@v1
      with:
        repo-token: ${{ github.token }}
        repository: ${{ github.repository }}
        GITHUB_TOKEN: ${{ github.token }}
      

    这篇关于如何使用Github Action配置工作服?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆