From 28359f4d503bc0e5e24460c0713d0d49f19ea103 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 17:41:43 -0300 Subject: [PATCH 01/48] feat: first pass at new packaging --- .github/workflows/build_for_pypi.yml | 29 ++++++++---------------- pyproject.toml | 34 ++++++++++++++++++++++++++++ requirements.txt | 26 +++++++++++++-------- setup.py | 34 +--------------------------- 4 files changed, 60 insertions(+), 63 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index ff384175..96503ff2 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -10,10 +10,13 @@ on: jobs: build_for_pypi: - runs-on: ubuntu-latest permissions: - id-token: write # This is required for requesting the JWT - contents: read # This is required for actions/checkout + id-token: write # This is required for requesting the JWT + contents: read # This is required for actions/checkout + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-13, macos-latest] steps: - uses: actions/checkout@v4 with: @@ -22,23 +25,9 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.11" - - name: Install dependencies - run: | - pip install -r requirements.txt - python setup.py build - python setup.py develop - - name: Build distributions for different platforms - run: | - pip install wheel - python setup.py sdist bdist_wheel --plat-name=manylinux2014_x86_64 - python setup.py bdist_wheel --plat-name=macosx-12.6-universal2 - python setup.py bdist_wheel --plat-name=win_amd64 - - name: Move src file to match PEP625 - run: | - cd dist - ls | grep *.tar.gz | xargs -I x mv -- x "$(ls | grep *.tar.gz | sed 's/codecov-cli/codecov_cli/')" - ls -al - cd .. + - name: Build wheels + uses: pypa/cibuildwheel@v2.22.0 + - name: Publish package to PyPi if: inputs.publish == true uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..53526018 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,34 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +authors = [ + {name = "Tom Hu", email = "thomas.hu@sentry.io"}, + {name = "Codecov Support", email = "support@codecov.io"}, +] +description = "Codecov Command Line Interface" +requires-python = ">= 3.9" +dependencies = [ + "click==8.*", + "httpx==0.27.*", + "ijson==3.*", + "pathspec>=0.12.1", + "pyyaml==6.*", + "regex", + "responses==0.21.*", + "sentry-sdk>=2.20.0", + "test-results-parser==0.5.*", + "tree-sitter==0.20.*", + "wrapt>=1.17.2", +] +license = {file = "LICENSE"} +name = "codecov-cli" +readme = "README.md" +version = "10.0.1" + +[project.scripts] +codecovcli = "codecov_cli.main:run" + +[tool.setuptools.packages.find] +include = ["codecov-cli*"] diff --git a/requirements.txt b/requirements.txt index 46454bcb..d20e995f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile with Python 3.11 # by the following command: # -# pip-compile setup.py +# pip-compile pyproject.toml # anyio==4.0.0 # via httpx @@ -15,42 +15,48 @@ certifi==2024.7.4 charset-normalizer==3.3.0 # via requests click==8.1.7 - # via codecov-cli (setup.py) + # via codecov-cli (pyproject.toml) h11==0.14.0 # via httpcore httpcore==1.0.7 # via httpx httpx==0.27.2 - # via codecov-cli (setup.py) + # via codecov-cli (pyproject.toml) idna==3.7 # via # anyio # httpx # requests ijson==3.2.3 +<<<<<<< Updated upstream # via codecov-cli (setup.py) +======= + # via codecov-cli (pyproject.toml) +pathspec==0.12.1 + # via codecov-cli (pyproject.toml) +>>>>>>> Stashed changes pyyaml==6.0.1 - # via codecov-cli (setup.py) + # via codecov-cli (pyproject.toml) regex==2023.12.25 - # via codecov-cli (setup.py) + # via codecov-cli (pyproject.toml) requests==2.32.2 # via responses responses==0.21.0 - # via codecov-cli (setup.py) + # via codecov-cli (pyproject.toml) sentry-sdk==2.20.0 - # via codecov-cli (setup.py) + # via codecov-cli (pyproject.toml) sniffio==1.3.0 # via # anyio # httpx test-results-parser==0.5.1 - # via codecov-cli (setup.py) + # via codecov-cli (pyproject.toml) tree-sitter==0.20.2 - # via codecov-cli (setup.py) + # via codecov-cli (pyproject.toml) urllib3==2.2.2 # via # requests # responses # sentry-sdk wrapt==1.17.2 - # via codecov-cli (setup.py) + # via codecov-cli (pyproject.toml) diff --git a/setup.py b/setup.py index a9bbf362..8234a4a5 100644 --- a/setup.py +++ b/setup.py @@ -1,40 +1,8 @@ -from os import path from platform import system -from setuptools import Extension, find_packages, setup - -here = path.abspath(path.dirname(__file__)) - -with open(path.join(here, "README.md"), encoding="utf-8") as f: - long_description = f.read() +from setuptools import Extension, setup setup( - name="codecov-cli", - version="10.0.1", - packages=find_packages(exclude=["contrib", "docs", "tests*"]), - description="Codecov Command Line Interface", - long_description=long_description, - long_description_content_type="text/markdown", - author="Codecov", - author_email="support@codecov.io", - install_requires=[ - "click==8.*", - "httpx==0.27.*", - "ijson==3.*", - "pyyaml==6.*", - "responses==0.21.*", - "tree-sitter==0.20.*", - "test-results-parser==0.5.*", - "regex", - "sentry-sdk>=2.20.0", - "wrapt>=1.17.2", - ], - entry_points={ - "console_scripts": [ - "codecovcli = codecov_cli.main:run", - ], - }, - python_requires=">=3.9", ext_modules=[ Extension( "staticcodecov_languages", From 628be10c037e324f73e0aa619df0cba068ec0adc Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 17:51:34 -0300 Subject: [PATCH 02/48] fix: skip pypy3.9 --- .github/workflows/build_for_pypi.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 96503ff2..d7d98fd8 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -27,7 +27,8 @@ jobs: python-version: "3.11" - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 - + env: + CIBW_SKIP: pp39 - name: Publish package to PyPi if: inputs.publish == true uses: pypa/gh-action-pypi-publish@release/v1 From cd25cc391c03ad08960309a00f1b0443e26113de Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 17:54:31 -0300 Subject: [PATCH 03/48] fix: add wildcard on pp39 --- .github/workflows/build_for_pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index d7d98fd8..8e2da990 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -28,7 +28,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 env: - CIBW_SKIP: pp39 + CIBW_SKIP: pp39* - name: Publish package to PyPi if: inputs.publish == true uses: pypa/gh-action-pypi-publish@release/v1 From 523cb9621974b9ee2349131c0ec7878dc0fc3afe Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 18:33:03 -0300 Subject: [PATCH 04/48] fix: no pypy --- .github/workflows/build_for_pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 8e2da990..34b8b7c0 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -28,7 +28,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 env: - CIBW_SKIP: pp39* + CIBW_SKIP: pp* - name: Publish package to PyPi if: inputs.publish == true uses: pypa/gh-action-pypi-publish@release/v1 From 8ac380f1998dde4bba257278fff5d1cbb6d5a0fd Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 18:50:37 -0300 Subject: [PATCH 05/48] fix: add in separate publish step --- .github/workflows/build_for_pypi.yml | 58 ++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 34b8b7c0..8fe18b9c 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -9,10 +9,7 @@ on: description: "Publish to PyPi" jobs: - build_for_pypi: - permissions: - id-token: write # This is required for requesting the JWT - contents: read # This is required for actions/checkout + build_dist_for_pypi: runs-on: ${{ matrix.os }} strategy: matrix: @@ -20,6 +17,7 @@ jobs: steps: - uses: actions/checkout@v4 with: + persist-credentials: false submodules: true - name: Set up Python 3.11 uses: actions/setup-python@v4 @@ -29,6 +27,58 @@ jobs: uses: pypa/cibuildwheel@v2.22.0 env: CIBW_SKIP: pp* + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + build_src_for_pypi: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + submodules: true + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install deps + run: + pip install -r requirements.txt + pip install build + - name: Build src dist + run: | + python -m build --sdist + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish_to_pypi: + needs: + - build_for_pypi + - build_src_for_pypi + permissions: + id-token: write # This is required for requesting the JWT + runs-on: ubuntu-latest + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Sign the dists with Sigstore + uses: sigstore/gh-action-sigstore-python@v3.0.0 + with: + inputs: >- + ./dist/*.tar.gz + ./dist/*.whl + - name: Display all files in dist/ + run: | + ls -al dist/ - name: Publish package to PyPi if: inputs.publish == true uses: pypa/gh-action-pypi-publish@release/v1 From 1bf1eb9557fbb4821a34bce99d38793cddf45712 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 18:55:03 -0300 Subject: [PATCH 06/48] fix: update requirements.txt --- .github/workflows/build_for_pypi.yml | 2 +- requirements.txt | 30 +++++++++++++--------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 8fe18b9c..c9d8202a 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -59,7 +59,7 @@ jobs: publish_to_pypi: needs: - - build_for_pypi + - build_dist_for_pypi - build_src_for_pypi permissions: id-token: write # This is required for requesting the JWT diff --git a/requirements.txt b/requirements.txt index d20e995f..87b11a67 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,17 +4,17 @@ # # pip-compile pyproject.toml # -anyio==4.0.0 +anyio==4.8.0 # via httpx -certifi==2024.7.4 +certifi==2024.12.14 # via # httpcore # httpx # requests # sentry-sdk -charset-normalizer==3.3.0 +charset-normalizer==3.4.1 # via requests -click==8.1.7 +click==8.1.8 # via codecov-cli (pyproject.toml) h11==0.14.0 # via httpcore @@ -22,38 +22,36 @@ httpcore==1.0.7 # via httpx httpx==0.27.2 # via codecov-cli (pyproject.toml) -idna==3.7 +idna==3.10 # via # anyio # httpx # requests -ijson==3.2.3 -<<<<<<< Updated upstream - # via codecov-cli (setup.py) -======= +ijson==3.3.0 # via codecov-cli (pyproject.toml) pathspec==0.12.1 # via codecov-cli (pyproject.toml) ->>>>>>> Stashed changes -pyyaml==6.0.1 +pyyaml==6.0.2 # via codecov-cli (pyproject.toml) -regex==2023.12.25 +regex==2024.11.6 # via codecov-cli (pyproject.toml) -requests==2.32.2 +requests==2.32.3 # via responses responses==0.21.0 # via codecov-cli (pyproject.toml) sentry-sdk==2.20.0 # via codecov-cli (pyproject.toml) -sniffio==1.3.0 +sniffio==1.3.1 # via # anyio # httpx test-results-parser==0.5.1 # via codecov-cli (pyproject.toml) -tree-sitter==0.20.2 +tree-sitter==0.20.4 # via codecov-cli (pyproject.toml) -urllib3==2.2.2 +typing-extensions==4.12.2 + # via anyio +urllib3==2.3.0 # via # requests # responses From 4f76ae7d223dc2e2ad483b7e2d3ea9ba707723dc Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 19:03:35 -0300 Subject: [PATCH 07/48] fix: pipe --- .github/workflows/build_for_pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index c9d8202a..31b7e484 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -45,7 +45,7 @@ jobs: with: python-version: "3.11" - name: Install deps - run: + run: | pip install -r requirements.txt pip install build - name: Build src dist From 4f8a082a74b5dce4dea656b56bc72ed9f635ee11 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 19:11:15 -0300 Subject: [PATCH 08/48] fix: ls first --- .github/workflows/build_for_pypi.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 31b7e484..f7a600d4 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -70,15 +70,15 @@ jobs: with: name: python-package-distributions path: dist/ + - name: Display all files in dist/ + run: | + ls -al dist/ - name: Sign the dists with Sigstore uses: sigstore/gh-action-sigstore-python@v3.0.0 with: inputs: >- ./dist/*.tar.gz ./dist/*.whl - - name: Display all files in dist/ - run: | - ls -al dist/ - name: Publish package to PyPi if: inputs.publish == true uses: pypa/gh-action-pypi-publish@release/v1 From 70afd2868bc2055658a1db2724b54db7ce8e4316 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 19:40:28 -0300 Subject: [PATCH 09/48] fix: wheelhouse --- .github/workflows/build_for_pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index f7a600d4..3987ee19 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -31,7 +31,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: python-package-distributions - path: dist/ + path: wheelhouse/ build_src_for_pypi: runs-on: ubuntu-latest From e0501e9b2bdb19b876e4fe11c9f078529c9797d7 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 19:51:27 -0300 Subject: [PATCH 10/48] fix: change the name --- .github/workflows/build_for_pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 3987ee19..301bccbe 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -30,7 +30,7 @@ jobs: - name: Store the distribution packages uses: actions/upload-artifact@v4 with: - name: python-package-distributions + name: python-package-distributions-$${{ matrix.os }} path: wheelhouse/ build_src_for_pypi: From 5741400d23d7fcca279d4d931d52d1cf9c127d53 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 19:58:13 -0300 Subject: [PATCH 11/48] fix: download all artifacts --- .github/workflows/build_for_pypi.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 301bccbe..af3779fb 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -67,9 +67,6 @@ jobs: steps: - name: Download all the dists uses: actions/download-artifact@v4 - with: - name: python-package-distributions - path: dist/ - name: Display all files in dist/ run: | ls -al dist/ From 7440fc87630af3deeb971a8af11c1fad944ab709 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 20:15:07 -0300 Subject: [PATCH 12/48] fix: update tool.setuptools --- .github/workflows/build_for_pypi.yml | 4 ++-- pyproject.toml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index af3779fb..99ce9a71 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -67,9 +67,9 @@ jobs: steps: - name: Download all the dists uses: actions/download-artifact@v4 - - name: Display all files in dist/ + - name: Display all files run: | - ls -al dist/ + ls -al - name: Sign the dists with Sigstore uses: sigstore/gh-action-sigstore-python@v3.0.0 with: diff --git a/pyproject.toml b/pyproject.toml index 53526018..7cb77644 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,5 +30,5 @@ version = "10.0.1" [project.scripts] codecovcli = "codecov_cli.main:run" -[tool.setuptools.packages.find] -include = ["codecov-cli*"] +[tool.setuptools] +packages = ["codecov_cli"] From c21c77bcd412dae77308c6137d85256c65329c67 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 20:42:46 -0300 Subject: [PATCH 13/48] fix: split the pypi and asset building --- .github/workflows/build_assets.yml | 17 +++++++---------- .github/workflows/build_for_pypi.yml | 11 ++++------- .github/workflows/build_main.yml | 17 ----------------- pyproject.toml | 1 - requirements.txt | 2 -- 5 files changed, 11 insertions(+), 37 deletions(-) delete mode 100644 .github/workflows/build_main.yml diff --git a/.github/workflows/build_assets.yml b/.github/workflows/build_assets.yml index 53b55dc7..e903737e 100644 --- a/.github/workflows/build_assets.yml +++ b/.github/workflows/build_assets.yml @@ -2,12 +2,9 @@ name: Build Compiled Assets on: - workflow_call: - inputs: - release: - type: boolean - default: false - description: "Attach artifacts to a release" + pull_request: + branches: + - main jobs: build_assets: @@ -68,12 +65,12 @@ jobs: run: ${{matrix.CMD_BUILD}} - name: Upload a Build Artifact uses: actions/upload-artifact@v4 - if: inputs.release == false + if: startsWith(github.ref, 'refs/tags/') with: name: ${{ matrix.OUT_FILE_NAME }} path: ./dist/${{ matrix.OUT_FILE_NAME }} - name: Upload Release Asset - if: inputs.release == true + if: startsWith(github.ref, 'refs/tags/') id: upload-release-asset uses: svenstaro/upload-release-action@v2 with: @@ -118,12 +115,12 @@ jobs: ./scripts/build_${{ matrix.distro_name }}_arm.sh ${{ matrix.distro_name }}_${{ matrix.arch }} - name: Upload a Build Artifact uses: actions/upload-artifact@v4 - if: inputs.release == false + if: startsWith(github.ref, 'refs/tags/') with: name: codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }} path: ./dist/codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }} - name: Upload Release Asset - if: inputs.release == true + if: startsWith(github.ref, 'refs/tags/') id: upload-release-asset uses: svenstaro/upload-release-action@v2 with: diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 99ce9a71..f4a7558f 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -1,12 +1,9 @@ name: Build and Optionally Publish to PyPi on: - workflow_call: - inputs: - publish: - type: boolean - default: false - description: "Publish to PyPi" + pull_request: + branches: + - main jobs: build_dist_for_pypi: @@ -77,7 +74,7 @@ jobs: ./dist/*.tar.gz ./dist/*.whl - name: Publish package to PyPi - if: inputs.publish == true + if: startsWith(github.ref, 'refs/tags/') uses: pypa/gh-action-pypi-publish@release/v1 with: attestations: false diff --git a/.github/workflows/build_main.yml b/.github/workflows/build_main.yml deleted file mode 100644 index d59b8b54..00000000 --- a/.github/workflows/build_main.yml +++ /dev/null @@ -1,17 +0,0 @@ -# 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: Build - -on: - pull_request: - branches: - - main - -jobs: - build_and_publish_to_pipy: - uses: ./.github/workflows/build_for_pypi.yml - secrets: inherit - build_assets: - uses: ./.github/workflows/build_assets.yml - secrets: inherit \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 7cb77644..fd4c8c9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,6 @@ dependencies = [ "click==8.*", "httpx==0.27.*", "ijson==3.*", - "pathspec>=0.12.1", "pyyaml==6.*", "regex", "responses==0.21.*", diff --git a/requirements.txt b/requirements.txt index 87b11a67..8942ca8f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -29,8 +29,6 @@ idna==3.10 # requests ijson==3.3.0 # via codecov-cli (pyproject.toml) -pathspec==0.12.1 - # via codecov-cli (pyproject.toml) pyyaml==6.0.2 # via codecov-cli (pyproject.toml) regex==2024.11.6 From a54b07c96fc090bb77f3da6f29a64ea34e7e413f Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 20:52:16 -0300 Subject: [PATCH 14/48] fix: use CODECOV_ENV --- .github/workflows/ci-job.yml | 2 ++ .github/workflows/ci.yml | 2 ++ codecov_cli/commands/labelanalysis.py | 1 + codecov_cli/opentelemetry.py | 2 ++ 4 files changed, 7 insertions(+) diff --git a/.github/workflows/ci-job.yml b/.github/workflows/ci-job.yml index 983954c8..cea929f5 100644 --- a/.github/workflows/ci-job.yml +++ b/.github/workflows/ci-job.yml @@ -30,6 +30,8 @@ jobs: - name: Test with pytest run: | pytest --cov --junitxml=3.12junit.xml + env: + CODECOV_ENV: test - name: Upload coverage to Codecov uses: codecov/codecov-action@v5 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07587502..1b2f7f14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,6 +98,8 @@ jobs: - name: Test with pytest run: | pytest --cov --junitxml=${{matrix.python-version}}junit.xml + env: + CODECOV_ENV: test - name: Dogfooding codecov-cli if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} run: | diff --git a/codecov_cli/commands/labelanalysis.py b/codecov_cli/commands/labelanalysis.py index 8cd9d8b8..18352726 100644 --- a/codecov_cli/commands/labelanalysis.py +++ b/codecov_cli/commands/labelanalysis.py @@ -146,6 +146,7 @@ def label_analysis( payload["requested_labels"] = requested_labels if eid: + print(eid) # Initial request with no labels was successful # Now we PATCH the labels in patch_url = f"{upload_url}/labels/labels-analysis/{eid}" diff --git a/codecov_cli/opentelemetry.py b/codecov_cli/opentelemetry.py index 54a78d79..8fc2ae41 100644 --- a/codecov_cli/opentelemetry.py +++ b/codecov_cli/opentelemetry.py @@ -11,6 +11,8 @@ def init_telem(ctx): return if ctx['enterprise_url']: # dont run on dedicated cloud return + if os.getenv('CODECOV_ENV', 'production') == 'test': + return sentry_sdk.init( dsn="https://0bea75c61745c221a6ef1ac1709b1f4d@o26192.ingest.us.sentry.io/4508615876083713", From 4e1317ded3c51eca74aa6b9823e8723e03a1ae29 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 21:09:07 -0300 Subject: [PATCH 15/48] fix: do some more jiggling --- .github/workflows/build_for_pypi.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index f4a7558f..20fe339b 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -1,3 +1,4 @@ +--- name: Build and Optionally Publish to PyPi on: @@ -27,8 +28,8 @@ jobs: - name: Store the distribution packages uses: actions/upload-artifact@v4 with: - name: python-package-distributions-$${{ matrix.os }} - path: wheelhouse/ + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl build_src_for_pypi: runs-on: ubuntu-latest @@ -48,10 +49,14 @@ jobs: - name: Build src dist run: | python -m build --sdist + - name: Get version + id: version + run: | + echo "version=$(python -c 'import importlib.metadata; print(importlib.metadata.version(\'codecov-cli\'))')" >> "$GITHUB_OUTPUT" - name: Store the distribution packages uses: actions/upload-artifact@v4 with: - name: python-package-distributions + name: codecov_cli-${{ steps.version.outputs.version }}.tar.gz path: dist/ publish_to_pypi: @@ -71,8 +76,8 @@ jobs: uses: sigstore/gh-action-sigstore-python@v3.0.0 with: inputs: >- - ./dist/*.tar.gz - ./dist/*.whl + ./**/*.tar.gz + ./**/*.whl - name: Publish package to PyPi if: startsWith(github.ref, 'refs/tags/') uses: pypa/gh-action-pypi-publish@release/v1 From 7ff99543aeca1ee34529e37625d524e8f9d4d1d9 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 21:10:10 -0300 Subject: [PATCH 16/48] fix: remove log --- codecov_cli/commands/labelanalysis.py | 1 - 1 file changed, 1 deletion(-) diff --git a/codecov_cli/commands/labelanalysis.py b/codecov_cli/commands/labelanalysis.py index 18352726..8cd9d8b8 100644 --- a/codecov_cli/commands/labelanalysis.py +++ b/codecov_cli/commands/labelanalysis.py @@ -146,7 +146,6 @@ def label_analysis( payload["requested_labels"] = requested_labels if eid: - print(eid) # Initial request with no labels was successful # Now we PATCH the labels in patch_url = f"{upload_url}/labels/labels-analysis/{eid}" From 58adb2f62ca921348953adffc195fcc5e8969122 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 21:28:15 -0300 Subject: [PATCH 17/48] fix: make it a file --- .github/workflows/build_for_pypi.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 20fe339b..b03f25ed 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -52,7 +52,8 @@ jobs: - name: Get version id: version run: | - echo "version=$(python -c 'import importlib.metadata; print(importlib.metadata.version(\'codecov-cli\'))')" >> "$GITHUB_OUTPUT" + version=$(python -c 'import importlib.metadata; print(importlib.metadata.version("codecov-cli"))') + echo "version=$version" >> "$GITHUB_OUTPUT" - name: Store the distribution packages uses: actions/upload-artifact@v4 with: From 5af56d30265758f2d11bcdcc99b944e6b3e4b5eb Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 21:42:31 -0300 Subject: [PATCH 18/48] fix: maybe like this --- .github/workflows/build_for_pypi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index b03f25ed..b9e69d40 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -28,7 +28,7 @@ jobs: - name: Store the distribution packages uses: actions/upload-artifact@v4 with: - name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + name: cibw-wheels-${{ matrix.os }} path: ./wheelhouse/*.whl build_src_for_pypi: @@ -57,7 +57,7 @@ jobs: - name: Store the distribution packages uses: actions/upload-artifact@v4 with: - name: codecov_cli-${{ steps.version.outputs.version }}.tar.gz + name: cibw-sdist path: dist/ publish_to_pypi: From 64b401400f8648c0f776c058062fd57a90c3c110 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 21:56:58 -0300 Subject: [PATCH 19/48] fix: remove setup.py cases --- .github/workflows/create_release.yml | 2 +- .github/workflows/create_release_pr.yml | 4 +- README.md | 88 ++++++++++++------------- scripts/build_linux_arm.sh | 2 +- 4 files changed, 48 insertions(+), 48 deletions(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index e1abb1b4..cc0dcb68 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -18,7 +18,7 @@ jobs: - id: get-release-vars name: Configure Release Vars run: | - echo release_version=v$(grep -E "version=\"[0-9]+\.[0-9]+\.[0-9]+\"" setup.py | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") >> "$GITHUB_OUTPUT" + echo release_version=v$(grep -E "version=\"[0-9]+\.[0-9]+\.[0-9]+\"" pyproject.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") >> "$GITHUB_OUTPUT" echo previous_version=$(git tag --sort=-creatordate | head -n 2 | tail -n 1) >> "$GITHUB_OUTPUT" - name: Create GitHub Release diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 2f9e9ae4..6fb56c4d 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -30,8 +30,8 @@ jobs: - name: Update version and push id: make-commit run: | - sed -i 's/version="[0-9]\+\.[0-9]\+\.[0-9]\+"/version="${{ github.event.inputs.versionName }}"/g' setup.py - git add setup.py + sed -i 's/version="[0-9]\+\.[0-9]\+\.[0-9]\+"/version="${{ github.event.inputs.versionName }}"/g' pyproject.toml + git add pyproject.toml git commit -S --message "Prepare release ${{ github.event.inputs.versionName }}" echo "commit=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" git push origin release/${{ github.event.inputs.versionName }} diff --git a/README.md b/README.md index d859c94d..e4c09589 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# CodecovCLI +# CodecovCLI [![codecov](https://codecov.io/gh/codecov/codecov-cli/branch/master/graph/badge.svg?token=jN0CICuA6Z)](https://codecov.io/gh/codecov/codecov-cli) [![Build-Test-Upload](https://github.com/codecov/codecov-cli/actions/workflows/push_flow.yml/badge.svg)](https://github.com/codecov/codecov-cli/actions/workflows/push_flow.yml) @@ -39,12 +39,12 @@ To use codecov-cli in your local machine, or your CI workflows, you need to inst `pip install codecov-cli` -The above command will download the latest version of Codecov-cli. If you wish to use a specific version, releases can be viewed [here](https://pypi.org/project/codecov-cli/#history). +The above command will download the latest version of Codecov-cli. If you wish to use a specific version, releases can be viewed [here](https://pypi.org/project/codecov-cli/#history). -Note: If you're installing in a `pyenv` environment, you may need to call `pyenv rehash` before the CLI will work. +Note: If you're installing in a `pyenv` environment, you may need to call `pyenv rehash` before the CLI will work. ## As a Binary -If you would like to use the CLI in an environment that does not have access to Python / PIP, you can install the CLI as a compiled binary. Linux and macOS releases can be found [here](https://cli.codecov.io/), along with SHASUMs and signatures for each released version. Binary releases are also available via [Github releases](https://github.com/codecov/codecov-cli/releases) on this repository. +If you would like to use the CLI in an environment that does not have access to Python / PIP, you can install the CLI as a compiled binary. Linux and macOS releases can be found [here](https://cli.codecov.io/), along with SHASUMs and signatures for each released version. Binary releases are also available via [Github releases](https://github.com/codecov/codecov-cli/releases) on this repository. You can retrieve the Binary for Linux directly from your command line as follows: @@ -73,7 +73,7 @@ For macos you will want to use the macos distributions of the binary (e.g., http # How to Upload to Codecov -If desired, the CLI can be used as a replacement for our [NodeJS Binary Uploader](https://github.com/codecov/uploader). To use the CLI to upload from your CI workflow, you need to add these commands: +If desired, the CLI can be used as a replacement for our [NodeJS Binary Uploader](https://github.com/codecov/uploader). To use the CLI to upload from your CI workflow, you need to add these commands: ``` pip install codecov-cli @@ -81,26 +81,26 @@ codecovcli create-commit codecovcli create-report codecovcli do-upload ``` -OR +OR ``` pip install codecov-cli codecovcli upload-process ``` -codecovcli upload-process is a wrapper for create-commit, create-report and do-upload. +codecovcli upload-process is a wrapper for create-commit, create-report and do-upload. -You can customize the commands with the options aligned with each command. +You can customize the commands with the options aligned with each command. -Note that these commands will automatically search your environment for a `$CODECOV_TOKEN` environment variable and use it if found. If you do not have a repository upload token, or global upload token, stored as an environment variable, you will need to pass it into **each command manually**, like so: `-t {$CODECOV_TOKEN}`. +Note that these commands will automatically search your environment for a `$CODECOV_TOKEN` environment variable and use it if found. If you do not have a repository upload token, or global upload token, stored as an environment variable, you will need to pass it into **each command manually**, like so: `-t {$CODECOV_TOKEN}`. ## How to Get an Upload Token The following tokens are suitable for uploading: -* The [Repository Upload Token](https://docs.codecov.com/docs/codecov-uploader#upload-token): Found on the settings page of your repository, also viewable on the `/new` page when setting up a repository on Codecov for the first time. -* The [Global Upload Token](https://docs.codecov.com/docs/codecov-uploader#organization-upload-token): Found on your organization settings page (e.g., `https://app.codecov.io/account///org-upload-token`). +* The [Repository Upload Token](https://docs.codecov.com/docs/codecov-uploader#upload-token): Found on the settings page of your repository, also viewable on the `/new` page when setting up a repository on Codecov for the first time. +* The [Global Upload Token](https://docs.codecov.com/docs/codecov-uploader#organization-upload-token): Found on your organization settings page (e.g., `https://app.codecov.io/account///org-upload-token`). -# Usage -If the installation is successful, running `codecovcli --help` will output the available commands along with the different general options that can be used with them. +# Usage +If the installation is successful, running `codecovcli --help` will output the available commands along with the different general options that can be used with them. ``` Usage: codecovcli [OPTIONS] COMMAND [ARGS]... ``` @@ -112,55 +112,55 @@ Codecov-cli supports user input. These inputs, along with their descriptions and | `--codecov-yml-path` | The path for your codecov.yml | Optional | `--enterprise-url` | Change the upload host (Enterprise use) | Optional | `--version` | Codecov-cli's version | Optional -| `--verbose` or `-v` | Run the cli with verbose logging | Optional +| `--verbose` or `-v` | Run the cli with verbose logging | Optional # Codecov-cli Commands -| Command | Description | -| :---: | :---: | -| `create-commit` | Saves the commit's metadata in codecov, it's only necessary to run this once per commit -| `create-report` | Creates an empty report in codecov with initial data e.g. report name, report's commit -| `do-upload` | Searches for and uploads coverage data to codecov +| Command | Description | +| :---: | :---: | +| `create-commit` | Saves the commit's metadata in codecov, it's only necessary to run this once per commit +| `create-report` | Creates an empty report in codecov with initial data e.g. report name, report's commit +| `do-upload` | Searches for and uploads coverage data to codecov | `create-report-results` | Used for local upload. It tells codecov that you finished local uploading and want it to calculate the results for you to get them locally. -| `get-report-results` | Used for local upload. It asks codecov to provide you the report results you calculated with the previous command. +| `get-report-results` | Used for local upload. It asks codecov to provide you the report results you calculated with the previous command. | `pr-base-picking` | Tells codecov that you want to explicitly define a base for your PR | `upload-process` | A wrapper for 3 commands. Create-commit, create-report and do-upload. You can use this command to upload to codecov instead of using the previosly mentioned commands. | `send-notifications` | A command that tells Codecov that you finished uploading and you want to be sent notifications. To disable automatically sent notifications please consider adding manual_trigger to your codecov.yml, so it will look like codecov: notify: manual_trigger: true. ->**Note**: Every command has its own different options that will be mentioned later in this doc. Codecov will try to load these options from your CI environment variables, if not, it will try to load them from git, if not found, you may need to add them manually. +>**Note**: Every command has its own different options that will be mentioned later in this doc. Codecov will try to load these options from your CI environment variables, if not, it will try to load them from git, if not found, you may need to add them manually. -## create-commit +## create-commit `codecovcli create-commit [Options]` | Option | Description | Usage -| :---: | :---: | :---: | +| :---: | :---: | :---: | | -C, --sha, --commit-sha | Commit SHA (with 40 chars) | Required |--parent-sha | SHA (with 40 chars) of what should be the parent of this commit | Optional |-P, --pr, --pull-request-number| Specify the pull request number manually. Used to override pre-existing CI environment variables | Optional |-B, --branch | Branch to which this commit belongs to | Optional |-r, --slug | owner/repo slug used instead of the private repo token in Self-hosted | Required -|-t, --token | Codecov upload token | Required +|-t, --token | Codecov upload token | Required |--git-service | Git Provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Required -|-h, --help | Shows usage, and command options +|-h, --help | Shows usage, and command options ## create-report `codecovcli create-report [OPTIONS]` | Option | Description | Usage -| :---: | :---: | :---: | +| :---: | :---: | :---: | | -C, --sha, --commit-sha | Commit SHA (with 40 chars) | Required |-r, --slug | owner/repo slug used instead of the private repo token in Self-hosted | Required -|-t, --token | Codecov upload token | Required +|-t, --token | Codecov upload token | Required |--git-service | Git Provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Required |--code| The code of the report. This is used in local uploading to isolate local reports from regular or cloud reports uploaded to codecov so they don't get merged. It's basically a name you give to your report e.g. local-report. | Optional -|-h, --help | Shows usage, and command options +|-h, --help | Shows usage, and command options ## do-upload `codecovcli do-upload [OPTIONS]` | Option | Description | Usage -| :---: | :---: | :---: | +| :---: | :---: | :---: | |-C, --sha, --commit-sha| Commit SHA (with 40 chars) | Required |--report-code | The code of the report defined when creating the report. If unsure, leave default | Optional |--network-root-folder | Root folder from which to consider paths on the network section default: (Current working directory) | Optional @@ -183,13 +183,13 @@ Codecov-cli supports user input. These inputs, along with their descriptions and |-d, --dry-run | Don't upload files to Codecov | Optional |--legacy, --use-legacy-uploader | Use the legacy upload endpoint | Optional |--git-service | Git Provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Required -|-h, --help | Shows usage, and command options +|-h, --help | Shows usage, and command options ## create-report-results `codecovcli create-report-results [OPTIONS]` | Option | Description | Usage -| :---: | :---: | :---: | +| :---: | :---: | :---: | |--commit-sha | Commit SHA (with 40 chars) | Required |--code | The code of the report. If unsure, leave default | Required |--slug | owner/repo slug | Required @@ -201,7 +201,7 @@ Codecov-cli supports user input. These inputs, along with their descriptions and `codecovcli get-report-results [OPTIONS]` | Option | Description | Usage -| :---: | :---: | :---: | +| :---: | :---: | :---: | |--commit-sha | Commit SHA (with 40 chars) | Required |--code | The code of the report. If unsure, leave default | Required |--slug | owner/repo slug | Required @@ -213,7 +213,7 @@ Codecov-cli supports user input. These inputs, along with their descriptions and `codecovcli pr-base-picking [OPTIONS]` | Option | Description | Usage -| :---: | :---: | :---: | +| :---: | :---: | :---: | |--base-sha | Base commit SHA (with 40 chars) | Required |--pr | Pull Request id to associate commit with | Required |--slug | owner/repo slug | Required @@ -221,11 +221,11 @@ Codecov-cli supports user input. These inputs, along with their descriptions and |--service | Git provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Optional |-h, --help | Shows usage, and command options -## send-notifications +## send-notifications `codecovcli send-notifications [OPTIONS]` | Option | Description | Usage -| :---: | :---: | :---: | +| :---: | :---: | :---: | | -C, --sha, --commit-sha TEXT |Commit SHA (with 40 chars) | Required | -r, --slug TEXT |owner/repo slug used instead of the private repo token in Self-hosted | Required | -t, --token TEXT |Codecov upload token | Required @@ -252,7 +252,7 @@ are ignored by codecov (including README and configuration files) # How to Use Local Upload -The CLI also supports "dry run" local uploading. This is useful if you prefer to see Codecov status checks and coverage reporting locally, in your terminal, as opposed to opening a PR and waiting for your full CI to run. Local uploads do not interfere with regular uploads made from your CI for any given commit / Pull Request. +The CLI also supports "dry run" local uploading. This is useful if you prefer to see Codecov status checks and coverage reporting locally, in your terminal, as opposed to opening a PR and waiting for your full CI to run. Local uploads do not interfere with regular uploads made from your CI for any given commit / Pull Request. Local Upload is accomplished as follows: @@ -267,11 +267,11 @@ codecovcli get-report-results --code Codecov will calculate the coverage results, and return them in your terminal, telling you whether your PR will fail or pass the coverage check. -Note: In order for Local Upload to work, it must be used against a commit on the origin repository. Local Upload does not work for arbitrary diffs or uncommitted changes on your local machine. +Note: In order for Local Upload to work, it must be used against a commit on the origin repository. Local Upload does not work for arbitrary diffs or uncommitted changes on your local machine. # Work in Progress Features -The following features are somewhat implemented in code, but are not yet meant for use. These features will be documented once they are fully implemented in the CLI. +The following features are somewhat implemented in code, but are not yet meant for use. These features will be documented once they are fully implemented in the CLI. ## Plugin System @@ -279,11 +279,11 @@ To provide extensibility to some of its commands, the CLI makes use of a plugin ## Static Analysis -The CLI can perform basic static analysis on Python code today. This static analysis is meant to power more future looking Codecov features and, as such, is not required or in active use today. As more functionality dependent on static analysis becomes available for use, we will document static analysis in detail here. +The CLI can perform basic static analysis on Python code today. This static analysis is meant to power more future looking Codecov features and, as such, is not required or in active use today. As more functionality dependent on static analysis becomes available for use, we will document static analysis in detail here. # Contributions -This repository, like all of Codecov's repositories, strives to follow our general [Contributing guidelines](https://github.com/codecov/contributing). If you're considering making a contribution to this repository, we encourage review of our Contributing guidelines first. +This repository, like all of Codecov's repositories, strives to follow our general [Contributing guidelines](https://github.com/codecov/contributing). If you're considering making a contribution to this repository, we encourage review of our Contributing guidelines first. ## Requirements @@ -296,8 +296,8 @@ git submodule update --init ``` Then, install dependencies with ``` -pip install -r requirements.txt -python setup.py develop +pip install -r requirements.txt +python -m pip install --editable . ``` The C code shouldn't require any additional setup to get running, but depending on your environment, you may be prompted to install compilers and supporting tools. If errors are generated during installation, it is likely due to missing dependencies / tools required of the C code. In many cases, resulting error messages should be clear enough to determine what is missing and how to install it, but common errors will be collected here as they are encountered. @@ -306,7 +306,7 @@ The C code shouldn't require any additional setup to get running, but depending There are a few guidelines when developing in this system. Some notable folders: -1. `commands` - It's the folder that interacts with the caller. This is where the commands themselves should reside. These commands are not meant to do heavy lifting. They only do wiring, which is mostly parsing the input parameters. +1. `commands` - It's the folder that interacts with the caller. This is where the commands themselves should reside. These commands are not meant to do heavy lifting. They only do wiring, which is mostly parsing the input parameters. 2. `services` - It's where the heavy logic resides. It's mostly organized by which command needs them. Commands should generally be thin wrappers around these services. 3. `helpers` - This is meant for logic that is useful across different commands. For example, logging helpers, or the logic that searches folders. @@ -318,7 +318,7 @@ dependencies in the `--no-binary` flag when building the requirements for the ma # Releases The standard way to making a new release is the following: -1) Open a PR that increases the version number in setup.py. As a rule of thumb, just add one to the micro/patch version (e.g., v0.1.6 -> v0.1.7). +1) Open a PR that increases the version number in pyproject.toml. As a rule of thumb, just add one to the micro/patch version (e.g., v0.1.6 -> v0.1.7). 2) Get the up-to-date master branch locally and run the `tag.release` command from the Makefile. diff --git a/scripts/build_linux_arm.sh b/scripts/build_linux_arm.sh index f90abd02..58b4625f 100755 --- a/scripts/build_linux_arm.sh +++ b/scripts/build_linux_arm.sh @@ -6,4 +6,4 @@ python setup.py build STATICCODECOV_LIB_PATH=$(find build/ -maxdepth 1 -type d -name 'lib.*' -print -quit | xargs -I {} sh -c "find {} -type f -name 'staticcodecov*' -print -quit | sed 's|^./||'") pip install pyinstaller pyinstaller --add-binary ${STATICCODECOV_LIB_PATH}:. --copy-metadata codecov-cli --hidden-import staticcodecov_languages -F codecov_cli/main.py -cp ./dist/main ./dist/codecovcli_$1 \ No newline at end of file +cp ./dist/main ./dist/codecovcli_$1 From 0cccacfb1c7f1f9899e357ff7006cd66165d3d9b Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 22:07:22 -0300 Subject: [PATCH 20/48] fix: show all files --- .github/workflows/build_for_pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index b9e69d40..6b7b57da 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -72,7 +72,7 @@ jobs: uses: actions/download-artifact@v4 - name: Display all files run: | - ls -al + ls -d ./*/* - name: Sign the dists with Sigstore uses: sigstore/gh-action-sigstore-python@v3.0.0 with: From 29aefe9f5fb2ccab01d8059148b51c9a6bbc3497 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sun, 26 Jan 2025 22:20:50 -0300 Subject: [PATCH 21/48] fix: add push tags --- .github/workflows/build_assets.yml | 4 ++++ .github/workflows/build_for_pypi.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/build_assets.yml b/.github/workflows/build_assets.yml index e903737e..2472b526 100644 --- a/.github/workflows/build_assets.yml +++ b/.github/workflows/build_assets.yml @@ -5,6 +5,10 @@ on: pull_request: branches: - main + push: + # Pattern matched against refs/tags + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' jobs: build_assets: diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 6b7b57da..dca7b109 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -5,6 +5,10 @@ on: pull_request: branches: - main + push: + # Pattern matched against refs/tags + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' jobs: build_dist_for_pypi: From c8f1ee644d352dccaa1f6e8adbd419b40f5d6311 Mon Sep 17 00:00:00 2001 From: Tom Hu <88201630+thomasrockhu-codecov@users.noreply.github.com> Date: Mon, 27 Jan 2025 19:32:26 -0300 Subject: [PATCH 22/48] Update pyproject.toml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index fd4c8c9b..4ea4e82d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,6 +5,8 @@ build-backend = "setuptools.build_meta" [project] authors = [ {name = "Tom Hu", email = "thomas.hu@sentry.io"}, +] +maintainers = [ {name = "Codecov Support", email = "support@codecov.io"}, ] description = "Codecov Command Line Interface" From 18e1b6fef6348c638f826e24b983b2cdeeafb5d8 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 19:33:02 -0300 Subject: [PATCH 23/48] fix: address some comments --- .github/workflows/build_assets.yml | 8 ++++---- .github/workflows/build_for_pypi.yml | 2 +- codecov_cli/_version.py | 16 ++++++++++++++++ pyproject.toml | 10 +++++++--- 4 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 codecov_cli/_version.py diff --git a/.github/workflows/build_assets.yml b/.github/workflows/build_assets.yml index 2472b526..ca757c80 100644 --- a/.github/workflows/build_assets.yml +++ b/.github/workflows/build_assets.yml @@ -69,12 +69,12 @@ jobs: run: ${{matrix.CMD_BUILD}} - name: Upload a Build Artifact uses: actions/upload-artifact@v4 - if: startsWith(github.ref, 'refs/tags/') + if: github.ref_type == 'tag' with: name: ${{ matrix.OUT_FILE_NAME }} path: ./dist/${{ matrix.OUT_FILE_NAME }} - name: Upload Release Asset - if: startsWith(github.ref, 'refs/tags/') + if: github.ref_type == 'tag' id: upload-release-asset uses: svenstaro/upload-release-action@v2 with: @@ -119,12 +119,12 @@ jobs: ./scripts/build_${{ matrix.distro_name }}_arm.sh ${{ matrix.distro_name }}_${{ matrix.arch }} - name: Upload a Build Artifact uses: actions/upload-artifact@v4 - if: startsWith(github.ref, 'refs/tags/') + if: github.ref_type == 'tag' with: name: codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }} path: ./dist/codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }} - name: Upload Release Asset - if: startsWith(github.ref, 'refs/tags/') + if: github.ref_type == 'tag' id: upload-release-asset uses: svenstaro/upload-release-action@v2 with: diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index dca7b109..e3f0dd97 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -84,7 +84,7 @@ jobs: ./**/*.tar.gz ./**/*.whl - name: Publish package to PyPi - if: startsWith(github.ref, 'refs/tags/') + if: github.ref_type == 'tag' uses: pypa/gh-action-pypi-publish@release/v1 with: attestations: false diff --git a/codecov_cli/_version.py b/codecov_cli/_version.py new file mode 100644 index 00000000..3fd66879 --- /dev/null +++ b/codecov_cli/_version.py @@ -0,0 +1,16 @@ +# file generated by setuptools_scm +# don't change, don't track in version control +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import Tuple, Union + VERSION_TUPLE = Tuple[Union[int, str], ...] +else: + VERSION_TUPLE = object + +version: str +__version__: str +__version_tuple__: VERSION_TUPLE +version_tuple: VERSION_TUPLE + +__version__ = version = '10.0.2.dev22+g29aefe9.d20250127' +__version_tuple__ = version_tuple = (10, 0, 2, 'dev22', 'g29aefe9.d20250127') diff --git a/pyproject.toml b/pyproject.toml index 4ea4e82d..bfb8df81 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools"] +requires = ["setuptools>=64", "setuptools_scm>=8"] build-backend = "setuptools.build_meta" [project] @@ -10,7 +10,7 @@ maintainers = [ {name = "Codecov Support", email = "support@codecov.io"}, ] description = "Codecov Command Line Interface" -requires-python = ">= 3.9" +dynamic = ["version"] dependencies = [ "click==8.*", "httpx==0.27.*", @@ -26,10 +26,14 @@ dependencies = [ license = {file = "LICENSE"} name = "codecov-cli" readme = "README.md" -version = "10.0.1" +requires-python = ">= 3.9" [project.scripts] +codecov = "codecov_cli.main:run" codecovcli = "codecov_cli.main:run" [tool.setuptools] packages = ["codecov_cli"] + +[tool.setuptools_scm] +version_file = "codecov_cli/_version.py" From 84b3110b6afcc2e5b1595a9d38a0ae906e8314b1 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 20:16:11 -0300 Subject: [PATCH 24/48] fix: more comments --- .github/workflows/build_for_pypi.yml | 2 ++ .pip-tools.toml | 3 +++ codecov_cli/_version.py | 4 ++-- requirements.txt | 9 ++++++++- 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 .pip-tools.toml diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index e3f0dd97..ee13accb 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -53,6 +53,8 @@ jobs: - name: Build src dist run: | python -m build --sdist + env: + PIP_CONSTRAINT: requirements.txt - name: Get version id: version run: | diff --git a/.pip-tools.toml b/.pip-tools.toml new file mode 100644 index 00000000..6b42ec0b --- /dev/null +++ b/.pip-tools.toml @@ -0,0 +1,3 @@ +[tool.pip-tools] +all-build-deps = true +all-extras = true diff --git a/codecov_cli/_version.py b/codecov_cli/_version.py index 3fd66879..b1a84d87 100644 --- a/codecov_cli/_version.py +++ b/codecov_cli/_version.py @@ -12,5 +12,5 @@ __version_tuple__: VERSION_TUPLE version_tuple: VERSION_TUPLE -__version__ = version = '10.0.2.dev22+g29aefe9.d20250127' -__version_tuple__ = version_tuple = (10, 0, 2, 'dev22', 'g29aefe9.d20250127') +__version__ = version = '10.0.2.dev24+g18e1b6f.d20250127' +__version_tuple__ = version_tuple = (10, 0, 2, 'dev24', 'g18e1b6f.d20250127') diff --git a/requirements.txt b/requirements.txt index 8942ca8f..1dc8f028 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile with Python 3.11 # by the following command: # -# pip-compile pyproject.toml +# pip-compile --all-build-deps --all-extras pyproject.toml # anyio==4.8.0 # via httpx @@ -29,6 +29,8 @@ idna==3.10 # requests ijson==3.3.0 # via codecov-cli (pyproject.toml) +packaging==24.2 + # via setuptools-scm pyyaml==6.0.2 # via codecov-cli (pyproject.toml) regex==2024.11.6 @@ -39,6 +41,8 @@ responses==0.21.0 # via codecov-cli (pyproject.toml) sentry-sdk==2.20.0 # via codecov-cli (pyproject.toml) +setuptools-scm==8.1.0 + # via codecov-cli (pyproject.toml::build-system.requires) sniffio==1.3.1 # via # anyio @@ -56,3 +60,6 @@ urllib3==2.3.0 # sentry-sdk wrapt==1.17.2 # via codecov-cli (pyproject.toml) + +# The following packages are considered to be unsafe in a requirements file: +# setuptools From ae13da2ed42a7ef384cb2b86b53b0f9ceb0fae98 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 20:28:00 -0300 Subject: [PATCH 25/48] fix: versioning --- .github/workflows/create_release_pr.yml | 2 -- codecov_cli/_version.py | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 6fb56c4d..4951b2e9 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -30,8 +30,6 @@ jobs: - name: Update version and push id: make-commit run: | - sed -i 's/version="[0-9]\+\.[0-9]\+\.[0-9]\+"/version="${{ github.event.inputs.versionName }}"/g' pyproject.toml - git add pyproject.toml git commit -S --message "Prepare release ${{ github.event.inputs.versionName }}" echo "commit=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" git push origin release/${{ github.event.inputs.versionName }} diff --git a/codecov_cli/_version.py b/codecov_cli/_version.py index b1a84d87..e15d666a 100644 --- a/codecov_cli/_version.py +++ b/codecov_cli/_version.py @@ -12,5 +12,5 @@ __version_tuple__: VERSION_TUPLE version_tuple: VERSION_TUPLE -__version__ = version = '10.0.2.dev24+g18e1b6f.d20250127' -__version_tuple__ = version_tuple = (10, 0, 2, 'dev24', 'g18e1b6f.d20250127') +__version__ = version = '10.0.2.dev25+g84b3110.d20250127' +__version_tuple__ = version_tuple = (10, 0, 2, 'dev25', 'g84b3110.d20250127') From d1de10c8384011be7ce665bfa2eb26737ea70542 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 21:59:17 -0300 Subject: [PATCH 26/48] fix: versioning --- .github/workflows/build_for_pypi.yml | 82 +++++++++++-------------- .github/workflows/create_release_pr.yml | 2 + codecov_cli/_version.py | 16 ----- pyproject.toml | 10 ++- 4 files changed, 45 insertions(+), 65 deletions(-) delete mode 100644 codecov_cli/_version.py diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index ee13accb..1f1d7002 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -11,30 +11,6 @@ on: - 'v[0-9]+.[0-9]+.[0-9]+' jobs: - build_dist_for_pypi: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-13, macos-latest] - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - submodules: true - - name: Set up Python 3.11 - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - name: Build wheels - uses: pypa/cibuildwheel@v2.22.0 - env: - CIBW_SKIP: pp* - - name: Store the distribution packages - uses: actions/upload-artifact@v4 - with: - name: cibw-wheels-${{ matrix.os }} - path: ./wheelhouse/*.whl - build_src_for_pypi: runs-on: ubuntu-latest steps: @@ -42,52 +18,66 @@ jobs: with: persist-credentials: false submodules: true - - name: Set up Python 3.11 - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - name: Install deps + - name: Install dependencies run: | - pip install -r requirements.txt pip install build - name: Build src dist run: | python -m build --sdist env: PIP_CONSTRAINT: requirements.txt - - name: Get version - id: version - run: | - version=$(python -c 'import importlib.metadata; print(importlib.metadata.version("codecov-cli"))') - echo "version=$version" >> "$GITHUB_OUTPUT" - name: Store the distribution packages uses: actions/upload-artifact@v4 with: name: cibw-sdist path: dist/ + build_dist_for_pypi: + needs: + - build_src_for_pypi + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - macos-13 + - macos-latest + - ubuntu-24.04-arm + - ubuntu-latest + - windows-latest + steps: + - name: Download the sdist + uses: actions/download-artifact@v4 + with: + name: cibw-sdist + - name: Build wheels + uses: pypa/cibuildwheel@v2.22.0 + with: + package-dir: dists/codecov*.tar.gz + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }} + path: ./wheelhouse/*.whl + + publish_to_pypi: needs: - build_dist_for_pypi - build_src_for_pypi permissions: - id-token: write # This is required for requesting the JWT + id-token: write # This is required for OIDC runs-on: ubuntu-latest steps: - - name: Download all the dists + - name: Download source + uses: actions/download-artifact@v4 + with: + pattern: *.tar.gz + - name: Download all wheels uses: actions/download-artifact@v4 - - name: Display all files - run: | - ls -d ./*/* - - name: Sign the dists with Sigstore - uses: sigstore/gh-action-sigstore-python@v3.0.0 with: - inputs: >- - ./**/*.tar.gz - ./**/*.whl + pattern: *.whl - name: Publish package to PyPi if: github.ref_type == 'tag' uses: pypa/gh-action-pypi-publish@release/v1 with: - attestations: false verbose: true diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 4951b2e9..6fb56c4d 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -30,6 +30,8 @@ jobs: - name: Update version and push id: make-commit run: | + sed -i 's/version="[0-9]\+\.[0-9]\+\.[0-9]\+"/version="${{ github.event.inputs.versionName }}"/g' pyproject.toml + git add pyproject.toml git commit -S --message "Prepare release ${{ github.event.inputs.versionName }}" echo "commit=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" git push origin release/${{ github.event.inputs.versionName }} diff --git a/codecov_cli/_version.py b/codecov_cli/_version.py deleted file mode 100644 index e15d666a..00000000 --- a/codecov_cli/_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# file generated by setuptools_scm -# don't change, don't track in version control -TYPE_CHECKING = False -if TYPE_CHECKING: - from typing import Tuple, Union - VERSION_TUPLE = Tuple[Union[int, str], ...] -else: - VERSION_TUPLE = object - -version: str -__version__: str -__version_tuple__: VERSION_TUPLE -version_tuple: VERSION_TUPLE - -__version__ = version = '10.0.2.dev25+g84b3110.d20250127' -__version_tuple__ = version_tuple = (10, 0, 2, 'dev25', 'g84b3110.d20250127') diff --git a/pyproject.toml b/pyproject.toml index bfb8df81..4488d203 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=64", "setuptools_scm>=8"] +requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] @@ -27,6 +27,7 @@ license = {file = "LICENSE"} name = "codecov-cli" readme = "README.md" requires-python = ">= 3.9" +version = "10.0.1" [project.scripts] codecov = "codecov_cli.main:run" @@ -35,5 +36,8 @@ codecovcli = "codecov_cli.main:run" [tool.setuptools] packages = ["codecov_cli"] -[tool.setuptools_scm] -version_file = "codecov_cli/_version.py" +[tool.cibuildwheel] +skip = "pp*" + +[tool.cibuildwheel.config-settings] +pure-python = "false" From eed38e04d90e1ff92cf5e8178405f8fd1e97bb17 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 22:00:43 -0300 Subject: [PATCH 27/48] fix: remove dynamic --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4488d203..2d4686c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,6 @@ maintainers = [ {name = "Codecov Support", email = "support@codecov.io"}, ] description = "Codecov Command Line Interface" -dynamic = ["version"] dependencies = [ "click==8.*", "httpx==0.27.*", From c6db4994b052bccffe6fde2f10c2764aa25e2140 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 22:07:37 -0300 Subject: [PATCH 28/48] fix: change pattern --- .github/workflows/build_for_pypi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 1f1d7002..529d96c5 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -71,11 +71,11 @@ jobs: - name: Download source uses: actions/download-artifact@v4 with: - pattern: *.tar.gz + pattern: .tar.gz - name: Download all wheels uses: actions/download-artifact@v4 with: - pattern: *.whl + pattern: .whl - name: Publish package to PyPi if: github.ref_type == 'tag' uses: pypa/gh-action-pypi-publish@release/v1 From 7cabf3fdcc0a51ee2534a08015e2d2287b8cae4a Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 22:11:07 -0300 Subject: [PATCH 29/48] fix: update the patterns --- .github/workflows/build_for_pypi.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 529d96c5..37e0da88 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -30,7 +30,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: cibw-sdist - path: dist/ + path: ./**/*.tar.gz build_dist_for_pypi: needs: @@ -71,11 +71,11 @@ jobs: - name: Download source uses: actions/download-artifact@v4 with: - pattern: .tar.gz + pattern: ./**/*.tar.gz - name: Download all wheels uses: actions/download-artifact@v4 with: - pattern: .whl + pattern: ./**/*.whl - name: Publish package to PyPi if: github.ref_type == 'tag' uses: pypa/gh-action-pypi-publish@release/v1 From 930fd0295a74b2fcbdc72fb89ac9bf93a1c9c4da Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 22:20:22 -0300 Subject: [PATCH 30/48] fix: dist/ --- .github/workflows/build_for_pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 37e0da88..c8a56f78 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -52,7 +52,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 with: - package-dir: dists/codecov*.tar.gz + package-dir: dist/codecov*.tar.gz - name: Store the distribution packages uses: actions/upload-artifact@v4 with: From 90ac85c22bce9e0db0d7e6cee7962e55925313e8 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 22:21:57 -0300 Subject: [PATCH 31/48] fix: just dist --- .github/workflows/build_for_pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index c8a56f78..950dc893 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -52,7 +52,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 with: - package-dir: dist/codecov*.tar.gz + package-dir: dist/ - name: Store the distribution packages uses: actions/upload-artifact@v4 with: From 1fcbe1786184596baa0ef5faca5adb4c4be19a2e Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 22:25:15 -0300 Subject: [PATCH 32/48] fix: ls --- .github/workflows/build_for_pypi.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 950dc893..1291cc0b 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -53,6 +53,8 @@ jobs: uses: pypa/cibuildwheel@v2.22.0 with: package-dir: dist/ + - name: ls + run: ls -al - name: Store the distribution packages uses: actions/upload-artifact@v4 with: From 6681711a50da461a7d6f51916f8f6c1073a328a7 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 22:46:27 -0300 Subject: [PATCH 33/48] fix: oops --- .github/workflows/build_for_pypi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 1291cc0b..9aa38991 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -49,12 +49,12 @@ jobs: uses: actions/download-artifact@v4 with: name: cibw-sdist + - name: ls + run: ls -al - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 with: package-dir: dist/ - - name: ls - run: ls -al - name: Store the distribution packages uses: actions/upload-artifact@v4 with: From a8b07858b1c09be8cb1f3b56d1e75754337259c9 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 22:48:45 -0300 Subject: [PATCH 34/48] fix: whats in the dist --- .github/workflows/build_for_pypi.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 9aa38991..8a9b660b 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -50,7 +50,9 @@ jobs: with: name: cibw-sdist - name: ls - run: ls -al + run: | + ls -al + ls -al dist/ - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 with: From 19b0087137ef9a51236553f1b0af2f32377f8357 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 22:54:06 -0300 Subject: [PATCH 35/48] fix: how about wildcard now --- .github/workflows/build_for_pypi.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 8a9b660b..bc2df489 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -49,14 +49,10 @@ jobs: uses: actions/download-artifact@v4 with: name: cibw-sdist - - name: ls - run: | - ls -al - ls -al dist/ - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 with: - package-dir: dist/ + package-dir: dist/*.tar.gz - name: Store the distribution packages uses: actions/upload-artifact@v4 with: From 159cc0a27ccd59433359ca774d8ab0951c9a9c9d Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 23:03:43 -0300 Subject: [PATCH 36/48] fix: now with codecov --- .github/workflows/build_for_pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index bc2df489..c8a56f78 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -52,7 +52,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 with: - package-dir: dist/*.tar.gz + package-dir: dist/codecov*.tar.gz - name: Store the distribution packages uses: actions/upload-artifact@v4 with: From 0c2f99dfeea986244d6a1fb0cd86c74d9aec2179 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 23:10:23 -0300 Subject: [PATCH 37/48] fix: hack it --- .github/workflows/build_for_pypi.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index c8a56f78..65f24648 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -49,10 +49,14 @@ jobs: uses: actions/download-artifact@v4 with: name: cibw-sdist + - name: Get sdist filename + id: get-sdist + run: | + echo "sdist_filename=$(ls dist/)" >> $GITHUB_OUTPUT - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 with: - package-dir: dist/codecov*.tar.gz + package-dir: dist/${{ get-dist.outputs.sdist_filename }} - name: Store the distribution packages uses: actions/upload-artifact@v4 with: From 63754d635c7b781d9382cfeb60a5c3ebbab5500c Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 27 Jan 2025 23:12:28 -0300 Subject: [PATCH 38/48] fix: use steps --- .github/workflows/build_for_pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 65f24648..590bbe72 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -56,7 +56,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 with: - package-dir: dist/${{ get-dist.outputs.sdist_filename }} + package-dir: dist/${{ steps.get-sdist.outputs.sdist_filename }} - name: Store the distribution packages uses: actions/upload-artifact@v4 with: From 5c40814c1372dd792af542ad108f1e8bd0afaf26 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 30 Jan 2025 16:22:10 -0300 Subject: [PATCH 39/48] fix: address comments --- .github/workflows/build_for_pypi.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 590bbe72..71d47985 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -52,7 +52,8 @@ jobs: - name: Get sdist filename id: get-sdist run: | - echo "sdist_filename=$(ls dist/)" >> $GITHUB_OUTPUT + echo "sdist_filename=$(ls dist/)" >> "${GITHUB_OUTPUT}" + shell: bash - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 with: @@ -72,14 +73,10 @@ jobs: id-token: write # This is required for OIDC runs-on: ubuntu-latest steps: - - name: Download source + - name: Download artifacts uses: actions/download-artifact@v4 with: - pattern: ./**/*.tar.gz - - name: Download all wheels - uses: actions/download-artifact@v4 - with: - pattern: ./**/*.whl + pattern: cibw-* - name: Publish package to PyPi if: github.ref_type == 'tag' uses: pypa/gh-action-pypi-publish@release/v1 From badf9186ba44fd65e392cb8dc4f23c449de30e2a Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 30 Jan 2025 16:35:10 -0300 Subject: [PATCH 40/48] fix: add env to cibuildwheel --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 2d4686c9..534bc3a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,11 @@ codecovcli = "codecov_cli.main:run" packages = ["codecov_cli"] [tool.cibuildwheel] +environment = { + "PIP_CONSTRAINT": "requirements.txt" +} skip = "pp*" + [tool.cibuildwheel.config-settings] pure-python = "false" From ca1386fac954389a6798c0d4a5c2ecba8865b4ab Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 30 Jan 2025 16:41:36 -0300 Subject: [PATCH 41/48] fix: formatting --- pyproject.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 534bc3a9..67a7ab2e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,9 +36,7 @@ codecovcli = "codecov_cli.main:run" packages = ["codecov_cli"] [tool.cibuildwheel] -environment = { - "PIP_CONSTRAINT": "requirements.txt" -} +environment = {PIP_CONSTRAINT = "requirements.txt"} skip = "pp*" From 4656ba8932f18e5e5b852f270fda6682166a41fc Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 30 Jan 2025 16:49:52 -0300 Subject: [PATCH 42/48] fix: nope --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 67a7ab2e..2d4686c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,9 +36,7 @@ codecovcli = "codecov_cli.main:run" packages = ["codecov_cli"] [tool.cibuildwheel] -environment = {PIP_CONSTRAINT = "requirements.txt"} skip = "pp*" - [tool.cibuildwheel.config-settings] pure-python = "false" From b0706b6f887cf125e98080cfe7db8033cd2ab19f Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Fri, 31 Jan 2025 18:44:54 -0300 Subject: [PATCH 43/48] fix: try with manifest --- MANIFEST.in | 1 + pyproject.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/MANIFEST.in b/MANIFEST.in index ce1470ff..be346cbe 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,3 @@ include languages/treesitterjavascript/src/tree_sitter/parser.h include languages/treesitterpython/src/tree_sitter/parser.h +include requirements.txt diff --git a/pyproject.toml b/pyproject.toml index 2d4686c9..a718c29a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,7 @@ codecovcli = "codecov_cli.main:run" packages = ["codecov_cli"] [tool.cibuildwheel] +environment = {PIP_CONSTRAINT = "requirements.txt"} skip = "pp*" [tool.cibuildwheel.config-settings] From 4be3b248b91c5bd111e667293c0b12f57ab3c2f5 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Fri, 31 Jan 2025 18:45:35 -0300 Subject: [PATCH 44/48] fix: address comments --- .github/workflows/build_for_pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 71d47985..67aa97cb 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -66,6 +66,7 @@ jobs: publish_to_pypi: + if: github.ref_type == 'tag' needs: - build_dist_for_pypi - build_src_for_pypi @@ -78,7 +79,6 @@ jobs: with: pattern: cibw-* - name: Publish package to PyPi - if: github.ref_type == 'tag' uses: pypa/gh-action-pypi-publish@release/v1 with: verbose: true From 3d160424c80281294c9456cb5ad5cc30ed984db7 Mon Sep 17 00:00:00 2001 From: Tom Hu <88201630+thomasrockhu-codecov@users.noreply.github.com> Date: Sat, 1 Feb 2025 00:01:59 -0300 Subject: [PATCH 45/48] Update .github/workflows/create_release.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) --- .github/workflows/create_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index cc0dcb68..0567fdf3 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -18,7 +18,7 @@ jobs: - id: get-release-vars name: Configure Release Vars run: | - echo release_version=v$(grep -E "version=\"[0-9]+\.[0-9]+\.[0-9]+\"" pyproject.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") >> "$GITHUB_OUTPUT" + echo release_version=v$(grep -E "version = \"[0-9]+\.[0-9]+\.[0-9]+\"" pyproject.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") >> "$GITHUB_OUTPUT" echo previous_version=$(git tag --sort=-creatordate | head -n 2 | tail -n 1) >> "$GITHUB_OUTPUT" - name: Create GitHub Release From beb3ccaa44d7d74ae9629b03fe340e32709e9c78 Mon Sep 17 00:00:00 2001 From: Tom Hu <88201630+thomasrockhu-codecov@users.noreply.github.com> Date: Sat, 1 Feb 2025 00:05:50 -0300 Subject: [PATCH 46/48] Update pyproject.toml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a718c29a..42ac2329 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,8 +36,10 @@ codecovcli = "codecov_cli.main:run" packages = ["codecov_cli"] [tool.cibuildwheel] -environment = {PIP_CONSTRAINT = "requirements.txt"} skip = "pp*" [tool.cibuildwheel.config-settings] pure-python = "false" + +[tool.cibuildwheel.environment] +PIP_CONSTRAINT = "requirements.txt" From 2614b42651d36340f7ff331ec483f7e5c7b738e2 Mon Sep 17 00:00:00 2001 From: Tom Hu <88201630+thomasrockhu-codecov@users.noreply.github.com> Date: Wed, 5 Feb 2025 18:18:13 -0300 Subject: [PATCH 47/48] Update .github/workflows/build_for_pypi.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) --- .github/workflows/build_for_pypi.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 67aa97cb..43344957 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -73,6 +73,9 @@ jobs: permissions: id-token: write # This is required for OIDC runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/codecov steps: - name: Download artifacts uses: actions/download-artifact@v4 From a0fe158b66a0fad8e49d42e8157458fe49ad0570 Mon Sep 17 00:00:00 2001 From: Tom Hu <88201630+thomasrockhu-codecov@users.noreply.github.com> Date: Thu, 6 Feb 2025 13:34:07 -0300 Subject: [PATCH 48/48] Update .github/workflows/build_for_pypi.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) --- .github/workflows/build_for_pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 43344957..b265bbde 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -75,7 +75,7 @@ jobs: runs-on: ubuntu-latest environment: name: pypi - url: https://pypi.org/p/codecov + url: https://pypi.org/p/codecov-cli steps: - name: Download artifacts uses: actions/download-artifact@v4