Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,30 @@ jobs:
run: |
codecovcli create-report -t ${{ secrets.CODECOV_TOKEN }} --git-service github

build-test-upload-container:
runs-on: ubuntu-latest
container: python:latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
- name: Install dependencies
run: |
pip install -r requirements.txt
python -m pip install -e .
- name: Dogfooding codecov-cli
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
run: |
codecovcli -v upload-coverage --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}}-container
codecovcli upload-coverage --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}}-container
- name: Try git
run: |
git -C . ls-files

build-test-upload:
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -103,8 +127,8 @@ jobs:
- 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}}
codecovcli -v upload-coverage --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}}
codecovcli upload-coverage --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
Expand Down Expand Up @@ -160,11 +184,13 @@ jobs:
codecovcli label-analysis --token ${{ secrets.STATIC_TOKEN }} --base-sha=$BASE_SHA --max-wait-time=120
- name: Upload smart-labels
run: |
codecovcli --codecov-yml-path=codecov.yml do-upload --plugin pycoverage --plugin compress-pycoverage --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --flag smart-labels
codecovcli --codecov-yml-path=codecov.yml upload-coverage --plugin pycoverage --plugin compress-pycoverage --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --flag smart-labels

process-test-results:
if: ${{ always() }}
needs: build-test-upload
needs:
- build-test-upload
- build-test-upload-container
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
35 changes: 33 additions & 2 deletions codecov_cli/helpers/versioning_systems.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import logging
import subprocess
import typing as t
import os
from pathlib import Path
from pathspec import PathSpec
from shutil import which
import subprocess
import typing as t

from codecov_cli.fallbacks import FallbackFieldEnum
from codecov_cli.helpers.git import parse_git_service, parse_slug
Expand Down Expand Up @@ -145,3 +147,32 @@ def is_available(cls):

def get_network_root(self):
return Path.cwd()

def _get_gitignore(self, root: Path) -> PathSpec:
gitignore = root / ".gitignore"
default_ignore = [
'.git/',
]
if not gitignore.is_file():
return PathSpec.from_lines("gitwildmatch", default_ignore)
else:
return PathSpec.from_lines("gitwildmatch", [*default_ignore, *gitignore.open()])

def list_relevant_files(self, root_folder: t.Optional[Path] = None) -> t.List[str]:
dir_to_use = root_folder or self.get_network_root()
if dir_to_use is None:
raise ValueError("Can't determine root folder")

all_files = set()
for dirpath, _, fnames in os.walk(root_folder):
for fname in fnames:
full_path = os.path.join(dirpath, fname)
all_files.add(full_path)

gitignore = self._get_gitignore(dir_to_use)
filtered_files = []
for file in all_files:
if not gitignore.match_file(Path(file)):
filtered_files.append(file)

return sorted(filtered_files)
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies = [
"click==8.*",
"httpx==0.27.*",
"ijson==3.*",
"pathspec>=0.12.1",
"pyyaml==6.*",
"regex",
"responses==0.21.*",
Expand Down
8 changes: 3 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
anyio==4.8.0
# via httpx
certifi==2024.12.14
certifi==2025.1.31
# via
# httpcore
# httpx
Expand All @@ -29,8 +29,8 @@ idna==3.10
# requests
ijson==3.3.0
# via codecov-cli (pyproject.toml)
packaging==24.2
# via setuptools-scm
pathspec==0.12.1
# via codecov-cli (pyproject.toml)
pyyaml==6.0.2
# via codecov-cli (pyproject.toml)
regex==2024.11.6
Expand All @@ -41,8 +41,6 @@ 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
Expand Down
Loading