Skip to content

Commit a165771

Browse files
Import current example-python source.
Co-authored-by: Cursor <cursoragent@cursor.com>
0 parents  commit a165771

16 files changed

Lines changed: 358 additions & 0 deletions

‎.circleci/config.yml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: 2.1
2+
orbs:
3+
codecov: codecov/codecov@4
4+
5+
jobs:
6+
build:
7+
docker:
8+
- image: cimg/python:3.10
9+
steps:
10+
- checkout
11+
- run:
12+
name: Install dependencies
13+
command: pip install -r requirements.txt
14+
- run:
15+
name: Run tests and collect coverage
16+
command: pytest --cov app
17+
- codecov/upload
18+
19+
workflow:
20+
version: 2.1
21+
build-test:
22+
jobs:
23+
- build

‎.github/dependabot.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10

‎.github/workflows/ci.yml‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Workflow for Codecov example-python
2+
on: [push, pull_request]
3+
jobs:
4+
run:
5+
runs-on: ubuntu-latest
6+
permissions:
7+
id-token: write
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
- name: Set up Python 3.10
12+
uses: actions/setup-python@v4
13+
with:
14+
python-version: '3.10'
15+
- name: Install dependencies
16+
run: pip install -r requirements.txt
17+
- name: Run tests and collect coverage
18+
run: pytest --cov app --junitxml=junit.xml -o junit_family=legacy
19+
- name: Upload test results to Codecov
20+
if: ${{ !cancelled() }}
21+
uses: codecov/test-results-action@v1
22+
with:
23+
token: ${{ secrets.CODECOV_TOKEN }}
24+
- name: Upload coverage to Codecov (arg token)
25+
uses: codecov/codecov-action@main
26+
with:
27+
fail_ci_if_error: true
28+
token: ${{ secrets.CODECOV_TOKEN }}
29+
verbose: true
30+
- name: Upload coverage to Codecov (env token)
31+
uses: codecov/codecov-action@main
32+
with:
33+
fail_ci_if_error: true
34+
verbose: true
35+
env:
36+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
37+
- name: Upload coverage to Codecov (no token)
38+
uses: codecov/codecov-action@main
39+
with:
40+
fail_ci_if_error: true
41+
verbose: true
42+
- name: Upload coverage to Codecov (oidc)
43+
uses: codecov/codecov-action@main
44+
with:
45+
fail_ci_if_error: true
46+
use_oidc: true
47+
verbose: true

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__pycache__/
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
inputSet:
2+
name: Build_codecov_example_python_1782243281624-pr-trigger-input-set
3+
identifier: Build_codecov_example_python_1782243281624prtriggerinputset
4+
orgIdentifier: default
5+
projectIdentifier: calvin
6+
pipeline:
7+
identifier: Build_codecov_example_python_1782243281624
8+
properties:
9+
ci:
10+
codebase:
11+
build:
12+
type: PR
13+
spec:
14+
number: <+trigger.prNumber>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
inputSet:
2+
name: Build_codecov_example_python_1782243281624-push-trigger-input-set
3+
identifier: Build_codecov_example_python_1782243281624pushtriggerinputset
4+
orgIdentifier: default
5+
projectIdentifier: calvin
6+
pipeline:
7+
identifier: Build_codecov_example_python_1782243281624
8+
properties:
9+
ci:
10+
codebase:
11+
build:
12+
type: branch
13+
spec:
14+
branch: <+trigger.branch>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
pipeline:
2+
name: Build example-python
3+
identifier: Build_codecov_example_python_1782243281624
4+
projectIdentifier: codecov
5+
orgIdentifier: codecov
6+
stages:
7+
- stage:
8+
name: Build
9+
identifier: Build
10+
type: CI
11+
spec:
12+
cloneCodebase: true
13+
execution:
14+
steps:
15+
- step:
16+
type: Run
17+
name: Install dependencies
18+
identifier: Install_dependencies
19+
spec:
20+
shell: Sh
21+
command: |-
22+
python -m pip install --upgrade pip
23+
pip install -r requirements.txt
24+
pip install codecov-cli
25+
- step:
26+
type: Run
27+
name: Run tests and collect coverage
28+
identifier: Run_tests_and_collect_coverage
29+
spec:
30+
shell: Sh
31+
command: pytest --cov app --cov-report=lcov:lcov.info
32+
- step:
33+
type: Run
34+
name: Upload coverage to Harness
35+
identifier: Upload_coverage_to_Harness
36+
spec:
37+
shell: Sh
38+
command: hcli cov upload --file=lcov.info
39+
envVariables:
40+
CI_ENABLE_HCLI_FOR_TESTS: "true"
41+
- step:
42+
type: Run
43+
name: Upload coverage to Codecov -- arg token
44+
identifier: Upload_coverage_to_Codecov_arg_token
45+
spec:
46+
shell: Sh
47+
command: codecovcli --verbose do-upload -t ${CODECOV_TOKEN} --fail-on-error
48+
envVariables:
49+
CODECOV_TOKEN: <+secrets.getValue("CODECOV_TOKEN")>
50+
- step:
51+
type: Run
52+
name: Upload coverage to Codecov -- env token
53+
identifier: Upload_coverage_to_Codecov_env_token
54+
spec:
55+
shell: Sh
56+
command: codecovcli --verbose do-upload --fail-on-error
57+
envVariables:
58+
CODECOV_TOKEN: <+secrets.getValue("CODECOV_TOKEN")>
59+
platform:
60+
os: Linux
61+
arch: Amd64
62+
runtime:
63+
type: Cloud
64+
spec: {}
65+
failureStrategies:
66+
- onFailure:
67+
errors:
68+
- AllErrors
69+
action:
70+
type: MarkAsFailure
71+
properties:
72+
ci:
73+
codebase:
74+
connectorRef: codecov
75+
repoName: example-python
76+
build: <+input>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
pipeline:
2+
name: Build example-python
3+
identifier: Build_codecov_example_python_1782243281624
4+
projectIdentifier: calvin
5+
orgIdentifier: default
6+
stages:
7+
- stage:
8+
name: Build
9+
identifier: Build
10+
type: CI
11+
spec:
12+
cloneCodebase: true
13+
execution:
14+
steps:
15+
- step:
16+
type: Run
17+
name: Echo Welcome Message
18+
identifier: Echo_Welcome_Message
19+
spec:
20+
shell: Sh
21+
command: echo "Welcome to Harness CI"
22+
platform:
23+
os: Linux
24+
arch: Amd64
25+
runtime:
26+
type: Cloud
27+
spec: {}
28+
properties:
29+
ci:
30+
codebase:
31+
connectorRef: account.Github
32+
repoName: codecov/example-python
33+
build: <+input>

‎LICENSE.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Codecov
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎README.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# [Codecov](https://codecov.io) Python Example
2+
[![codecov](https://codecov.io/github/codecov/example-python/branch/main/graph/badge.svg?token=tkq655ROg3)](https://app.codecov.io/github/codecov/example-python)
3+
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fexample-python.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fexample-python?ref=badge_shield)
4+
5+
This example repository shows how Codecov can be integrated with a simple python project. It uses **GitHub Actions** and **CircleCI** as CI/CD providers and **coverage** as the coverage provider.
6+
7+
For more information, please see the links below.
8+
9+
## Links
10+
- [Quick Start](https://docs.codecov.com/docs/quick-start)
11+
- [GitHub Tutorial](https://docs.codecov.com/docs/github-tutorial)
12+
- [Community Boards](https://community.codecov.io)
13+
- [Support](https://codecov.io/support)
14+
- [Documentation](https://docs.codecov.io)
15+
16+
17+
## License
18+
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fexample-python.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fexample-python?ref=badge_large)

0 commit comments

Comments
 (0)