Add a script to upload reports to GitHub#124
Conversation
|
The Taskcluster secrets part should be in mozilla-releng/services, as we have code there to load the secrets. |
| subprocess.run(['git', 'clone', 'https://github.com/coverage-crawler-updater/coverage-crawler-reports']) | ||
| os.chdir('coverage-crawler-reports') | ||
|
|
||
| # Remove the content of repository except of README |
There was a problem hiding this comment.
We can remove the README too, the repository will only be accessed from https://rhcu.github.io/coverage-crawler-reports/, so the README is unneeded.
coverage_crawler/github.py
Outdated
| def upload_to_github(report_path, git_user_name, git_password): | ||
| # Clone the repository if doesn't exist | ||
| if not os.path.isdir('coverage-crawler-reports'): | ||
| subprocess.run(['git', 'clone', 'https://github.com/coverage-crawler-updater/coverage-crawler-reports']) |
There was a problem hiding this comment.
We can clone the rhcu repository directly.
|
https://rhcu.github.io/coverage-crawler-reports/ The index.html will look like this. |
Looks great! |
| shutil.rmtree(f) | ||
| elif f.startswith('.') is False: | ||
| os.remove(f) | ||
| subprocess.run(['git', 'pull', 'https://github.com/rhcu/coverage-crawler-reports', 'master']) |
There was a problem hiding this comment.
Instead of cloning and pulling, we can do like we do here: https://github.com/mozilla/release-services/blob/master/src/shipit_code_coverage/shipit_code_coverage/github.py#L74 and just always overwrite the contents of the repository.
There was a problem hiding this comment.
So basically:
- create a
coverage-crawler-reportsdirectory; - chdir to ^;
- run the crawler;
- create the index file;
- your current code from
git initto the end.
You won't even need to move the reports this way, as they are created directly in the right directory.
Fixes #122
Need to add Taskcluster secrets and to clean up the code. WIll add this later.