actions / upload-artifact

MIT License
3.03k stars 686 forks source link

[feat req] Allow to upload coverage or linting reports in a format that can be used for badges #419

Open fhg-isi opened 12 months ago

fhg-isi commented 12 months ago

What would you like to be added?

I try to convert some GitLab pipeline jobs to create badges (see below).

image

=> How to create an artifact that includes results from a GitHub workflow and that I can reference from readme to show a badge?

Currently all artifacts seem to be wrapped in zip files, so that their content cannot be directly linked and that complicates things. I saw workarounds, where workflow data is stored in some amazon service etc.

=> What is the best practice here to reference results from workflows?

Suggestion:

Provide artifacts in a similar way GitLab does it, so that the content of the artifacts can be easily referenced.

Related:

https://github.com/actions/upload-artifact/issues/14

job_test:
  stage: test
  script:
    - pip install .[dev]
    - python -m pytest
    - mkdir ./pylint
    - python -m pylint src --output-format=text . | tee ./pylint/pylint.log || pylint-exit $?
    - PYLINT_SCORE=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' ./pylint/pylint.log)
    - anybadge --label=Pylint --file=pylint/pylint.svg --value=$PYLINT_SCORE 2=red 4=orange 8=yellow 10=green
    - echo "Pylint score is $PYLINT_SCORE"
  coverage: '/TOTAL.*\s+(\d+\%)/'
  artifacts:
    when: always
    paths:
      - ./pytest/
      - ./pylint/
      - report.xml
    reports:
      junit: report.xml
  tags:
    - asprunner

image

Why is this needed?

Reference workflow data to create badges.