dmlc / gluon-nlp

NLP made easy
https://nlp.gluon.ai/
Apache License 2.0
2.56k stars 538 forks source link

[CI][BUGFIX] Custom Step for Uploading Code Coverage in Pull Request Event #1364

Closed barry-jin closed 3 years ago

barry-jin commented 3 years ago

Description

Get HTTP 400 response code and error message pr must match pattern ^(\d+|false|null|undefined|true)$ when uploading code coverage report for all the pull requests in GPU CI workflow.

Probably because we are using pull_request_target event to deal with PR in GPU CI workflow and GITHUB_REF always refers to refs/head rather than format refs/pull/#/merge, which means it's not possible for codecov-action to get the pr number from GITHUB_REF.

As suggested in this issue, we can customize the step for uploading code coverage in pull_request_target event.

Checklist

Essentials

Changes

Comments

cc @dmlc/gluon-nlp-team

codecov[bot] commented 3 years ago

Codecov Report

Merging #1364 into master will increase coverage by 10.95%. The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #1364       +/-   ##
===========================================
+ Coverage   70.76%   81.71%   +10.95%     
===========================================
  Files         105       52       -53     
  Lines       12504     6901     -5603     
===========================================
- Hits         8848     5639     -3209     
+ Misses       3656     1262     -2394     
Impacted Files Coverage Δ
src/gluonnlp/models/xlmr.py 58.82% <0.00%> (-29.42%) :arrow_down:
src/gluonnlp/models/__init__.py 67.74% <0.00%> (-29.04%) :arrow_down:
src/gluonnlp/models/electra.py 57.89% <0.00%> (-18.56%) :arrow_down:
src/gluonnlp/models/bart.py 70.62% <0.00%> (-15.63%) :arrow_down:
src/gluonnlp/utils/config.py 61.53% <0.00%> (-15.39%) :arrow_down:
src/gluonnlp/models/roberta.py 84.38% <0.00%> (-9.29%) :arrow_down:
src/gluonnlp/utils/misc.py 51.08% <0.00%> (-7.74%) :arrow_down:
src/gluonnlp/models/albert.py 87.80% <0.00%> (-7.67%) :arrow_down:
src/gluonnlp/models/gpt2.py 90.94% <0.00%> (-7.32%) :arrow_down:
src/gluonnlp/models/bert.py 87.67% <0.00%> (-7.20%) :arrow_down:
... and 60 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0e86648...ad13d67. Read the comment docs.

barry-jin commented 3 years ago
==> Uploading reports
    url: https://codecov.io
    query: branch=fix-codecov&commit=0e8664838be8c1a98af265bc992d766a7933f3fc&build=258144204&build_url=http%3A%2F%2Fgithub.com%2Fdmlc%2Fgluon-nlp%2Factions%2Fruns%2F258144204&name=&tag=&slug=dmlc%2Fgluon-nlp&service=github-actions&flags=&pr=refs/heads/master&job=&cmd_args=f,n,F,e
->  Pinging Codecov
https://codecov.io/upload/v4?package=bash-20200910-5a68dc2&token=secret&branch=fix-codecov&commit=0e8664838be8c1a98af265bc992d766a7933f3fc&build=258144204&build_url=http%3A%2F%2Fgithub.com%2Fdmlc%2Fgluon-nlp%2Factions%2Fruns%2F258144204&name=&tag=&slug=dmlc%2Fgluon-nlp&service=github-actions&flags=&pr=refs/heads/master&job=&cmd_args=f,n,F,e
->  Uploading to
<!DOCTYPE html>
curl: (3) Host name '<!DOCTYPE html>' contains bad letter
    X> Failed to upload

It's still the problem in the workflow in the master's branch. To take new workflow(in this pr) into effect, we will need to merge first.

leezu commented 3 years ago

Why so? Usually Github Actions will run the workflow as specified in the PR. Or is it only true for commiters of the project?

barry-jin commented 3 years ago

Why so? Usually Github Actions will run the workflow as specified in the PR. Or is it only true for commiters of the project?

Because I'm using pull_request_target, it runs in the context of base repository of the pull request, rather than in the merge commit. https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target