Skip to content
Open
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
53 changes: 46 additions & 7 deletions .github/workflows/build_assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,21 @@ jobs:
TARGET: macos
# currently, wrapt pulls the arm64 version instead of the universal one, so the below is a hack
CMD_REQS: >
mkdir -p pip-packages && cd pip-packages && pip wheel --no-cache-dir --no-binary tree_sitter,ijson,charset_normalizer,PyYAML .. &&
mkdir -p pip-packages && cd pip-packages && pip wheel --no-cache-dir --no-binary ijson,charset_normalizer,PyYAML .. &&
rm $(ls | grep wrapt) && pip download wrapt --platform=universal2 --only-binary=:all: && pip install $(ls | grep wrapt) --force-reinstall && cd .. &&
pip install --no-deps --no-index --find-links=pip-packages pip-packages/*
CMD_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|^./||'") &&
pyinstaller --add-binary ${STATICCODECOV_LIB_PATH}:. --copy-metadata codecov-cli --hidden-import staticcodecov_languages --target-arch universal2 -F codecov_cli/main.py &&
pyinstaller --copy-metadata codecov-cli --target-arch universal2 -F codecov_cli/main.py &&
mv dist/main dist/codecovcli_macos &&
lipo -archs dist/codecovcli_macos | grep 'x86_64 arm64'
OUT_FILE_NAME: codecovcli_macos
ASSET_MIME: application/octet-stream
- os: ubuntu-20.04
- os: ubuntu-22.04
TARGET: ubuntu
CMD_REQS: >
pip install -r requirements.txt && pip install .
CMD_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|^./||'") &&
pyinstaller --add-binary ${STATICCODECOV_LIB_PATH}:. --copy-metadata codecov-cli --hidden-import staticcodecov_languages -F codecov_cli/main.py &&
pyinstaller --copy-metadata codecov-cli -F codecov_cli/main.py &&
cp ./dist/main ./dist/codecovcli_linux
OUT_FILE_NAME: codecovcli_linux
ASSET_MIME: application/octet-stream
Expand All @@ -46,7 +44,7 @@ jobs:
CMD_REQS: >
pip install -r requirements.txt && pip install .
CMD_BUILD: >
pyinstaller --add-binary "build\lib.win-amd64-cpython-311\staticcodecov_languages.cp311-win_amd64.pyd;." --copy-metadata codecov-cli --hidden-import staticcodecov_languages -F codecov_cli\main.py &&
pyinstaller --copy-metadata codecov-cli -F codecov_cli\main.py &&
Copy-Item -Path ".\dist\main.exe" -Destination ".\dist\codecovcli_windows.exe"
OUT_FILE_NAME: codecovcli_windows.exe
ASSET_MIME: application/vnd.microsoft.portable-executable
Expand Down Expand Up @@ -132,3 +130,44 @@ jobs:
asset_name: codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
tag: ${{ github.ref }}
overwrite: true

build_assets_freebsd:
name: Build assets - FreeBSD
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Run in VM
uses: vmactions/freebsd-vm@v1
with:
release: "13.5"
usesh: true
prepare: |
pkg update
pkg install -y python311
run: |
python3.11 -m venv .venv --upgrade-deps
. .venv/bin/activate
pip install -r requirements.txt
pip install .
python setup.py build
pip install pyinstaller
pyinstaller --copy-metadata codecov-cli -F codecov_cli/main.py
cp ./dist/main ./dist/codecovcli_freebsd
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
if: inputs.release == false
with:
name: codecovcli_freebsd
path: ./dist/codecovcli_freebsd
- name: Upload Release Asset
if: inputs.release == true
id: upload-release-asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./dist/codecovcli_freebsd
asset_name: codecovcli_freebsd
tag: ${{ github.ref }}
overwrite: true
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include languages/treesitterjavascript/src/tree_sitter/parser.h
include languages/treesitterpython/src/tree_sitter/parser.h
include requirements.txt

recursive-include codecov_cli *
Expand Down
54 changes: 0 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ CodecovCLI is a new way for users to interact with Codecov directly from the use
- [create-commit](#create-commit)
- [create-report](#create-report)
- [do-upload](#do-upload)
- [create-report-results](#create-report-results)
- [get-report-results](#get-report-results)
- [pr-base-picking](#pr-base-picking)
- [send-notifications](#send-notifications)
- [empty-upload](#empty-upload)
- [How to Use Local Upload](#how-to-use-local-upload)
- [Work in Progress Features](#work-in-progress-features)
- [Plugin System](#plugin-system)
- [Static Analysis](#static-analysis)
Expand Down Expand Up @@ -123,8 +120,6 @@ Codecov-cli supports user input. These inputs, along with their descriptions and
| `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.
| `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 previously 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.
Expand Down Expand Up @@ -156,7 +151,6 @@ Codecov-cli supports user input. These inputs, along with their descriptions and
|-r, --slug | owner/repo slug used instead of the private repo token in Self-hosted | 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

## do-upload
Expand All @@ -165,7 +159,6 @@ Codecov-cli supports user input. These inputs, along with their descriptions and
| 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
|-s, --dir, --coverage-files-search-root-folder | Folder where to search for coverage files default: (Current Working Directory) | Optional
|--exclude, --coverage-files-search-exclude-folder | Folders to exclude from search | Optional
Expand All @@ -189,30 +182,6 @@ Codecov-cli supports user input. These inputs, along with their descriptions and
|--git-service | Git Provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Required
|-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
|--git-service | Git provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Optional
|-t, --token | Codecov upload token | Required
|-h, --help | Shows usage, and command options

## get-report-results
`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
|--git-service | Git provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Optional
|-t, --token | Codecov upload token | Required
|-h, --help | Shows usage, and command options

## pr-base-picking
`codecovcli pr-base-picking [OPTIONS]`

Expand Down Expand Up @@ -254,25 +223,6 @@ are ignored by codecov (including README and configuration files)
| --git-service | Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Optional |
| -h, --help | Show this message and exit. | Optional |

# 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.

Local Upload is accomplished as follows:

```
pip install codecov-cli
codecovcli create-commit
codecovcli create-report --code <CODE>
codecovcli do-upload --report-code <CODE>
codecovcli create-report-results --code <CODE>
codecovcli get-report-results --code <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.

# 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.
Expand All @@ -281,10 +231,6 @@ The following features are somewhat implemented in code, but are not yet meant f

To provide extensibility to some of its commands, the CLI makes use of a plugin system. For most cases, the default commands are sufficient. But in some cases, having some custom logic specific to your use case can be beneficial. Note that full documentation of the plugin system is pending, as the feature is still heavily a work in progress.

## 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.

# 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.
Expand Down
2 changes: 1 addition & 1 deletion codecov_cli/commands/create_report_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
logger = logging.getLogger("codecovcli")


@click.command()
@click.command(hidden=True, deprecated=True)
@click.option(
"--code", help="The code of the report. If unsure, leave default", default="default"
)
Expand Down
4 changes: 1 addition & 3 deletions codecov_cli/commands/get_report_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import click
import sentry_sdk

from codecov_cli.fallbacks import CodecovOption, FallbackFieldEnum
from codecov_cli.helpers.args import get_cli_args
from codecov_cli.helpers.encoder import encode_slug
from codecov_cli.helpers.git import GitService
from codecov_cli.helpers.options import global_options
from codecov_cli.services.report import send_reports_result_get_request
from codecov_cli.types import CommandContext
Expand All @@ -15,7 +13,7 @@
logger = logging.getLogger("codecovcli")


@click.command()
@click.command(hidden=True, deprecated=True)
@click.option(
"--code", help="The code of the report. If unsure, leave default", default="default"
)
Expand Down
Loading