From 118aa186946a9a79cc05372929eb44f6ce64b321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Wed, 6 Mar 2024 10:09:21 +0100 Subject: [PATCH 1/8] ADD coverage to GitAction --- .github/workflows/unit-tests.yml | 72 ++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 2ba8bcd..55c5944 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -1,32 +1,40 @@ -name: Python Tests - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - test: - name: Run Python Tests - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.11 - - - name: Install dependencies - run: pip install . - - - name: Install pytest - run: pip install pytest - - - name: Run tests - run: pytest tests/ +name: Python Tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + name: Run Python Tests and Generate Coverage + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.11 + + - name: Install dependencies + run: | + pip install . + pip install -r requirements.txt + pip install pytest-cov codecov + + - name: Run tests with coverage + run: pytest --cov=tests/ + + - name: Generate coverage report + run: codecov + + - name: Push to Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} From 88874df7faf01bf4bd5069aa62d5f552a63ad569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Wed, 6 Mar 2024 10:10:56 +0100 Subject: [PATCH 2/8] Update .github/workflows/unit-tests.yml --- .github/workflows/unit-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 55c5944..d5ed52c 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -25,7 +25,6 @@ jobs: - name: Install dependencies run: | pip install . - pip install -r requirements.txt pip install pytest-cov codecov - name: Run tests with coverage From 2d8a990f4f0ad96cb33d5d9e8a971a701fee8d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Mon, 18 Mar 2024 11:45:23 +0100 Subject: [PATCH 3/8] Update unit-tests.yml --- .github/workflows/unit-tests.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index d5ed52c..8729885 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -1,4 +1,4 @@ -name: Python Tests +name: Python Tests & Coverage on: push: @@ -25,15 +25,18 @@ jobs: - name: Install dependencies run: | pip install . - pip install pytest-cov codecov + pip install pytest coverage - name: Run tests with coverage - run: pytest --cov=tests/ + run: | + coverage run -m pytest - name: Generate coverage report - run: codecov + run: | + coverage lcov -o coverage/lcov.info - - name: Push to Coveralls - uses: coverallsapp/github-action@master + - name: Upload coverage to Coveralls + uses: coverallsapp/github-action@v2.1.1 with: github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: coverage/lcov.info From 46db543bae9a58bf7a4c600c07a433626d4aa4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Mon, 18 Mar 2024 11:53:01 +0100 Subject: [PATCH 4/8] FIX gitaction --- .github/workflows/{unit-tests.yml => unittest-and-coverage.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{unit-tests.yml => unittest-and-coverage.yml} (100%) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unittest-and-coverage.yml similarity index 100% rename from .github/workflows/unit-tests.yml rename to .github/workflows/unittest-and-coverage.yml From bf64e2404d3c52aa8c85037aec0411bbbdf3656d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Mon, 18 Mar 2024 11:55:49 +0100 Subject: [PATCH 5/8] FIX ommit pyjexl from coverage --- .github/workflows/unittest-and-coverage.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unittest-and-coverage.yml b/.github/workflows/unittest-and-coverage.yml index 8729885..63c284b 100644 --- a/.github/workflows/unittest-and-coverage.yml +++ b/.github/workflows/unittest-and-coverage.yml @@ -28,8 +28,9 @@ jobs: pip install pytest coverage - name: Run tests with coverage + # pyjexl code is omit as it doesn't belong to us run: | - coverage run -m pytest + coverage run --omit=tcjexl/pyjexl/ -m pytest - name: Generate coverage report run: | From df3808232d5125b0ab519537d2f796bb5d544886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Mon, 18 Mar 2024 12:01:44 +0100 Subject: [PATCH 6/8] FIX final fixes --- .gitignore | 3 +++ README.md | 2 ++ 2 files changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 2dc53ca..194df1b 100644 --- a/.gitignore +++ b/.gitignore @@ -158,3 +158,6 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. .idea/ + +# Additional ones manually added +coverage diff --git a/README.md b/README.md index fa44562..9a1e2e4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # tcjexl +[![Coverage Status](https://coveralls.io/repos/github/telefonicasc/tcjexl/badge.svg)](https://coveralls.io/github/telefonicasc/tcjexl) + This is a wrapper of the [pyjexl](https://pypi.org/project/pyjexl/) library, including a set of default transformations (detailed in [this section](#included-transformations)) Current version of the tcjexl library embeds the pyjexl code (as in [0.3.0 release](https://files.pythonhosted.org/packages/ab/1d/757ac4c9ae2da97cbb2c844fb70395990b5bbacccff5c0297ceefd670c62/pyjexl-0.3.0.tar.gz)) in order to apply some fixes. Ideally, the fix should be applied on the upstream library (in this sense, ve have created [this PR](https://github.com/mozilla/pyjexl/pull/30)) but it hasn't been merged yet at the moment of writing this by pyjexl mantainers. Hopefully, if at some moment the fix is applied on pyjexl we could simplify this (it would be a matter of rollback [this PR](https://github.com/telefonicasc/tcjexl/pull/6) and set the proper pyjexl dependency, e.g. `pyjexl==0.4.0`) From 0e8be03f866a9f44affc461bc8c1b278005fb20d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Mon, 18 Mar 2024 12:03:40 +0100 Subject: [PATCH 7/8] FIX ommit statement in coverage report --- .github/workflows/unittest-and-coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest-and-coverage.yml b/.github/workflows/unittest-and-coverage.yml index 63c284b..898c6b0 100644 --- a/.github/workflows/unittest-and-coverage.yml +++ b/.github/workflows/unittest-and-coverage.yml @@ -30,7 +30,7 @@ jobs: - name: Run tests with coverage # pyjexl code is omit as it doesn't belong to us run: | - coverage run --omit=tcjexl/pyjexl/ -m pytest + coverage run --omit=tcjexl/pyjexl/** -m pytest - name: Generate coverage report run: | From 290beca1b2dd7d7c163e4353501591c90b91279b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Mon, 18 Mar 2024 12:09:53 +0100 Subject: [PATCH 8/8] ADD test directory itself to coverage ommit --- .github/workflows/unittest-and-coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest-and-coverage.yml b/.github/workflows/unittest-and-coverage.yml index 898c6b0..a8dca6b 100644 --- a/.github/workflows/unittest-and-coverage.yml +++ b/.github/workflows/unittest-and-coverage.yml @@ -30,7 +30,7 @@ jobs: - name: Run tests with coverage # pyjexl code is omit as it doesn't belong to us run: | - coverage run --omit=tcjexl/pyjexl/** -m pytest + coverage run --omit=tcjexl/pyjexl/**,tests/** -m pytest - name: Generate coverage report run: |