-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from codecov/th/make-run-script
feat: make scripts runnable by default
- Loading branch information
Showing
11 changed files
with
126 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Workflow for Codecov wrapper | ||
on: [push, pull_request] | ||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install dependencies | ||
run: pip install -r app/requirements.txt | ||
- name: Run tests and collect coverage | ||
run: pytest --cov app ${{ env.CODECOV_ATS_TESTS }} | ||
- name: Upload coverage to Codecov | ||
run: ./run.sh | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
__pycache__/ | ||
.py[oc] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class Calculator: | ||
|
||
def add(x, y): | ||
return x + y | ||
|
||
def subtract(x, y): | ||
return x - y | ||
|
||
def multiply(x, y): | ||
return x * y | ||
|
||
def divide(x, y): | ||
if y == 0: | ||
return 'Cannot divide by 0' | ||
return x * 1.0 / y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pytest-cov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from .calculator import Calculator | ||
|
||
|
||
def test_add(): | ||
assert Calculator.add(1, 2) == 3.0 | ||
assert Calculator.add(1.0, 2.0) == 3.0 | ||
assert Calculator.add(0, 2.0) == 2.0 | ||
assert Calculator.add(2.0, 0) == 2.0 | ||
assert Calculator.add(-4, 2.0) == -2.0 | ||
|
||
def test_subtract(): | ||
assert Calculator.subtract(1, 2) == -1.0 | ||
assert Calculator.subtract(2, 1) == 1.0 | ||
assert Calculator.subtract(1.0, 2.0) == -1.0 | ||
assert Calculator.subtract(0, 2.0) == -2.0 | ||
assert Calculator.subtract(2.0, 0.0) == 2.0 | ||
assert Calculator.subtract(-4, 2.0) == -6.0 | ||
|
||
def test_multiply(): | ||
assert Calculator.multiply(1, 2) == 2.0 | ||
assert Calculator.multiply(1.0, 2.0) == 2.0 | ||
assert Calculator.multiply(0, 2.0) == 0.0 | ||
assert Calculator.multiply(2.0, 0.0) == 0.0 | ||
assert Calculator.multiply(-4, 2.0) == -8.0 | ||
|
||
def test_divide(): | ||
# assert Calculator.divide(1, 2) == 0.5 | ||
assert Calculator.divide(1.0, 2.0) == 0.5 | ||
assert Calculator.divide(0, 2.0) == 0 | ||
assert Calculator.divide(-4, 2.0) == -2.0 | ||
# assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
. ./set_defaults.sh | ||
. ./download.sh | ||
. ./validate.sh | ||
. ./upload.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
home_dir=$(bash -c "cd ~$(printf %q $USER) && pwd") | ||
CODECOV_BASH_ENV="${CODECOV_BASH_ENV:-$home_dir/.bashrc}" | ||
|
||
CODECOV_WRAPPER_VERSION="0.0.1" | ||
CODECOV_VERSION="${CODECOV_VERSION:-latest}" | ||
CODECOV_UPLOAD_NAME="${CODECOV_UPLOAD_NAME:-$CIRCLE_BUILD_NUM}" | ||
|
||
codecov_vars=( | ||
CODECOV_WRAPPER_VERSION | ||
CODECOV_VERSION | ||
) | ||
|
||
echo "Running wrapper version $CODECOV_WRAPPER_VERSION" | ||
for value in "${codecov_vars[@]}" | ||
do | ||
echo "==> \$$value=${!value}" | ||
export $value=${!value} | ||
done | ||
|
||
echo "Finishing setting env variables" | ||
echo "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters