From 189022373bae0fba56620b2e5fcee341945cfb86 Mon Sep 17 00:00:00 2001 From: Alexander Melo Date: Tue, 15 Oct 2024 11:44:41 -0400 Subject: [PATCH 1/4] step4: add smiles --- .github/workflows/api.yml | 6 ++++-- api/smiles/__init__.py | 0 api/smiles/smiles.py | 6 ++++++ api/smiles/test_smiles.py | 4 ++++ 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 api/smiles/__init__.py create mode 100644 api/smiles/smiles.py create mode 100644 api/smiles/test_smiles.py diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index b4a287f9d..f25638a03 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -13,8 +13,10 @@ jobs: python-version: '3.10' - name: Install requirements run: pip install -r api/requirements.txt - - name: Run tests and collect coverage - run: pytest --cov=api.calculator --cov-report=xml + - name: Run tests and collect coverage for calculator + run: pytest --cov=api.calculator --cov-report=xml:calculator-coverage.xml + - name: Run tests and collect coverage for smiles + run: pytest --cov=api.smiles --cov-report=xml:smiles-coverage.xml - name: Upload coverage reports to Codecov with GitHub Action uses: codecov/codecov-action@v4.2.0 env: diff --git a/api/smiles/__init__.py b/api/smiles/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/api/smiles/smiles.py b/api/smiles/smiles.py new file mode 100644 index 000000000..765cabf0e --- /dev/null +++ b/api/smiles/smiles.py @@ -0,0 +1,6 @@ +class Smiles: + def smile(self): + return ":)" + + def frown(self): + return ":(" \ No newline at end of file diff --git a/api/smiles/test_smiles.py b/api/smiles/test_smiles.py new file mode 100644 index 000000000..39e188f16 --- /dev/null +++ b/api/smiles/test_smiles.py @@ -0,0 +1,4 @@ +from .smiles import Smiles + +def test_smile(): + assert Smiles().smile() == ":)" \ No newline at end of file From 43decc9980a2f90d7a497bd71e1ab13c6238136a Mon Sep 17 00:00:00 2001 From: Alexander Melo Date: Tue, 15 Oct 2024 13:27:07 -0400 Subject: [PATCH 2/4] step4: add Codecov Component --- codecov.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/codecov.yml b/codecov.yml index 045842d23..2f53a78b8 100644 --- a/codecov.yml +++ b/codecov.yml @@ -4,3 +4,13 @@ coverage: default: target: 100% threshold: 1% + +comment: + layout: 'condensed_header, diff, flags, components' + +component_management: + individual_components: + - component_id: api + name: api + paths: + - api From 65791cb3ba9a267b783833be09c2951f53749847 Mon Sep 17 00:00:00 2001 From: Alexander Melo Date: Tue, 15 Oct 2024 13:32:10 -0400 Subject: [PATCH 3/4] step4: aggregate tests and split Component --- .github/workflows/api.yml | 26 ++++++++++++-------------- codecov.yml | 20 +++++++------------- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index f25638a03..cb9df573f 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -7,17 +7,15 @@ jobs: runs-on: ubuntu-latest name: Test python API steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v2 - with: - python-version: '3.10' - - name: Install requirements - run: pip install -r api/requirements.txt - - name: Run tests and collect coverage for calculator - run: pytest --cov=api.calculator --cov-report=xml:calculator-coverage.xml - - name: Run tests and collect coverage for smiles - run: pytest --cov=api.smiles --cov-report=xml:smiles-coverage.xml - - name: Upload coverage reports to Codecov with GitHub Action - uses: codecov/codecov-action@v4.2.0 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - uses: actions/checkout@v4 + - uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Install requirements + run: pip install -r api/requirements.txt + - name: Run tests and collect coverage + run: pytest --cov + - name: Upload coverage reports to Codecov with GitHub Action + uses: codecov/codecov-action@v4.2.0 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/codecov.yml b/codecov.yml index 2f53a78b8..e419e0eca 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,16 +1,10 @@ -coverage: - status: - project: - default: - target: 100% - threshold: 1% - -comment: - layout: 'condensed_header, diff, flags, components' - component_management: individual_components: - - component_id: api - name: api + - component_id: api-calculator # this is an identifier that should not be changed + name: calculator # this is a display name, and can be changed freely paths: - - api + - api/calculator/ + - component_id: api-smiles # this is an identifier that should not be changed + name: smiles # this is a display name, and can be changed freely + paths: + - api/smiles/ From cf9271b375a4d7e854737c70ee25d07efe6e6983 Mon Sep 17 00:00:00 2001 From: Alexander Melo Date: Fri, 3 Jan 2025 09:45:57 -0500 Subject: [PATCH 4/4] step4: add smiles --- .github/workflows/api.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index cb9df573f..3a3f3faa2 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -7,15 +7,17 @@ jobs: runs-on: ubuntu-latest name: Test python API steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v2 - with: - python-version: '3.10' - - name: Install requirements - run: pip install -r api/requirements.txt - - name: Run tests and collect coverage - run: pytest --cov - - name: Upload coverage reports to Codecov with GitHub Action - uses: codecov/codecov-action@v4.2.0 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file + - uses: actions/checkout@v4 + - uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Install requirements + run: pip install -r api/requirements.txt + - name: Run tests and collect coverage for calculator + run: pytest --cov=api.calculator --cov-report=xml:calculator-coverage.xml + - name: Run tests and collect coverage for smiles + run: pytest --cov=api.smiles --cov-report=xml:smiles-coverage.xml + - name: Upload coverage reports to Codecov with GitHub Action + uses: codecov/codecov-action@v5 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}