Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Fix GitHub Actions service #275

Merged
merged 25 commits into from
Jun 13, 2020
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7]

steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tests/requirements.txt
- name: Test
run: |
make reinstall
make test
- name: Upload coverage reports to Codecov
run: |
codecov
env: # Or as an environment variable
super_secret: ${{ secrets.CODECOV_TOKEN }}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### `2.1.6`

- [#275](https://github.com/codecov/codecov-python/pull/275) Fix GitHub Actions implementation

### `2.1.5`

- [#273](https://github.com/codecov/codecov-python/pull/273) Implement retries on Codecov API calls
Expand Down
2 changes: 1 addition & 1 deletion codecov/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ def main(*argv, **kwargs):
# https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
query.update(
dict(
service="github",
service="github-actions",
build=os.getenv("GITHUB_RUN_ID"),
commit=os.getenv("GITHUB_SHA"),
slug=os.getenv("GITHUB_REPOSITORY"),
Expand Down
2 changes: 1 addition & 1 deletion codecov/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
__license__ = "Apache 2.0"
__title__ = "codecov"
__url__ = "https://github.com/codecov/codecov-python"
__version__ = "2.1.5"
__version__ = "2.1.6"
15 changes: 4 additions & 11 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,23 +878,16 @@ def test_ci_gitlab(self):
)
def test_ci_github(self):
self.set_env(
GITHUB_REF="master",
GITHUB_RUN_ID="1399372237",
GITHUB_REPOSITORY="owner/repo",
GITHUB_ACTION="6de813bb999760c81f96f3cf5dbdcd51cead172f",
GITHUB_SHA="d653b934ed59c1a785cc1cc79d08c9aaa4eba73b",
HOME="/",
CODECOV_TOKEN="token",
CODECOV_NAME="name",
)
self.fake_report()
res = self.run_cli()
self.assertEqual(res["query"]["service"], "github")
self.assertEqual(
res["query"]["commit"], "d653b934ed59c1a785cc1cc79d08c9aaa4eba73b"
)
self.assertEqual(res["query"]["build"], "1399372237")
self.assertEqual(res["query"]["slug"], "owner/repo")
self.assertEqual(res["query"]["service"], "github-actions")
self.assertEqual(res["query"]["commit"], os.getenv("GITHUB_SHA"))
self.assertEqual(res["query"]["build"], os.getenv("GITHUB_RUN_ID"))
self.assertEqual(res["query"]["slug"], os.getenv("GITHUB_REPOSITORY"))
self.assertEqual(res["codecov"].token, "token")
self.assertEqual(res["codecov"].name, "name")

Expand Down