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 06b266f5..15abf468 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,16 +3,40 @@ on: [push, pull_request] jobs: run: runs-on: ubuntu-latest + permissions: + id-token: write steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python 3.10 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.10' - name: Install dependencies run: pip install -r requirements.txt - name: Run tests and collect coverage run: pytest --cov app - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + - 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: + 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 new file mode 100644 index 00000000..86be7410 --- /dev/null +++ b/.github/workflows/enforce-license-compliance.yml @@ -0,0 +1,14 @@ +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/.gitignore b/.gitignore new file mode 100644 index 00000000..c18dd8d8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..c341b2a0 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Codecov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/app/__pycache__/__init__.cpython-39.pyc b/app/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index d38e9303..00000000 Binary files a/app/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/app/__pycache__/calculator.cpython-39.pyc b/app/__pycache__/calculator.cpython-39.pyc deleted file mode 100644 index a39eb26f..00000000 Binary files a/app/__pycache__/calculator.cpython-39.pyc and /dev/null differ diff --git a/app/__pycache__/test_calculator.cpython-39-pytest-7.1.1.pyc b/app/__pycache__/test_calculator.cpython-39-pytest-7.1.1.pyc deleted file mode 100644 index 7e1f15b7..00000000 Binary files a/app/__pycache__/test_calculator.cpython-39-pytest-7.1.1.pyc and /dev/null differ 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/codecov.yml b/codecov.yml index 6f151f75..1ed5513f 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,6 +1,13 @@ -profiling: - critical_files_paths: - - app/calculator.py +flag_management: + individual_flags: + - name: smart-tests + carryforward: true + carryforward_mode: "labels" + statuses: + - type: "project" + - type: "patch" -comment: - show_critical_paths: true +cli: + plugins: + pycoverage: + report_type: "json" diff --git a/requirements.txt b/requirements.txt index c011c2e5..f1e325af 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,10 @@ -attrs==21.4.0 -coverage==6.4.1 -iniconfig==1.1.1 -packaging==21.3 -pluggy==1.0.0 +attrs==25.3.0 +coverage==7.8.0 +iniconfig==2.1.0 +packaging==24.2 +pluggy==1.5.0 py==1.11.0 -pyparsing==3.0.9 -pytest==7.1.2 -pytest-cov==3.0.0 -tomli==2.0.1 +pyparsing==3.2.3 +pytest==8.3.5 +pytest-cov==6.1.0 +tomli==2.2.1 diff --git a/tests.py b/tests.py deleted file mode 100644 index 6503da36..00000000 --- a/tests.py +++ /dev/null @@ -1,18 +0,0 @@ -import unittest - -import awesome - - -class TestMethods(unittest.TestCase): - def test_add(self): - self.assertEqual(awesome.smile(), ":)") - - def test_add_again(self): - self.assertEqual(awesome.smile(), ":)") - - def test_if(self): - self.assertTrue(awesome.test_if(1)) - - -if __name__ == '__main__': - unittest.main()