Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Fixes on COVERALLS_FLAG_NAME and COVERALLS_REPO_TOKEN for GitHub Actions #244

Merged
merged 1 commit into from Jan 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 15 additions & 6 deletions docs/usage/configuration.rst
Expand Up @@ -21,7 +21,7 @@ If you would like to override the service name (auto-discovered on most CI syste

If you are interested in merging the coverage results between multiple languages/projects, see our :ref:`multi-language <multilang>` documentation.

If coveralls-python is being run on TravisCI, it will automatically set the token for communication with coveralls.io. Otherwise, you should set the environment variable ``COVERALLS_REPO_TOKEN``, which can be found on the dashboard for your project in coveralls.io::
If coveralls-python is being run on TravisCI or on GitHub Actions, it will automatically set the token for communication with coveralls.io. Otherwise, you should set the environment variable ``COVERALLS_REPO_TOKEN``, which can be found on the dashboard for your project in coveralls.io::

COVERALLS_REPO_TOKEN=mV2Jajb8y3c6AFlcVNagHO20fiZNkXPVy coveralls

Expand Down Expand Up @@ -54,8 +54,8 @@ Sample ``.coveralls.yml`` file::
parallel: true
coveralls_host: https://coveralls.aperture.com

Github Actions Gotcha
---------------------
Github Actions support
----------------------

Coveralls natively supports jobs running on Github Actions. You can directly pass the default-provided secret GITHUB_TOKEN::

Expand All @@ -64,7 +64,12 @@ Coveralls natively supports jobs running on Github Actions. You can directly pas
run: |
coveralls

For parallel builds, you have to add a final step to let coveralls know the parallel build is finished. You also have to set COVERALLS_FLAG_NAME to something unique to the specific step, so re-runs of the same job don't keep piling up builds::
Passing a coveralls.io token via the ``COVERALLS_REPO_TOKEN`` environment variable
(or via the ``repo_token`` parameter in the config file) is not needed for
Github Actions.

For parallel builds, you have to add a final step to let coveralls.io know the
parallel build is finished::

jobs:
test:
Expand All @@ -79,14 +84,14 @@ For parallel builds, you have to add a final step to let coveralls know the para
uses: actions/checkout@v2
- name: Test
run: ./run_tests.sh ${{ matrix.test-name }}
- name: Upload Coverage
- name: Upload coverage data to coveralls.io
run: coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
COVERALLS_PARALLEL: true
coveralls:
name: Finish Coveralls
name: Indicate completion to coveralls.io
needs: test
runs-on: ubuntu-latest
container: python:3-slim
Expand All @@ -97,3 +102,7 @@ For parallel builds, you have to add a final step to let coveralls know the para
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The ``COVERALLS_FLAG_NAME`` environment variable (or the ``flag_name`` parameter
in the config file) is optional and can be used to better identify each job
on coveralls.io. It does not need to be unique across the parallel jobs.