Append token to codecov.yml instead of duplicating the file
This commit is contained in:
parent
a3bc6df950
commit
d291905825
|
@ -1,13 +0,0 @@
|
|||
# this file replaces <root>/codecov.yml when building on the main repository and PRs
|
||||
coverage:
|
||||
status:
|
||||
project: true
|
||||
patch: true
|
||||
changes: true
|
||||
|
||||
comment: off
|
||||
|
||||
codecov:
|
||||
# token from: https://codecov.io/gh/pytest-dev/pytest/settings
|
||||
# use same URL to regenerate it if needed
|
||||
token: "1eca3b1f-31a2-4fb8-a8c3-138b441b50a7"
|
|
@ -137,7 +137,7 @@ jobs:
|
|||
- name: Prepare coverage token
|
||||
if: success() && !matrix.skip_coverage && ( github.repository == 'pytest-dev/pytest' || github.event_name == 'pull_request' )
|
||||
run: |
|
||||
cp .github/codecov-upstream.yml codecov.yml
|
||||
python scripts/append_codecov_token.py
|
||||
|
||||
- name: Combine coverage
|
||||
if: success() && !matrix.skip_coverage
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# note: `.github/codecov-upstream.yml` is basically a copy of this file, please propagate
|
||||
# changes as needed
|
||||
coverage:
|
||||
status:
|
||||
project: true
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
"""
|
||||
Appends the codecov token to the 'codecov.yml' file at the root of the repository.
|
||||
|
||||
This is done by CI during PRs and builds on the pytest-dev repository so we can upload coverage, at least
|
||||
until codecov grows some native integration like it has with Travis and AppVeyor.
|
||||
|
||||
See discussion in https://github.com/pytest-dev/pytest/pull/6441 for more information.
|
||||
"""
|
||||
import os.path
|
||||
from textwrap import dedent
|
||||
|
||||
|
||||
def main():
|
||||
this_dir = os.path.dirname(__file__)
|
||||
cov_file = os.path.join(this_dir, "..", "codecov.yml")
|
||||
|
||||
assert os.path.isfile(cov_file), "{cov_file} does not exist".format(
|
||||
cov_file=cov_file
|
||||
)
|
||||
|
||||
with open(cov_file, "a") as f:
|
||||
# token from: https://codecov.io/gh/pytest-dev/pytest/settings
|
||||
# use same URL to regenerate it if needed
|
||||
text = dedent(
|
||||
"""
|
||||
codecov:
|
||||
token: "1eca3b1f-31a2-4fb8-a8c3-138b441b50a7"
|
||||
"""
|
||||
)
|
||||
f.write(text)
|
||||
|
||||
print("Token updated:", cov_file)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in New Issue