From 5ba3d13787cf5370185d8fae80e0bc04ddbe65fe Mon Sep 17 00:00:00 2001 From: Tibor Pilz Date: Wed, 28 Dec 2022 02:16:22 +0100 Subject: [PATCH 1/8] ci: add deepsource coverage reporting --- .github/workflows/test.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8704c0f..2d3b18e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,4 +20,9 @@ jobs: - name: Install Dependencies run: poetry install --no-interaction --no-root - name: Test - run: poetry run pytest + run: | + poetry run pytest --cov=commitomatic --cov-report=xml + curl https://deepsource.io/cli | sh + ./bin/deepsource report --analyzer test-coverage --key python --value-file $PWD/coverage.xml + env: + DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }} From 76ee59eeb959563f3ae3dca838dc929605b3e78d Mon Sep 17 00:00:00 2001 From: Tibor Pilz Date: Wed, 28 Dec 2022 02:33:34 +0100 Subject: [PATCH 2/8] chore: add pytest-cov --- poetry.lock | 88 +++++++++++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 2 +- 2 files changed, 88 insertions(+), 2 deletions(-) diff --git a/poetry.lock b/poetry.lock index 183a95f..bf48eb9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -88,6 +88,73 @@ files = [ [package.extras] test = ["flake8 (==3.7.8)", "hypothesis (==3.55.3)"] +[[package]] +name = "coverage" +version = "7.0.1" +description = "Code coverage measurement for Python" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "coverage-7.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b3695c4f4750bca943b3e1f74ad4be8d29e4aeab927d50772c41359107bd5d5c"}, + {file = "coverage-7.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:fa6a5a224b7f4cfb226f4fc55a57e8537fcc096f42219128c2c74c0e7d0953e1"}, + {file = "coverage-7.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:74f70cd92669394eaf8d7756d1b195c8032cf7bbbdfce3bc489d4e15b3b8cf73"}, + {file = "coverage-7.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b66bb21a23680dee0be66557dc6b02a3152ddb55edf9f6723fa4a93368f7158d"}, + {file = "coverage-7.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d87717959d4d0ee9db08a0f1d80d21eb585aafe30f9b0a54ecf779a69cb015f6"}, + {file = "coverage-7.0.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:854f22fa361d1ff914c7efa347398374cc7d567bdafa48ac3aa22334650dfba2"}, + {file = "coverage-7.0.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:1e414dc32ee5c3f36544ea466b6f52f28a7af788653744b8570d0bf12ff34bc0"}, + {file = "coverage-7.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:6c5ad996c6fa4d8ed669cfa1e8551348729d008a2caf81489ab9ea67cfbc7498"}, + {file = "coverage-7.0.1-cp310-cp310-win32.whl", hash = "sha256:691571f31ace1837838b7e421d3a09a8c00b4aac32efacb4fc9bd0a5c647d25a"}, + {file = "coverage-7.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:89caf4425fe88889e2973a8e9a3f6f5f9bbe5dd411d7d521e86428c08a873a4a"}, + {file = "coverage-7.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:63d56165a7c76265468d7e0c5548215a5ba515fc2cba5232d17df97bffa10f6c"}, + {file = "coverage-7.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4f943a3b2bc520102dd3e0bb465e1286e12c9a54f58accd71b9e65324d9c7c01"}, + {file = "coverage-7.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:830525361249dc4cd013652b0efad645a385707a5ae49350c894b67d23fbb07c"}, + {file = "coverage-7.0.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fd1b9c5adc066db699ccf7fa839189a649afcdd9e02cb5dc9d24e67e7922737d"}, + {file = "coverage-7.0.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e00c14720b8b3b6c23b487e70bd406abafc976ddc50490f645166f111c419c39"}, + {file = "coverage-7.0.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:6d55d840e1b8c0002fce66443e124e8581f30f9ead2e54fbf6709fb593181f2c"}, + {file = "coverage-7.0.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:66b18c3cf8bbab0cce0d7b9e4262dc830e93588986865a8c78ab2ae324b3ed56"}, + {file = "coverage-7.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:12a5aa77783d49e05439fbe6e6b427484f8a0f9f456b46a51d8aac022cfd024d"}, + {file = "coverage-7.0.1-cp311-cp311-win32.whl", hash = "sha256:b77015d1cb8fe941be1222a5a8b4e3fbca88180cfa7e2d4a4e58aeabadef0ab7"}, + {file = "coverage-7.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:fb992c47cb1e5bd6a01e97182400bcc2ba2077080a17fcd7be23aaa6e572e390"}, + {file = "coverage-7.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:e78e9dcbf4f3853d3ae18a8f9272111242531535ec9e1009fa8ec4a2b74557dc"}, + {file = "coverage-7.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e60bef2e2416f15fdc05772bf87db06c6a6f9870d1db08fdd019fbec98ae24a9"}, + {file = "coverage-7.0.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9823e4789ab70f3ec88724bba1a203f2856331986cd893dedbe3e23a6cfc1e4e"}, + {file = "coverage-7.0.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9158f8fb06747ac17bd237930c4372336edc85b6e13bdc778e60f9d685c3ca37"}, + {file = "coverage-7.0.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:486ee81fa694b4b796fc5617e376326a088f7b9729c74d9defa211813f3861e4"}, + {file = "coverage-7.0.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:1285648428a6101b5f41a18991c84f1c3959cee359e51b8375c5882fc364a13f"}, + {file = "coverage-7.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:2c44fcfb3781b41409d0f060a4ed748537557de9362a8a9282182fafb7a76ab4"}, + {file = "coverage-7.0.1-cp37-cp37m-win32.whl", hash = "sha256:d6814854c02cbcd9c873c0f3286a02e3ac1250625cca822ca6bc1018c5b19f1c"}, + {file = "coverage-7.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:f66460f17c9319ea4f91c165d46840314f0a7c004720b20be58594d162a441d8"}, + {file = "coverage-7.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9b373c9345c584bb4b5f5b8840df7f4ab48c4cbb7934b58d52c57020d911b856"}, + {file = "coverage-7.0.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:d3022c3007d3267a880b5adcf18c2a9bf1fc64469b394a804886b401959b8742"}, + {file = "coverage-7.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:92651580bd46519067e36493acb394ea0607b55b45bd81dd4e26379ed1871f55"}, + {file = "coverage-7.0.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3cfc595d2af13856505631be072835c59f1acf30028d1c860b435c5fc9c15b69"}, + {file = "coverage-7.0.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0b4b3a4d9915b2be879aff6299c0a6129f3d08a775d5a061f503cf79571f73e4"}, + {file = "coverage-7.0.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:b6f22bb64cc39bcb883e5910f99a27b200fdc14cdd79df8696fa96b0005c9444"}, + {file = "coverage-7.0.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:72d1507f152abacea81f65fee38e4ef3ac3c02ff8bc16f21d935fd3a8a4ad910"}, + {file = "coverage-7.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:0a79137fc99815fff6a852c233628e735ec15903cfd16da0f229d9c4d45926ab"}, + {file = "coverage-7.0.1-cp38-cp38-win32.whl", hash = "sha256:b3763e7fcade2ff6c8e62340af9277f54336920489ceb6a8cd6cc96da52fcc62"}, + {file = "coverage-7.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:09f6b5a8415b6b3e136d5fec62b552972187265cb705097bf030eb9d4ffb9b60"}, + {file = "coverage-7.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:978258fec36c154b5e250d356c59af7d4c3ba02bef4b99cda90b6029441d797d"}, + {file = "coverage-7.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:19ec666533f0f70a0993f88b8273057b96c07b9d26457b41863ccd021a043b9a"}, + {file = "coverage-7.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cfded268092a84605f1cc19e5c737f9ce630a8900a3589e9289622db161967e9"}, + {file = "coverage-7.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07bcfb1d8ac94af886b54e18a88b393f6a73d5959bb31e46644a02453c36e475"}, + {file = "coverage-7.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:397b4a923cc7566bbc7ae2dfd0ba5a039b61d19c740f1373791f2ebd11caea59"}, + {file = "coverage-7.0.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:aec2d1515d9d39ff270059fd3afbb3b44e6ec5758af73caf18991807138c7118"}, + {file = "coverage-7.0.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:c20cfebcc149a4c212f6491a5f9ff56f41829cd4f607b5be71bb2d530ef243b1"}, + {file = "coverage-7.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:fd556ff16a57a070ce4f31c635953cc44e25244f91a0378c6e9bdfd40fdb249f"}, + {file = "coverage-7.0.1-cp39-cp39-win32.whl", hash = "sha256:b9ea158775c7c2d3e54530a92da79496fb3fb577c876eec761c23e028f1e216c"}, + {file = "coverage-7.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:d1991f1dd95eba69d2cd7708ff6c2bbd2426160ffc73c2b81f617a053ebcb1a8"}, + {file = "coverage-7.0.1-pp37.pp38.pp39-none-any.whl", hash = "sha256:3dd4ee135e08037f458425b8842d24a95a0961831a33f89685ff86b77d378f89"}, + {file = "coverage-7.0.1.tar.gz", hash = "sha256:a4a574a19eeb67575a5328a5760bbbb737faa685616586a9f9da4281f940109c"}, +] + +[package.dependencies] +tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""} + +[package.extras] +toml = ["tomli"] + [[package]] name = "et-xmlfile" version = "1.1.0" @@ -397,6 +464,25 @@ tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] +[[package]] +name = "pytest-cov" +version = "4.0.0" +description = "Pytest plugin for measuring coverage." +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pytest-cov-4.0.0.tar.gz", hash = "sha256:996b79efde6433cdbd0088872dbc5fb3ed7fe1578b68cdbba634f14bb8dd0470"}, + {file = "pytest_cov-4.0.0-py3-none-any.whl", hash = "sha256:2feb1b751d66a8bd934e5edfa2e961d11309dc37b73b0eabe73b5945fee20f6b"}, +] + +[package.dependencies] +coverage = {version = ">=5.2.1", extras = ["toml"]} +pytest = ">=4.6" + +[package.extras] +testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] + [[package]] name = "pytest-mock" version = "3.10.0" @@ -608,4 +694,4 @@ socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "6364ed8ad30840fc52c47fd93e94a3c7f1ac347c00e4e6c49bc1b155416fbb60" +content-hash = "7056900f909685744a099e8644889963c847317c26c040185cc5cbf35bf8c185" diff --git a/pyproject.toml b/pyproject.toml index 8d53009..5cc89eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ pyfzf = "^0.3.1" openai = "^0.25.0" pytest = "^7.2.0" pytest-mock = "^3.10.0" - +pytest-cov = "^4.0.0" [build-system] requires = ["poetry-core"] From 81ec905f9945ac0fcae4f3e3c3d8f5a86ea56440 Mon Sep 17 00:00:00 2001 From: Tibor Pilz Date: Wed, 28 Dec 2022 02:33:45 +0100 Subject: [PATCH 3/8] ci: add coverage output --- .github/workflows/test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2d3b18e..2db07cd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,5 +24,12 @@ jobs: poetry run pytest --cov=commitomatic --cov-report=xml curl https://deepsource.io/cli | sh ./bin/deepsource report --analyzer test-coverage --key python --value-file $PWD/coverage.xml + rate=$(grep -Pio 'line-rate="\K[^"]*' coverage.xml | head -n1) + percentage=$(echo "100 * $rate" | bc) + percentage_rounded=$(printf "%.f" $percentage) + echo "lines=${percentage_rounded}" >> $GITHUB_OUTPUT + echo "path=${BADGE_PATH}" >> $GITHUB_OUTPUT + echo "branch=badges" >> $GITHUB_OUTPUT env: DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }} + BADGE_PATH: ${{ steps.extract_branch.outputs.branch }}/test-badge.svg From de15cce0a052c2f4cc4e28851104f8a3c99c4c40 Mon Sep 17 00:00:00 2001 From: Tibor Pilz Date: Wed, 28 Dec 2022 02:39:00 +0100 Subject: [PATCH 4/8] ci: use pr sha for checkout --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2db07cd..3dc4914 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,6 +8,9 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + - uses: actions/setup-python@v4 with: python-version: "3.10" @@ -19,6 +22,7 @@ jobs: installer-parallel: true - name: Install Dependencies run: poetry install --no-interaction --no-root + - name: Test run: | poetry run pytest --cov=commitomatic --cov-report=xml From 27dedfeb4f420447911d06b8bbc0c1c405dfbdb6 Mon Sep 17 00:00:00 2001 From: Tibor Pilz Date: Wed, 28 Dec 2022 02:41:27 +0100 Subject: [PATCH 5/8] ci: create test coverage badge --- .github/workflows/test.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3dc4914..5d9fc3e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,3 +37,36 @@ jobs: env: DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }} BADGE_PATH: ${{ steps.extract_branch.outputs.branch }}/test-badge.svg + + - name: Generate the badge SVG image + uses: emibcn/badge-action@v2.0.2 + id: badge + with: + label: 'Test coverage' + status: ${{ steps.coverage.outputs.lines }} + color: 'blue,555,daf' + path: ${{ steps.coverage.outputs.path }} + + - name: Upload badge as artifact + uses: actions/upload-artifact@v3 + with: + name: badge + path: ${{ steps.coverage.outputs.path }} + if-no-files-found: error + + - name: Commit badge + continue-on-error: true + env: + BADGE: ${{ steps.coverage.outputs.path }} + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add "${BADGE}" + git commit -m "Add/Update badge" + + - name: Push badge commit + uses: ad-m/github-push-action@master + if: ${{ success() }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ steps.coverage.outputs.branch }} From 626ab362f6e6489aa47b7b61e34d90fe51fad89c Mon Sep 17 00:00:00 2001 From: Tibor Pilz Date: Wed, 28 Dec 2022 02:46:07 +0100 Subject: [PATCH 6/8] ci: fix badge creation --- .github/workflows/test.yml | 28 +++++++++++++++++++++------- README.md | 2 +- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5d9fc3e..d1310b6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,6 +24,7 @@ jobs: run: poetry install --no-interaction --no-root - name: Test + id: test run: | poetry run pytest --cov=commitomatic --cov-report=xml curl https://deepsource.io/cli | sh @@ -36,28 +37,41 @@ jobs: echo "branch=badges" >> $GITHUB_OUTPUT env: DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }} - BADGE_PATH: ${{ steps.extract_branch.outputs.branch }}/test-badge.svg + BADGE_PATH: test-coverage.svg + + - uses: actions/checkout@v3 + with: + ref: badges - name: Generate the badge SVG image uses: emibcn/badge-action@v2.0.2 id: badge with: label: 'Test coverage' - status: ${{ steps.coverage.outputs.lines }} - color: 'blue,555,daf' - path: ${{ steps.coverage.outputs.path }} + status: ${{ steps.test.outputs.lines }}% + color: ${{ + steps.test.outputs.lines > 90 && 'green' || + steps.test.outputs.lines > 80 && 'yellow,green' || + steps.test.outputs.lines > 70 && 'yellow' || + steps.test.outputs.lines > 60 && 'orange,yellow' || + steps.test.outputs.lines > 50 && 'orange' || + steps.test.outputs.lines > 40 && 'red,orange' || + steps.test.outputs.lines > 30 && 'red,red,orange' || + steps.test.outputs.lines > 20 && 'red,red,red,orange' || + 'red' }} + path: ${{ steps.test.outputs.path }} - name: Upload badge as artifact uses: actions/upload-artifact@v3 with: name: badge - path: ${{ steps.coverage.outputs.path }} + path: ${{ steps.test.outputs.path }} if-no-files-found: error - name: Commit badge continue-on-error: true env: - BADGE: ${{ steps.coverage.outputs.path }} + BADGE: ${{ steps.test.outputs.path }} run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" @@ -69,4 +83,4 @@ jobs: if: ${{ success() }} with: github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ steps.coverage.outputs.branch }} + branch: ${{ steps.test.outputs.branch }} diff --git a/README.md b/README.md index 5e87f03..19cd801 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![DeepSource](https://deepsource.io/gh/tiborpilz/commitomatic.svg/?label=active+issues&show_trend=true&token=HXOj050y_0e28wz3hpVDSbg6)](https://deepsource.io/gh/tiborpilz/commitomatic/?ref=repository-badge) [![DeepSource](https://deepsource.io/gh/tiborpilz/commitomatic.svg/?label=resolved+issues&show_trend=true&token=HXOj050y_0e28wz3hpVDSbg6)](https://deepsource.io/gh/tiborpilz/commitomatic/?ref=repository-badge) - +[!Coverage(https://raw.githubusercontent.com/tiborpilz/commitomatic/badges/test-coverage.svg)] # Commitomatic Commitomatic is a command-line tool that uses the OpenAI GPT-Codex to generate commit messages based on a git diff. From 6a0e0f649e09eba5cdedfa12814d075366b7dab7 Mon Sep 17 00:00:00 2001 From: Tibor Pilz Date: Wed, 28 Dec 2022 03:02:26 +0100 Subject: [PATCH 7/8] ci: deploy coverage to gh pages --- .github/workflows/test.yml | 11 ++++++++++- README.md | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d1310b6..a9fa16a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,7 +26,7 @@ jobs: - name: Test id: test run: | - poetry run pytest --cov=commitomatic --cov-report=xml + poetry run pytest --cov=commitomatic --cov-report=xml --cov-report=html curl https://deepsource.io/cli | sh ./bin/deepsource report --analyzer test-coverage --key python --value-file $PWD/coverage.xml rate=$(grep -Pio 'line-rate="\K[^"]*' coverage.xml | head -n1) @@ -39,6 +39,15 @@ jobs: DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }} BADGE_PATH: test-coverage.svg + - name: Deploy Coverage Report to Pages + if: success() + uses: crazy-max/ghaction-github-pages@v2 + with: + target_branch: gh-pages + build_dir: htmlcov + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v3 with: ref: badges diff --git a/README.md b/README.md index 19cd801..8bffa24 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ [![DeepSource](https://deepsource.io/gh/tiborpilz/commitomatic.svg/?label=active+issues&show_trend=true&token=HXOj050y_0e28wz3hpVDSbg6)](https://deepsource.io/gh/tiborpilz/commitomatic/?ref=repository-badge) [![DeepSource](https://deepsource.io/gh/tiborpilz/commitomatic.svg/?label=resolved+issues&show_trend=true&token=HXOj050y_0e28wz3hpVDSbg6)](https://deepsource.io/gh/tiborpilz/commitomatic/?ref=repository-badge) -[!Coverage(https://raw.githubusercontent.com/tiborpilz/commitomatic/badges/test-coverage.svg)] +[![Coverage](https://raw.githubusercontent.com/tiborpilz/commitomatic/badges/test-coverage.svg)]() + # Commitomatic Commitomatic is a command-line tool that uses the OpenAI GPT-Codex to generate commit messages based on a git diff. From ed0eea782784811c506862af66108597af11bf96 Mon Sep 17 00:00:00 2001 From: Tibor Pilz Date: Wed, 28 Dec 2022 03:11:06 +0100 Subject: [PATCH 8/8] ci: alternative pages action --- .github/workflows/test.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a9fa16a..ab7905c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,21 @@ name: CI on: pull_request +permissions: + actions: write + checks: write + contents: write + deployments: write + id-token: write + issues: write + packages: write + pages: write + pull: write + repository: write + security: write + statuses: write + + jobs: ci: strategy: @@ -39,6 +54,19 @@ jobs: DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }} BADGE_PATH: test-coverage.svg + - name: Setup Pages + uses: actions/configure-pages@v2 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + # Upload entire repository + path: 'htmlcov' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 + - name: Deploy Coverage Report to Pages if: success() uses: crazy-max/ghaction-github-pages@v2