diff --git a/.circleci/config.yml b/.circleci/config.yml index a01741de..fe5ae248 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,6 @@ version: 2.1 orbs: - codecov: codecov/codecov@3 + codecov: codecov/codecov@4 jobs: build: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11426506..76608502 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,28 +3,45 @@ on: [push, pull_request] jobs: run: runs-on: ubuntu-latest + permissions: + id-token: write steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Set up Python 3.10 uses: actions/setup-python@v4 with: python-version: '3.10' - name: Install dependencies run: pip install -r requirements.txt - - name: Run ATS - uses: codecov/codecov-ats@v0 - env: - CODECOV_STATIC_TOKEN: ${{ secrets.CODECOV_STATIC_TOKEN }} - CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }} - name: Run tests and collect coverage - run: pytest --cov app ${{ env.CODECOV_ATS_TESTS }} - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4-beta + run: pytest --cov app --junitxml=junit.xml -o junit_family=legacy + - name: Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + - name: Upload coverage to Codecov (arg token) + uses: codecov/codecov-action@main + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + - name: Upload coverage to Codecov (env token) + uses: codecov/codecov-action@main with: - flags: smart-tests + fail_ci_if_error: true verbose: true env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - name: Upload coverage to Codecov (no token) + uses: codecov/codecov-action@main + with: + fail_ci_if_error: true + verbose: true + - name: Upload coverage to Codecov (oidc) + uses: codecov/codecov-action@main + with: + fail_ci_if_error: true + use_oidc: true + verbose: true diff --git a/.github/workflows/enforce-license-compliance.yml b/.github/workflows/enforce-license-compliance.yml deleted file mode 100644 index 86be7410..00000000 --- a/.github/workflows/enforce-license-compliance.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Enforce License Compliance - -on: - pull_request: - branches: [main, master] - -jobs: - enforce-license-compliance: - runs-on: ubuntu-latest - steps: - - name: 'Enforce License Compliance' - uses: getsentry/action-enforce-license-compliance@57ba820387a1a9315a46115ee276b2968da51f3d # main - with: - fossa_api_key: ${{ secrets.FOSSA_API_KEY }} diff --git a/.harness/Build_codecov_example_python_1782243281624-pr-trigger-input-set-1782243283201.yaml b/.harness/Build_codecov_example_python_1782243281624-pr-trigger-input-set-1782243283201.yaml new file mode 100644 index 00000000..3ca5367c --- /dev/null +++ b/.harness/Build_codecov_example_python_1782243281624-pr-trigger-input-set-1782243283201.yaml @@ -0,0 +1,14 @@ +inputSet: + name: Build_codecov_example_python_1782243281624-pr-trigger-input-set + identifier: Build_codecov_example_python_1782243281624prtriggerinputset + orgIdentifier: default + projectIdentifier: calvin + pipeline: + identifier: Build_codecov_example_python_1782243281624 + properties: + ci: + codebase: + build: + type: PR + spec: + number: <+trigger.prNumber> diff --git a/.harness/Build_codecov_example_python_1782243281624-push-trigger-input-set-1782243284714.yaml b/.harness/Build_codecov_example_python_1782243281624-push-trigger-input-set-1782243284714.yaml new file mode 100644 index 00000000..990893c4 --- /dev/null +++ b/.harness/Build_codecov_example_python_1782243281624-push-trigger-input-set-1782243284714.yaml @@ -0,0 +1,14 @@ +inputSet: + name: Build_codecov_example_python_1782243281624-push-trigger-input-set + identifier: Build_codecov_example_python_1782243281624pushtriggerinputset + orgIdentifier: default + projectIdentifier: calvin + pipeline: + identifier: Build_codecov_example_python_1782243281624 + properties: + ci: + codebase: + build: + type: branch + spec: + branch: <+trigger.branch> diff --git a/.harness/orgs/codecov/projects/codecov/pipelines/CI.yaml b/.harness/orgs/codecov/projects/codecov/pipelines/CI.yaml new file mode 100644 index 00000000..ff83b086 --- /dev/null +++ b/.harness/orgs/codecov/projects/codecov/pipelines/CI.yaml @@ -0,0 +1,76 @@ +pipeline: + name: Build example-python + identifier: Build_codecov_example_python_1782243281624 + projectIdentifier: codecov + orgIdentifier: codecov + stages: + - stage: + name: Build + identifier: Build + type: CI + spec: + cloneCodebase: true + execution: + steps: + - step: + type: Run + name: Install dependencies + identifier: Install_dependencies + spec: + shell: Sh + command: |- + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install codecov-cli + - step: + type: Run + name: Run tests and collect coverage + identifier: Run_tests_and_collect_coverage + spec: + shell: Sh + command: pytest --cov app --cov-report=lcov:lcov.info + - step: + type: Run + name: Upload coverage to Harness + identifier: Upload_coverage_to_Harness + spec: + shell: Sh + command: hcli cov upload --file=lcov.info + envVariables: + CI_ENABLE_HCLI_FOR_TESTS: "true" + - step: + type: Run + name: Upload coverage to Codecov -- arg token + identifier: Upload_coverage_to_Codecov_arg_token + spec: + shell: Sh + command: codecovcli --verbose do-upload -t ${CODECOV_TOKEN} --fail-on-error + envVariables: + CODECOV_TOKEN: <+secrets.getValue("CODECOV_TOKEN")> + - step: + type: Run + name: Upload coverage to Codecov -- env token + identifier: Upload_coverage_to_Codecov_env_token + spec: + shell: Sh + command: codecovcli --verbose do-upload --fail-on-error + envVariables: + CODECOV_TOKEN: <+secrets.getValue("CODECOV_TOKEN")> + platform: + os: Linux + arch: Amd64 + runtime: + type: Cloud + spec: {} + failureStrategies: + - onFailure: + errors: + - AllErrors + action: + type: MarkAsFailure + properties: + ci: + codebase: + connectorRef: codecov + repoName: example-python + build: <+input> diff --git a/.harness/pipelines/example-python-1782243273911.yaml b/.harness/pipelines/example-python-1782243273911.yaml new file mode 100644 index 00000000..c17de680 --- /dev/null +++ b/.harness/pipelines/example-python-1782243273911.yaml @@ -0,0 +1,33 @@ +pipeline: + name: Build example-python + identifier: Build_codecov_example_python_1782243281624 + projectIdentifier: calvin + orgIdentifier: default + stages: + - stage: + name: Build + identifier: Build + type: CI + spec: + cloneCodebase: true + execution: + steps: + - step: + type: Run + name: Echo Welcome Message + identifier: Echo_Welcome_Message + spec: + shell: Sh + command: echo "Welcome to Harness CI" + platform: + os: Linux + arch: Amd64 + runtime: + type: Cloud + spec: {} + properties: + ci: + codebase: + connectorRef: account.Github + repoName: codecov/example-python + build: <+input> diff --git a/app/calculator.py b/app/calculator.py index 8a976b25..4f380e8e 100644 --- a/app/calculator.py +++ b/app/calculator.py @@ -13,3 +13,4 @@ def divide(x, y): if y == 0: return 'Cannot divide by 0' return x * 1.0 / y + diff --git a/bitrise.yml b/bitrise.yml new file mode 100644 index 00000000..a09c296d --- /dev/null +++ b/bitrise.yml @@ -0,0 +1,34 @@ +format_version: "13" +default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git +project_type: other +workflows: + primary: + steps: + - activate-ssh-key@4: + run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' + - git-clone@8: {} + - script@1: + inputs: + - script_file_path: null + - content: | + #!/usr/bin/env bash + set -e + set -o pipefail + set -x # debug log + + pip3 install -r requirements.txt + pytest --cov app + - codecov@3: + inputs: + - OS: macos + - CODECOV_TOKEN: $CODECOV_TOKEN + - deploy-to-bitrise-io@2: {} +meta: + bitrise.io: + stack: osx-xcode-14.3.x-ventura + machine_type_id: g2-m1.4core +trigger_map: +- push_branch: main + workflow: primary +- pull_request_source_branch: '*' + workflow: primary diff --git a/requirements.txt b/requirements.txt index 179df7eb..b6bbce9f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,10 @@ -attrs==23.2.0 -coverage==7.4.1 -iniconfig==2.0.0 -packaging==23.2 -pluggy==1.4.0 +attrs==25.4.0 +coverage==7.12.0 +iniconfig==2.3.0 +packaging==25.0 +pluggy==1.6.0 py==1.11.0 -pyparsing==3.1.1 -pytest==8.0.0 -pytest-cov==4.1.0 -tomli==2.0.1 +pyparsing==3.2.5 +pytest==9.0.1 +pytest-cov==7.0.0 +tomli==2.3.0