From 75ca44229b73e8a86c5bd7bbaeb877c07e6a45a3 Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 13:17:57 -0400 Subject: [PATCH 01/16] Move all workflows to .github/workflows.old and update ci-job.yml to work in new repo --- .../broadcast_api_changes.yml | 0 .../build_assets.yml | 0 .../build_for_pypi.yml | 0 .github/workflows.old/ci-job.yml | 43 +++++++++++++++++++ .github/{workflows => workflows.old}/ci.yml | 0 .../create_release.yml | 0 .../create_release_pr.yml | 0 .../release_flow.yml | 0 .github/workflows/ci-job.yml | 2 + .../tests/helpers/test_versioning_systems.py | 2 +- .../services/upload/test_upload_collector.py | 4 +- 11 files changed, 49 insertions(+), 2 deletions(-) rename .github/{workflows => workflows.old}/broadcast_api_changes.yml (100%) rename .github/{workflows => workflows.old}/build_assets.yml (100%) rename .github/{workflows => workflows.old}/build_for_pypi.yml (100%) create mode 100644 .github/workflows.old/ci-job.yml rename .github/{workflows => workflows.old}/ci.yml (100%) rename .github/{workflows => workflows.old}/create_release.yml (100%) rename .github/{workflows => workflows.old}/create_release_pr.yml (100%) rename .github/{workflows => workflows.old}/release_flow.yml (100%) diff --git a/.github/workflows/broadcast_api_changes.yml b/.github/workflows.old/broadcast_api_changes.yml similarity index 100% rename from .github/workflows/broadcast_api_changes.yml rename to .github/workflows.old/broadcast_api_changes.yml diff --git a/.github/workflows/build_assets.yml b/.github/workflows.old/build_assets.yml similarity index 100% rename from .github/workflows/build_assets.yml rename to .github/workflows.old/build_assets.yml diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows.old/build_for_pypi.yml similarity index 100% rename from .github/workflows/build_for_pypi.yml rename to .github/workflows.old/build_for_pypi.yml diff --git a/.github/workflows.old/ci-job.yml b/.github/workflows.old/ci-job.yml new file mode 100644 index 00000000..cea929f5 --- /dev/null +++ b/.github/workflows.old/ci-job.yml @@ -0,0 +1,43 @@ +# 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: CLI CI Job + +on: + pull_request: + push: + branches: + - main + +jobs: + build-test-upload: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 2 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + python -m pip install -e . + pip install -r tests/requirements.txt + - 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 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.xml + flags: python3.12 + fail_ci_if_error: true + verbose: true diff --git a/.github/workflows/ci.yml b/.github/workflows.old/ci.yml similarity index 100% rename from .github/workflows/ci.yml rename to .github/workflows.old/ci.yml diff --git a/.github/workflows/create_release.yml b/.github/workflows.old/create_release.yml similarity index 100% rename from .github/workflows/create_release.yml rename to .github/workflows.old/create_release.yml diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows.old/create_release_pr.yml similarity index 100% rename from .github/workflows/create_release_pr.yml rename to .github/workflows.old/create_release_pr.yml diff --git a/.github/workflows/release_flow.yml b/.github/workflows.old/release_flow.yml similarity index 100% rename from .github/workflows/release_flow.yml rename to .github/workflows.old/release_flow.yml diff --git a/.github/workflows/ci-job.yml b/.github/workflows/ci-job.yml index cea929f5..1fdf120b 100644 --- a/.github/workflows/ci-job.yml +++ b/.github/workflows/ci-job.yml @@ -23,12 +23,14 @@ jobs: python-version: "3.12" - name: Install dependencies run: | + cd codecov-cli python -m pip install --upgrade pip pip install -r requirements.txt python -m pip install -e . pip install -r tests/requirements.txt - name: Test with pytest run: | + cd codecov-cli pytest --cov --junitxml=3.12junit.xml env: CODECOV_ENV: test diff --git a/codecov-cli/tests/helpers/test_versioning_systems.py b/codecov-cli/tests/helpers/test_versioning_systems.py index 2437be89..4ab1a653 100644 --- a/codecov-cli/tests/helpers/test_versioning_systems.py +++ b/codecov-cli/tests/helpers/test_versioning_systems.py @@ -151,7 +151,7 @@ def test_exotic_git_filenames(): # See assert ( - "tests/data/Контроллеры/Пользователь/ГлавныйКонтроллер.php" in found_repo_files + "codecov-cli/tests/data/Контроллеры/Пользователь/ГлавныйКонтроллер.php" in found_repo_files ) diff --git a/codecov-cli/tests/services/upload/test_upload_collector.py b/codecov-cli/tests/services/upload/test_upload_collector.py index 1551e860..38d2f3e4 100644 --- a/codecov-cli/tests/services/upload/test_upload_collector.py +++ b/codecov-cli/tests/services/upload/test_upload_collector.py @@ -176,7 +176,9 @@ def test_generate_upload_data(tmp_path): file_finder = FileFinder(tmp_path) - network_finder = NetworkFinder(GitVersioningSystem(), False, None, None, None) + network_finder = NetworkFinder( + GitVersioningSystem(), False, None, None, Path("codecov-cli") + ) collector = UploadCollector([], network_finder, file_finder, None) From 642e257c72e90b0a6b78283a836c94e8f9f77a42 Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 13:32:53 -0400 Subject: [PATCH 02/16] Update ci.yml for new repo --- .github/workflows/ci.yml | 150 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..10d4d85c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,150 @@ +--- +# yamllint disable rule:line-length +# 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: CLI CI + +on: + pull_request: + push: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Check linting with ruff + run: | + make lint + + detect-command-change: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install dependencies + run: | + cd codecov-cli + python -m pip install --upgrade pip + pip install -r requirements.txt + python -m pip install -e . + - name: Run command_dump + run: | + cd codecov-cli + python command_dump.py + - name: Detect changes on commit + run: | + if [ -n "$(git diff codecovcli_commands)" ]; then + echo "Please run `python command_dump.py` before submitting, or install the hooks" + echo "$(git diff codecovcli_commands)" + exit 1 + fi + + # todo: dump commands for prevent-cli. Maybe compare prevent and cc? + + codecov-startup: + runs-on: ubuntu-latest + #if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'getsentry' }} + steps: + - uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 2 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install CLI + # todo: update this to dogfood prevent cli, maybe try both? + run: | + pip install codecov-cli + - name: Create commit in codecov + run: | + codecovcli create-commit -t ${{ secrets.CODECOV_TOKEN }} --git-service github + - name: Create commit report in codecov + run: | + codecovcli create-report -t ${{ secrets.CODECOV_TOKEN }} --git-service github + + build-test-upload: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: ["3.13", "3.12", "3.11", "3.10", "3.9"] + runs-on: ${{matrix.os}} + steps: + - uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 2 + - name: Set up Python ${{matrix.python-version}} + uses: actions/setup-python@v5 + with: + python-version: "${{matrix.python-version}}" + - name: Install dependencies + run: | + cd codecov-cli + python -m pip install --upgrade pip + pip install -r requirements.txt + python -m pip install -e . + pip install -r tests/requirements.txt + - name: Test with pytest + run: | + cd codecov-cli + pytest --cov --junitxml=${{matrix.os}}-${{matrix.python-version}}junit.xml + env: + CODECOV_ENV: test + - name: Dogfooding codecov-cli + #if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'getsentry' }} + run: | + codecovcli -v do-upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} + codecovcli do-upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} + # todo: dogfood prevent-cli + + # todo: I don't think we need this? + # - name: Upload artifacts for test-results-processing + # if: ${{ !cancelled() }} + # uses: actions/upload-artifact@v4 + # with: + # name: ${{matrix.os}}-${{matrix.python-version}}junit.xml + # path: ${{matrix.os}}-${{matrix.python-version}}junit.xml + + # todo: I don't think we need this either? we're uploading TA three times? + # process-test-results: + # if: ${{ always() }} + # needs: build-test-upload + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # with: + # submodules: true + # fetch-depth: 2 + # - uses: actions/setup-python@v5 + # with: + # python-version: "3.12" + # - name: Install dependencies for Dogfooding + # run: | + # python -m pip install --upgrade pip + # pip install -r requirements.txt + # python -m pip install -e . + # pip install -r tests/requirements.txt + # - name: Download all test results + # uses: actions/download-artifact@v4 + # with: + # pattern: "*junit.xml" + # path: "test_results" + # merge-multiple: true + # + # - name: Dogfooding codecov-cli + # if: ${{ !cancelled() && github.ref && contains(github.ref, 'pull') }} + # run: | + # codecovcli process-test-results --dir test_results --github-token ${{ secrets.GITHUB_TOKEN }} From 84ee8e621e9f6f0a261deb63c2fe3dda788cc869 Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 14:26:45 -0400 Subject: [PATCH 03/16] Apply da1f331 for prevent-cli --- prevent-cli/src/prevent_cli/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/prevent-cli/src/prevent_cli/main.py b/prevent-cli/src/prevent_cli/main.py index f7bd4a9d..bcf91cd8 100644 --- a/prevent-cli/src/prevent_cli/main.py +++ b/prevent-cli/src/prevent_cli/main.py @@ -65,8 +65,6 @@ def cli( cli.add_command(do_upload) cli.add_command(create_commit) cli.add_command(create_report) -cli.add_command(create_report_results) -cli.add_command(get_report_results) cli.add_command(pr_base_picking) cli.add_command(empty_upload) cli.add_command(upload_coverage) @@ -74,6 +72,10 @@ def cli( cli.add_command(send_notifications) cli.add_command(process_test_results) +# deprecated commands: +cli.add_command(create_report_results) +cli.add_command(get_report_results) + def run(): cli(obj={}) From a6b4790f870acae2117dcf5162b5d75312c84fd9 Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 14:28:25 -0400 Subject: [PATCH 04/16] Update command_dump to dumb both clis --- command_dump.py | 14 +++++++++----- prevent-cli/prevent-cli_commands | 30 ++++++++++++++++++++++++++++++ prevent-cli/pyproject.toml | 4 +--- prevent-cli/uv.lock | 3 +-- 4 files changed, 41 insertions(+), 10 deletions(-) mode change 100644 => 100755 command_dump.py create mode 100644 prevent-cli/prevent-cli_commands diff --git a/command_dump.py b/command_dump.py old mode 100644 new mode 100755 index 546fbd54..ae4f1814 --- a/command_dump.py +++ b/command_dump.py @@ -1,7 +1,8 @@ +#!/usr/bin/env python3 import subprocess -def command_dump(commands): +def command_dump(commands: list[str], out_path: str): print(f"Dumping {' '.join(commands)}") command_docs = subprocess.run( [*commands, "--help"], capture_output=True @@ -16,16 +17,19 @@ def command_dump(commands): if "Commands:" in split_docs: sub_commands = [ - sub_command.strip() for sub_command in split_docs[index_of + 1 :] if sub_command.strip() + sub_command.strip() + for sub_command in split_docs[index_of + 1 :] + if sub_command.strip() ] for sub_command in sub_commands: command_docs = "\n".join( - [command_docs, command_dump([*commands, sub_command])] + [command_docs, command_dump([*commands, sub_command], out_path)] ) - with open("codecovcli_commands", "w") as f: + with open(out_path, "w") as f: f.write(command_docs) if __name__ == "__main__": - command_dump(["codecovcli"]) + command_dump(["codecovcli"], "codecov-cli/codecovcli_commands") + command_dump(["prevent-cli"], "prevent-cli/prevent-cli_commands") diff --git a/prevent-cli/prevent-cli_commands b/prevent-cli/prevent-cli_commands new file mode 100644 index 00000000..0ee835d2 --- /dev/null +++ b/prevent-cli/prevent-cli_commands @@ -0,0 +1,30 @@ +Usage: prevent-cli [OPTIONS] COMMAND [ARGS]... + +Options: + --auto-load-params-from [CircleCI|GithubActions|GitlabCI|Bitbucket|Bitrise|AppVeyor|Woodpecker|Heroku|DroneCI|BuildKite|AzurePipelines|Jenkins|CirrusCI|Teamcity|Travis|AWSCodeBuild|GoogleCloudBuild|Local] + -u, --enterprise-url, --url TEXT + Change the upload host (Enterprise use) + -v, --verbose Use verbose logging + --disable-telem Disable sending telemetry data to Codecov + --version Show the version and exit. + --help Show this message and exit. + +Commands: + create-commit + create-report + do-upload + empty-upload + pr-base-picking + process-test-results + send-notifications + upload-coverage + upload-process + + + + + + + + + diff --git a/prevent-cli/pyproject.toml b/prevent-cli/pyproject.toml index dac6cb81..6ef79599 100644 --- a/prevent-cli/pyproject.toml +++ b/prevent-cli/pyproject.toml @@ -22,10 +22,9 @@ dependencies = [ ] - [project.scripts] prevent = "prevent_cli.main:run" -preventcli = "prevent_cli.main:run" +prevent-cli = "prevent_cli.main:run" [build-system] requires = ["setuptools"] @@ -38,4 +37,3 @@ packages = ["prevent_cli"] [tool.uv.sources] codecov-cli = {path = "../codecov-cli"} - diff --git a/prevent-cli/uv.lock b/prevent-cli/uv.lock index 539d99b2..c0bb4532 100644 --- a/prevent-cli/uv.lock +++ b/prevent-cli/uv.lock @@ -1,5 +1,4 @@ version = 1 -revision = 1 requires-python = ">=3.12" [[package]] @@ -74,7 +73,7 @@ wheels = [ [[package]] name = "codecov-cli" -version = "10.3.0" +version = "10.4.0" source = { directory = "../codecov-cli" } dependencies = [ { name = "click" }, From 43579230cfa3a4098179ee8ef6ea7784899ad940 Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 15:07:57 -0400 Subject: [PATCH 05/16] Rename executable --- prevent-cli/pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/prevent-cli/pyproject.toml b/prevent-cli/pyproject.toml index 6ef79599..226d30af 100644 --- a/prevent-cli/pyproject.toml +++ b/prevent-cli/pyproject.toml @@ -23,8 +23,7 @@ dependencies = [ [project.scripts] -prevent = "prevent_cli.main:run" -prevent-cli = "prevent_cli.main:run" +sentry-prevent-cli = "prevent_cli.main:run" [build-system] requires = ["setuptools"] From 49494dbdce5b3161f90b69737b66c5fbf877e039 Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 15:09:08 -0400 Subject: [PATCH 06/16] Update command dump comparison in ci.yml --- .github/workflows/ci.yml | 57 ++++++---------------------------------- 1 file changed, 8 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10d4d85c..047794f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,27 +34,24 @@ jobs: python-version: "3.11" - name: Install dependencies run: | - cd codecov-cli python -m pip install --upgrade pip - pip install -r requirements.txt - python -m pip install -e . + python -m pip install -e codecov-cli + python -m pip install -e prevent-cli - name: Run command_dump run: | - cd codecov-cli - python command_dump.py + ./command_dump.py - name: Detect changes on commit run: | - if [ -n "$(git diff codecovcli_commands)" ]; then + if [ -n "$(git diff codecov-cli/codecovcli_commands)" || -n "$(git diff prevent-cli/preventcli_commands)" ]; then echo "Please run `python command_dump.py` before submitting, or install the hooks" - echo "$(git diff codecovcli_commands)" + echo "$(git diff codecov-cli/codecovcli_commands)" + echo "$(git diff prevent-cli/preventcli_commands)" exit 1 fi - # todo: dump commands for prevent-cli. Maybe compare prevent and cc? - codecov-startup: runs-on: ubuntu-latest - #if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'getsentry' }} + if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'getsentry' }} steps: - uses: actions/checkout@v4 with: @@ -104,47 +101,9 @@ jobs: env: CODECOV_ENV: test - name: Dogfooding codecov-cli - #if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'getsentry' }} + if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'getsentry' }} run: | codecovcli -v do-upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} codecovcli do-upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} # todo: dogfood prevent-cli - # todo: I don't think we need this? - # - name: Upload artifacts for test-results-processing - # if: ${{ !cancelled() }} - # uses: actions/upload-artifact@v4 - # with: - # name: ${{matrix.os}}-${{matrix.python-version}}junit.xml - # path: ${{matrix.os}}-${{matrix.python-version}}junit.xml - - # todo: I don't think we need this either? we're uploading TA three times? - # process-test-results: - # if: ${{ always() }} - # needs: build-test-upload - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v4 - # with: - # submodules: true - # fetch-depth: 2 - # - uses: actions/setup-python@v5 - # with: - # python-version: "3.12" - # - name: Install dependencies for Dogfooding - # run: | - # python -m pip install --upgrade pip - # pip install -r requirements.txt - # python -m pip install -e . - # pip install -r tests/requirements.txt - # - name: Download all test results - # uses: actions/download-artifact@v4 - # with: - # pattern: "*junit.xml" - # path: "test_results" - # merge-multiple: true - # - # - name: Dogfooding codecov-cli - # if: ${{ !cancelled() && github.ref && contains(github.ref, 'pull') }} - # run: | - # codecovcli process-test-results --dir test_results --github-token ${{ secrets.GITHUB_TOKEN }} From 12e15cf57dd1b0bc255b3aae40944fda1bd6ea06 Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 15:11:33 -0400 Subject: [PATCH 07/16] Use python 3.12 in ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 047794f3..b9f0faab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,10 +28,10 @@ jobs: - uses: actions/checkout@v4 with: submodules: true - - name: Set up Python 3.11 + - name: Set up Python 3.12 uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - name: Install dependencies run: | python -m pip install --upgrade pip From 34bf08f186bd6165d9fedb031fa4ad447917400b Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 15:12:48 -0400 Subject: [PATCH 08/16] Update executable name in command_dump.py --- command_dump.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command_dump.py b/command_dump.py index ae4f1814..24e845d2 100755 --- a/command_dump.py +++ b/command_dump.py @@ -32,4 +32,4 @@ def command_dump(commands: list[str], out_path: str): if __name__ == "__main__": command_dump(["codecovcli"], "codecov-cli/codecovcli_commands") - command_dump(["prevent-cli"], "prevent-cli/prevent-cli_commands") + command_dump(["sentry-prevent-cli"], "prevent-cli/prevent-cli_commands") From 55c7d42469ce9bea4a1b3206b5a85dac50a8400d Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 15:17:06 -0400 Subject: [PATCH 09/16] Fix conditional --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9f0faab..0a732537 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: ./command_dump.py - name: Detect changes on commit run: | - if [ -n "$(git diff codecov-cli/codecovcli_commands)" || -n "$(git diff prevent-cli/preventcli_commands)" ]; then + if [ -n "$(git diff codecov-cli/codecovcli_commands)" ] || [ -n "$(git diff prevent-cli/preventcli_commands)" ]; then echo "Please run `python command_dump.py` before submitting, or install the hooks" echo "$(git diff codecov-cli/codecovcli_commands)" echo "$(git diff prevent-cli/preventcli_commands)" From 923418efaab3ae66cff2c89aaad2f373aedd0ecb Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 15:20:23 -0400 Subject: [PATCH 10/16] Fix command dump --- .github/workflows/ci.yml | 5 ++--- command_dump.py | 2 +- prevent-cli/{prevent-cli_commands => preventcli_commands} | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) rename prevent-cli/{prevent-cli_commands => preventcli_commands} (93%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a732537..90c5f8ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,10 +42,9 @@ jobs: ./command_dump.py - name: Detect changes on commit run: | - if [ -n "$(git diff codecov-cli/codecovcli_commands)" ] || [ -n "$(git diff prevent-cli/preventcli_commands)" ]; then + if [ -n "$(git diff codecov-cli/codecovcli_commands prevent-cli/preventcli_commands)" ]; then echo "Please run `python command_dump.py` before submitting, or install the hooks" - echo "$(git diff codecov-cli/codecovcli_commands)" - echo "$(git diff prevent-cli/preventcli_commands)" + echo "$(git diff codecov-cli/codecovcli_commands prevent-cli/preventcli_commands)" exit 1 fi diff --git a/command_dump.py b/command_dump.py index 24e845d2..57b85dfc 100755 --- a/command_dump.py +++ b/command_dump.py @@ -32,4 +32,4 @@ def command_dump(commands: list[str], out_path: str): if __name__ == "__main__": command_dump(["codecovcli"], "codecov-cli/codecovcli_commands") - command_dump(["sentry-prevent-cli"], "prevent-cli/prevent-cli_commands") + command_dump(["sentry-prevent-cli"], "prevent-cli/preventcli_commands") diff --git a/prevent-cli/prevent-cli_commands b/prevent-cli/preventcli_commands similarity index 93% rename from prevent-cli/prevent-cli_commands rename to prevent-cli/preventcli_commands index 0ee835d2..f6be8bde 100644 --- a/prevent-cli/prevent-cli_commands +++ b/prevent-cli/preventcli_commands @@ -1,4 +1,4 @@ -Usage: prevent-cli [OPTIONS] COMMAND [ARGS]... +Usage: sentry-prevent-cli [OPTIONS] COMMAND [ARGS]... Options: --auto-load-params-from [CircleCI|GithubActions|GitlabCI|Bitbucket|Bitrise|AppVeyor|Woodpecker|Heroku|DroneCI|BuildKite|AzurePipelines|Jenkins|CirrusCI|Teamcity|Travis|AWSCodeBuild|GoogleCloudBuild|Local] From b33895061a789ff0f8b2402b39f06f835a94e10b Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 17:20:12 -0400 Subject: [PATCH 11/16] Fix prevent command dump --- prevent-cli/preventcli_commands | 308 ++++++++++++++++++++++++++++ prevent-cli/src/prevent_cli/main.py | 10 + 2 files changed, 318 insertions(+) diff --git a/prevent-cli/preventcli_commands b/prevent-cli/preventcli_commands index f6be8bde..c1293074 100644 --- a/prevent-cli/preventcli_commands +++ b/prevent-cli/preventcli_commands @@ -2,6 +2,7 @@ Usage: sentry-prevent-cli [OPTIONS] COMMAND [ARGS]... Options: --auto-load-params-from [CircleCI|GithubActions|GitlabCI|Bitbucket|Bitrise|AppVeyor|Woodpecker|Heroku|DroneCI|BuildKite|AzurePipelines|Jenkins|CirrusCI|Teamcity|Travis|AWSCodeBuild|GoogleCloudBuild|Local] + --codecov-yml-path PATH -u, --enterprise-url, --url TEXT Change the upload host (Enterprise use) -v, --verbose Use verbose logging @@ -20,11 +21,318 @@ Commands: upload-coverage upload-process +Usage: sentry-prevent-cli create-commit [OPTIONS] +Options: + --parent-sha TEXT SHA (with 40 chars) of what should be the + parent of this commit + -P, --pr, --pull-request-number TEXT + Specify the pull request number manually. + Used to override pre-existing CI environment + variables + -B, --branch TEXT Branch to which this commit belongs to + -C, --sha, --commit-sha TEXT Commit SHA (with 40 chars) [required] + -Z, --fail-on-error Exit with non-zero code in case of error + --git-service [github|gitlab|bitbucket|github_enterprise|gitlab_enterprise|bitbucket_server] + -t, --token TEXT Codecov upload token + -r, --slug TEXT owner/repo slug used instead of the private + repo token in Self-hosted + -h, --help Show this message and exit. + +Usage: sentry-prevent-cli create-report [OPTIONS] + +Options: + -P, --pr, --pull-request-number TEXT + Specify the pull request number manually. + Used to override pre-existing CI environment + variables + -C, --sha, --commit-sha TEXT Commit SHA (with 40 chars) [required] + -Z, --fail-on-error Exit with non-zero code in case of error + --git-service [github|gitlab|bitbucket|github_enterprise|gitlab_enterprise|bitbucket_server] + -t, --token TEXT Codecov upload token + -r, --slug TEXT owner/repo slug used instead of the private + repo token in Self-hosted + -h, --help Show this message and exit. + +Usage: sentry-prevent-cli do-upload [OPTIONS] + +Options: + --network-root-folder PATH Root folder from which to consider paths on + the network section [default: (Current + working directory)] + -s, --dir, --coverage-files-search-root-folder, --files-search-root-folder PATH + Folder where to search for coverage files + [default: (Current Working Directory)] + --exclude, --coverage-files-search-exclude-folder, --files-search-exclude-folder PATH + Folders to exclude from search + -f, --file, --coverage-files-search-direct-file, --files-search-direct-file PATH + Explicit files to upload. These will be + added to the coverage files found for + upload. If you wish to only upload the + specified files, please consider using + --disable-search to disable uploading other + files. + --recurse-submodules Whether to enumerate files inside of + submodules for path-fixing purposes. Off by + default. + --disable-search Disable search for coverage files. This is + helpful when specifying what files you want + to upload with the --file option. + --disable-file-fixes Disable file fixes to ignore common lines + from coverage (e.g. blank lines or empty + brackets) + -b, --build, --build-code TEXT Specify the build number manually + --build-url TEXT The URL of the build where this is running + --job-code TEXT + -n, --name TEXT Custom defined name of the upload. Visible + in Codecov UI + -B, --branch TEXT Branch to which this commit belongs to + -P, --pr, --pull-request-number TEXT + Specify the pull request number manually. + Used to override pre-existing CI environment + variables + -e, --env, --env-var TEXT Specify environment variables to be included + with this build. + -F, --flag TEXT Flag the upload to group coverage metrics. + Multiple flags allowed. + --plugin TEXT + -d, --dry-run Don't upload files to Codecov + --legacy, --use-legacy-uploader + Use the legacy upload endpoint + --handle-no-reports-found Raise no exceptions when no coverage reports + found. + --report-type [coverage|test_results] + The type of the file to upload, coverage by + default. Possible values are: testing, + coverage. + --network-filter TEXT Specify a filter on the files listed in the + network section of the Codecov report. This + will only add files whose path begin with + the specified filter. Useful for upload- + specific path fixing + --network-prefix TEXT Specify a prefix on files listed in the + network section of the Codecov report. + Useful to help resolve path fixing + --gcov-args TEXT Extra arguments to pass to gcov + --gcov-ignore TEXT Paths to ignore during gcov gathering + --gcov-include TEXT Paths to include during gcov gathering + --gcov-executable TEXT gcov executable to run. Defaults to 'gcov' + --swift-project TEXT Specify the swift project + -C, --sha, --commit-sha TEXT Commit SHA (with 40 chars) [required] + -Z, --fail-on-error Exit with non-zero code in case of error + --git-service [github|gitlab|bitbucket|github_enterprise|gitlab_enterprise|bitbucket_server] + -t, --token TEXT Codecov upload token + -r, --slug TEXT owner/repo slug used instead of the private + repo token in Self-hosted + -h, --help Show this message and exit. + +Usage: sentry-prevent-cli empty-upload [OPTIONS] + +Options: + --force + --parent-sha TEXT SHA (with 40 chars) of what should be the + parent of this commit + -P, --pr, --pull-request-number TEXT + Specify the pull request number manually. + Used to override pre-existing CI environment + variables + -B, --branch TEXT Branch to which this commit belongs to + -C, --sha, --commit-sha TEXT Commit SHA (with 40 chars) [required] + -Z, --fail-on-error Exit with non-zero code in case of error + --git-service [github|gitlab|bitbucket|github_enterprise|gitlab_enterprise|bitbucket_server] + -t, --token TEXT Codecov upload token + -r, --slug TEXT owner/repo slug used instead of the private + repo token in Self-hosted + -h, --help Show this message and exit. +Usage: sentry-prevent-cli pr-base-picking [OPTIONS] +Options: + --base-sha TEXT Base commit SHA (with 40 chars) [required] + --pr TEXT Pull Request id to associate commit with + --slug TEXT owner/repo slug + -t, --token TEXT Codecov upload token + --service TEXT Specify the service provider of the repo e.g. github + -h, --help Show this message and exit. +Usage: sentry-prevent-cli process-test-results [OPTIONS] +Options: + -s, --dir, --files-search-root-folder PATH + Folder where to search for test results + files [default: (Current Working + Directory)] + -f, --file, --files-search-direct-file PATH + Explicit files to upload. These will be + added to the test results files to be + processed. If you wish to only process the + specified files, please consider using + --disable-search to disable processing other + files. + --exclude, --files-search-exclude-folder PATH + Folders to exclude from search + --disable-search Disable search for coverage files. This is + helpful when specifying what files you want + to upload with the --file option. + --github-token TEXT If specified, output the message to the + specified GitHub PR. + -h, --help Show this message and exit. +Usage: sentry-prevent-cli send-notifications [OPTIONS] + +Options: + -C, --sha, --commit-sha TEXT Commit SHA (with 40 chars) [required] + -Z, --fail-on-error Exit with non-zero code in case of error + --git-service [github|gitlab|bitbucket|github_enterprise|gitlab_enterprise|bitbucket_server] + -t, --token TEXT Codecov upload token + -r, --slug TEXT owner/repo slug used instead of the private + repo token in Self-hosted + -h, --help Show this message and exit. +Usage: sentry-prevent-cli upload-coverage [OPTIONS] +Options: + -C, --sha, --commit-sha TEXT Commit SHA (with 40 chars) [required] + -Z, --fail-on-error Exit with non-zero code in case of error + --git-service [github|gitlab|bitbucket|github_enterprise|gitlab_enterprise|bitbucket_server] + -t, --token TEXT Codecov upload token + -r, --slug TEXT owner/repo slug used instead of the private + repo token in Self-hosted + --network-root-folder PATH Root folder from which to consider paths on + the network section [default: (Current + working directory)] + -s, --dir, --coverage-files-search-root-folder, --files-search-root-folder PATH + Folder where to search for coverage files + [default: (Current Working Directory)] + --exclude, --coverage-files-search-exclude-folder, --files-search-exclude-folder PATH + Folders to exclude from search + -f, --file, --coverage-files-search-direct-file, --files-search-direct-file PATH + Explicit files to upload. These will be + added to the coverage files found for + upload. If you wish to only upload the + specified files, please consider using + --disable-search to disable uploading other + files. + --recurse-submodules Whether to enumerate files inside of + submodules for path-fixing purposes. Off by + default. + --disable-search Disable search for coverage files. This is + helpful when specifying what files you want + to upload with the --file option. + --disable-file-fixes Disable file fixes to ignore common lines + from coverage (e.g. blank lines or empty + brackets) + -b, --build, --build-code TEXT Specify the build number manually + --build-url TEXT The URL of the build where this is running + --job-code TEXT + -n, --name TEXT Custom defined name of the upload. Visible + in Codecov UI + -B, --branch TEXT Branch to which this commit belongs to + -P, --pr, --pull-request-number TEXT + Specify the pull request number manually. + Used to override pre-existing CI environment + variables + -e, --env, --env-var TEXT Specify environment variables to be included + with this build. + -F, --flag TEXT Flag the upload to group coverage metrics. + Multiple flags allowed. + --plugin TEXT + -d, --dry-run Don't upload files to Codecov + --legacy, --use-legacy-uploader + Use the legacy upload endpoint + --handle-no-reports-found Raise no exceptions when no coverage reports + found. + --report-type [coverage|test_results] + The type of the file to upload, coverage by + default. Possible values are: testing, + coverage. + --network-filter TEXT Specify a filter on the files listed in the + network section of the Codecov report. This + will only add files whose path begin with + the specified filter. Useful for upload- + specific path fixing + --network-prefix TEXT Specify a prefix on files listed in the + network section of the Codecov report. + Useful to help resolve path fixing + --gcov-args TEXT Extra arguments to pass to gcov + --gcov-ignore TEXT Paths to ignore during gcov gathering + --gcov-include TEXT Paths to include during gcov gathering + --gcov-executable TEXT gcov executable to run. Defaults to 'gcov' + --swift-project TEXT Specify the swift project + --parent-sha TEXT SHA (with 40 chars) of what should be the + parent of this commit + -h, --help Show this message and exit. + +Usage: sentry-prevent-cli upload-process [OPTIONS] + +Options: + -C, --sha, --commit-sha TEXT Commit SHA (with 40 chars) [required] + -Z, --fail-on-error Exit with non-zero code in case of error + --git-service [github|gitlab|bitbucket|github_enterprise|gitlab_enterprise|bitbucket_server] + -t, --token TEXT Codecov upload token + -r, --slug TEXT owner/repo slug used instead of the private + repo token in Self-hosted + --network-root-folder PATH Root folder from which to consider paths on + the network section [default: (Current + working directory)] + -s, --dir, --coverage-files-search-root-folder, --files-search-root-folder PATH + Folder where to search for coverage files + [default: (Current Working Directory)] + --exclude, --coverage-files-search-exclude-folder, --files-search-exclude-folder PATH + Folders to exclude from search + -f, --file, --coverage-files-search-direct-file, --files-search-direct-file PATH + Explicit files to upload. These will be + added to the coverage files found for + upload. If you wish to only upload the + specified files, please consider using + --disable-search to disable uploading other + files. + --recurse-submodules Whether to enumerate files inside of + submodules for path-fixing purposes. Off by + default. + --disable-search Disable search for coverage files. This is + helpful when specifying what files you want + to upload with the --file option. + --disable-file-fixes Disable file fixes to ignore common lines + from coverage (e.g. blank lines or empty + brackets) + -b, --build, --build-code TEXT Specify the build number manually + --build-url TEXT The URL of the build where this is running + --job-code TEXT + -n, --name TEXT Custom defined name of the upload. Visible + in Codecov UI + -B, --branch TEXT Branch to which this commit belongs to + -P, --pr, --pull-request-number TEXT + Specify the pull request number manually. + Used to override pre-existing CI environment + variables + -e, --env, --env-var TEXT Specify environment variables to be included + with this build. + -F, --flag TEXT Flag the upload to group coverage metrics. + Multiple flags allowed. + --plugin TEXT + -d, --dry-run Don't upload files to Codecov + --legacy, --use-legacy-uploader + Use the legacy upload endpoint + --handle-no-reports-found Raise no exceptions when no coverage reports + found. + --report-type [coverage|test_results] + The type of the file to upload, coverage by + default. Possible values are: testing, + coverage. + --network-filter TEXT Specify a filter on the files listed in the + network section of the Codecov report. This + will only add files whose path begin with + the specified filter. Useful for upload- + specific path fixing + --network-prefix TEXT Specify a prefix on files listed in the + network section of the Codecov report. + Useful to help resolve path fixing + --gcov-args TEXT Extra arguments to pass to gcov + --gcov-ignore TEXT Paths to ignore during gcov gathering + --gcov-include TEXT Paths to include during gcov gathering + --gcov-executable TEXT gcov executable to run. Defaults to 'gcov' + --swift-project TEXT Specify the swift project + --parent-sha TEXT SHA (with 40 chars) of what should be the + parent of this commit + -h, --help Show this message and exit. diff --git a/prevent-cli/src/prevent_cli/main.py b/prevent-cli/src/prevent_cli/main.py index bcf91cd8..335dd4a1 100644 --- a/prevent-cli/src/prevent_cli/main.py +++ b/prevent-cli/src/prevent_cli/main.py @@ -33,6 +33,11 @@ case_sensitive=False, ), ) +@click.option( + "--codecov-yml-path", + type=click.Path(path_type=pathlib.Path), + default=None, +) @click.option( "--enterprise-url", "--url", "-u", help="Change the upload host (Enterprise use)" ) @@ -56,6 +61,11 @@ def cli( ctx.help_option_names = ["-h", "--help"] ctx.obj["ci_adapter"] = get_ci_adapter(auto_load_params_from) ctx.obj["versioning_system"] = get_versioning_system() + ctx.obj["codecov_yaml"] = load_cli_config(codecov_yml_path) + if ctx.obj["codecov_yaml"] is None: + logger.debug("No codecov_yaml found") + elif (token := ctx.obj["codecov_yaml"].get("codecov", {}).get("token")) is not None: + ctx.default_map = {ctx.invoked_subcommand: {"token": token}} ctx.obj["enterprise_url"] = enterprise_url ctx.obj["disable_telem"] = disable_telem From a88e73e2b6156b4d59e5155100d3d98c71604265 Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 17:22:45 -0400 Subject: [PATCH 12/16] Remove old ci* workflows --- .github/workflows.old/ci-job.yml | 43 ---------- .github/workflows.old/ci.yml | 139 ------------------------------- 2 files changed, 182 deletions(-) delete mode 100644 .github/workflows.old/ci-job.yml delete mode 100644 .github/workflows.old/ci.yml diff --git a/.github/workflows.old/ci-job.yml b/.github/workflows.old/ci-job.yml deleted file mode 100644 index cea929f5..00000000 --- a/.github/workflows.old/ci-job.yml +++ /dev/null @@ -1,43 +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: CLI CI Job - -on: - pull_request: - push: - branches: - - main - -jobs: - build-test-upload: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 2 - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - python -m pip install -e . - pip install -r tests/requirements.txt - - 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 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage.xml - flags: python3.12 - fail_ci_if_error: true - verbose: true diff --git a/.github/workflows.old/ci.yml b/.github/workflows.old/ci.yml deleted file mode 100644 index 92e34102..00000000 --- a/.github/workflows.old/ci.yml +++ /dev/null @@ -1,139 +0,0 @@ ---- -# yamllint disable rule:line-length -# 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: CLI CI - -on: - pull_request: - push: - branches: - - main - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - name: Check linting with ruff - run: | - make lint - - detect-command-change: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - python -m pip install -e . - - name: Run command_dump - run: | - python command_dump.py - - name: Detect changes on commit - run: | - if [ -n "$(git diff codecovcli_commands)" ]; then - echo "Please run `python command_dump.py` before submitting, or install the hooks" - echo "$(git diff codecovcli_commands)" - exit 1 - fi - - codecov-startup: - runs-on: ubuntu-latest - if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} - steps: - - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 2 - - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - name: Install CLI - run: | - pip install codecov-cli - - name: Create commit in codecov - run: | - codecovcli create-commit -t ${{ secrets.CODECOV_TOKEN }} --git-service github - - name: Create commit report in codecov - run: | - codecovcli create-report -t ${{ secrets.CODECOV_TOKEN }} --git-service github - - build-test-upload: - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.13", "3.12", "3.11", "3.10", "3.9"] - runs-on: ${{matrix.os}} - steps: - - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 2 - - name: Set up Python ${{matrix.python-version}} - uses: actions/setup-python@v5 - with: - python-version: "${{matrix.python-version}}" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - python -m pip install -e . - pip install -r tests/requirements.txt - - name: Test with pytest - run: | - pytest --cov --junitxml=${{matrix.os}}-${{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: | - codecovcli -v do-upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} - codecovcli do-upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} - - name: Upload artifacts for test-results-processing - if: ${{ !cancelled() }} - uses: actions/upload-artifact@v4 - with: - name: ${{matrix.os}}-${{matrix.python-version}}junit.xml - path: ${{matrix.os}}-${{matrix.python-version}}junit.xml - - process-test-results: - if: ${{ always() }} - needs: build-test-upload - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 2 - - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - name: Install dependencies for Dogfooding - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - python -m pip install -e . - pip install -r tests/requirements.txt - - name: Download all test results - uses: actions/download-artifact@v4 - with: - pattern: "*junit.xml" - path: "test_results" - merge-multiple: true - - - name: Dogfooding codecov-cli - if: ${{ !cancelled() && github.ref && contains(github.ref, 'pull') }} - run: | - codecovcli process-test-results --dir test_results --github-token ${{ secrets.GITHUB_TOKEN }} From 5e63e5a22221299f4fb4c320975893160ce97f2e Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 18:11:05 -0400 Subject: [PATCH 13/16] Dogfood prevent-cli also --- .github/workflows/ci.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90c5f8ac..f4572571 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,9 +90,9 @@ jobs: run: | cd codecov-cli python -m pip install --upgrade pip - pip install -r requirements.txt - python -m pip install -e . - pip install -r tests/requirements.txt + python -m pip install -e codecov-cli + python -m pip install -e prevent-cli + pip install -r codecov-cli/tests/requirements.txt - name: Test with pytest run: | cd codecov-cli @@ -104,5 +104,8 @@ jobs: run: | codecovcli -v do-upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} codecovcli do-upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} - # todo: dogfood prevent-cli - + - name: Dogfooding sentry-prevent-cli + if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'getsentry' }} + run: | + sentry-prevent-cli -v do-upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} + sentry-prevent-cli do-upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} From 1c9baadd439e91c0ba3ecd4aefad089ea562a1b8 Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 18:14:46 -0400 Subject: [PATCH 14/16] Fix working directory when installing dependencies --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4572571..3de7d3ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,7 +88,6 @@ jobs: python-version: "${{matrix.python-version}}" - name: Install dependencies run: | - cd codecov-cli python -m pip install --upgrade pip python -m pip install -e codecov-cli python -m pip install -e prevent-cli From b3c875152cd2f963e2ce8d20e34941c1749857d9 Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 18:16:41 -0400 Subject: [PATCH 15/16] Allow python >=3.9 for prevent-cli --- prevent-cli/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prevent-cli/pyproject.toml b/prevent-cli/pyproject.toml index 226d30af..1e1a9413 100644 --- a/prevent-cli/pyproject.toml +++ b/prevent-cli/pyproject.toml @@ -6,7 +6,7 @@ readme = "README.md" authors = [ { name = "joseph-sentry", email = "joseph.sawaya@sentry.io" } ] -requires-python = ">=3.12" +requires-python = ">=3.9" dependencies = [ "click==8.*", "codecov-cli>=10.3.0", From fa8448d8c665e7e65e60ae892763fd95e42486c3 Mon Sep 17 00:00:00 2001 From: Spencer Murray Date: Tue, 29 Apr 2025 18:19:06 -0400 Subject: [PATCH 16/16] Add flag stating which CLI is uploading --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3de7d3ac..820f23b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,10 +101,10 @@ jobs: - name: Dogfooding codecov-cli if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'getsentry' }} run: | - codecovcli -v do-upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} - codecovcli do-upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} + codecovcli -v do-upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} --flag codecovcli + codecovcli do-upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} --flag codecovcli - name: Dogfooding sentry-prevent-cli if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'getsentry' }} run: | - sentry-prevent-cli -v do-upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} - sentry-prevent-cli do-upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} + sentry-prevent-cli -v do-upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} --flag sentry-prevent-cli + sentry-prevent-cli do-upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} --flag sentry-prevent-cli