From e2d2d2b46bc4c1afa2c21431bfc3bc83b844b9a6 Mon Sep 17 00:00:00 2001 From: Varun Varatharajan <59575040+V4run14@users.noreply.github.com> Date: Fri, 23 Aug 2024 19:28:33 +0000 Subject: [PATCH 01/12] Initial steps commit --- .gitignore | 561 +++++++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE.md | 21 ++ ReadMe.md | 4 +- myFile.py | 17 ++ 4 files changed, 602 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 LICENSE.md create mode 100644 myFile.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a8b4b4f --- /dev/null +++ b/.gitignore @@ -0,0 +1,561 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/latest/usage/project/#working-with-version-control +.pdm.toml +.pdm-python +.pdm-build/ + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..63b4b68 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [year] [fullname] + +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. \ No newline at end of file diff --git a/ReadMe.md b/ReadMe.md index b2a6218..a6be02d 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1 +1,3 @@ -### Hello World +The MIT License +License: MIT +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) \ No newline at end of file diff --git a/myFile.py b/myFile.py new file mode 100644 index 0000000..efaca5a --- /dev/null +++ b/myFile.py @@ -0,0 +1,17 @@ +def add(a, b): + print("Sum of two numbers is ", a+b) + +def subtract(a, b): + print("Difference of two numbers is ", a-b) + +def multiply(a, b): + print("Product of two numbers is ", a*b) + +def divide(a, b): + print("Quotient of two numbers is ", a/b) + +a, b = 3, 1 +add(a, b) +subtract(a, b) +multiply(a, b) +divide(a, b) \ No newline at end of file From db654c9532aea8d04f236424cdaf3cacc0dd74cf Mon Sep 17 00:00:00 2001 From: Varun Varatharajan <59575040+V4run14@users.noreply.github.com> Date: Fri, 23 Aug 2024 19:35:17 +0000 Subject: [PATCH 02/12] License change --- LICENSE.md | 2 +- ReadMe.md | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 63b4b68..8e7917f 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) [year] [fullname] +Copyright (c) [2024] [Varun Varatharajan] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/ReadMe.md b/ReadMe.md index a6be02d..c72f7e1 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,3 +1 @@ -The MIT License -License: MIT [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) \ No newline at end of file From 7559413aea9e84471fd1fe6b3cd85f56da7f0c12 Mon Sep 17 00:00:00 2001 From: Varun Varatharajan <59575040+V4run14@users.noreply.github.com> Date: Fri, 23 Aug 2024 19:40:32 +0000 Subject: [PATCH 03/12] adding badges --- ReadMe.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ReadMe.md b/ReadMe.md index c72f7e1..c0c762b 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1 +1,5 @@ -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) \ No newline at end of file +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) + +![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54) + +![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) \ No newline at end of file From efb321d4e4004fdeb48277b4038bf4d3b77a5d60 Mon Sep 17 00:00:00 2001 From: Varun Varatharajan <59575040+V4run14@users.noreply.github.com> Date: Fri, 23 Aug 2024 20:31:16 +0000 Subject: [PATCH 04/12] added pytest suite --- myFile.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/myFile.py b/myFile.py index efaca5a..1ca3e3f 100644 --- a/myFile.py +++ b/myFile.py @@ -1,17 +1,17 @@ def add(a, b): - print("Sum of two numbers is ", a+b) + return(a+b) def subtract(a, b): - print("Difference of two numbers is ", a-b) + return(a-b) def multiply(a, b): - print("Product of two numbers is ", a*b) + return(a*b) def divide(a, b): - print("Quotient of two numbers is ", a/b) + return(a/b) a, b = 3, 1 -add(a, b) -subtract(a, b) -multiply(a, b) -divide(a, b) \ No newline at end of file +print(add(a, b)) +print(subtract(a, b)) +print(multiply(a, b)) +print(divide(a, b)) \ No newline at end of file From d2c67e373fae73f03bb7c3a3256ffaefebe3cecb Mon Sep 17 00:00:00 2001 From: Varun Varatharajan <59575040+V4run14@users.noreply.github.com> Date: Fri, 23 Aug 2024 20:34:01 +0000 Subject: [PATCH 05/12] Add test files --- tests/__init__.py | 0 tests/test_add.py | 5 +++++ tests/test_all.py | 14 ++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/test_add.py create mode 100644 tests/test_all.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_add.py b/tests/test_add.py new file mode 100644 index 0000000..0cc5693 --- /dev/null +++ b/tests/test_add.py @@ -0,0 +1,5 @@ +# content of test_sample.py +from myFile import add + +def test_add(): + assert add(2,4) == 6 diff --git a/tests/test_all.py b/tests/test_all.py new file mode 100644 index 0000000..2298ce8 --- /dev/null +++ b/tests/test_all.py @@ -0,0 +1,14 @@ +from myFile import add, subtract, divide, multiply + +def test_add(): + assert add(4,1) == 5 + +def test_subtract(): + assert subtract(4,1) == 3 + +def test_multiply(): + assert multiply(4,1) == 4 + +def test_divide(): + assert divide(4,1) == 0 + From 5ea13d273af201bb2122833df27727e216c2e95f Mon Sep 17 00:00:00 2001 From: Varun Varatharajan <59575040+V4run14@users.noreply.github.com> Date: Sat, 24 Aug 2024 22:33:40 +0000 Subject: [PATCH 06/12] adding workflow.yml, requirements.txt and settings.json --- .github-workflow/git_commit_workflow.yml | 30 ++++++++++++++++++++++++ .vscode/settings.json | 7 ++++++ ReadMe.md => README.md | 5 ++-- requirements.txt | 3 +++ 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 .github-workflow/git_commit_workflow.yml create mode 100644 .vscode/settings.json rename ReadMe.md => README.md (64%) create mode 100644 requirements.txt diff --git a/.github-workflow/git_commit_workflow.yml b/.github-workflow/git_commit_workflow.yml new file mode 100644 index 0000000..48af977 --- /dev/null +++ b/.github-workflow/git_commit_workflow.yml @@ -0,0 +1,30 @@ +on: [commit] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.12"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with Ruff + run: | + pip install ruff + ruff --format=github --target-version=py310 . + continue-on-error: true + - name: Test with pytest + run: | + coverage run -m pytest -v -s + - name: Generate Coverage Report + run: | + coverage report -m \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..3e99ede --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "python.testing.pytestArgs": [ + "." + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true +} \ No newline at end of file diff --git a/ReadMe.md b/README.md similarity index 64% rename from ReadMe.md rename to README.md index c0c762b..f1f50bf 100644 --- a/ReadMe.md +++ b/README.md @@ -1,5 +1,4 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) - ![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54) - -![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) \ No newline at end of file +![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) +<>![Unit tests](https://github.com/GradHackersGuild/se-homework/actions/workflows/git_commit_workflow.yml/badge.svg) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..22c019f --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +pytest==8.3.2 +pytest-cov==5.0.0 +coverage==7.6.1 \ No newline at end of file From 20e5bb9c2e7549cce2e7f3251664fe41afeca2e1 Mon Sep 17 00:00:00 2001 From: Varun Varatharajan <59575040+V4run14@users.noreply.github.com> Date: Sat, 24 Aug 2024 22:37:12 +0000 Subject: [PATCH 07/12] Removed manual workflow --- .github-workflow/git_commit_workflow.yml | 30 ------------------------ 1 file changed, 30 deletions(-) delete mode 100644 .github-workflow/git_commit_workflow.yml diff --git a/.github-workflow/git_commit_workflow.yml b/.github-workflow/git_commit_workflow.yml deleted file mode 100644 index 48af977..0000000 --- a/.github-workflow/git_commit_workflow.yml +++ /dev/null @@ -1,30 +0,0 @@ -on: [commit] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.12"] - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with Ruff - run: | - pip install ruff - ruff --format=github --target-version=py310 . - continue-on-error: true - - name: Test with pytest - run: | - coverage run -m pytest -v -s - - name: Generate Coverage Report - run: | - coverage report -m \ No newline at end of file From d9117924d988108661d36bc0308bcef0bc341153 Mon Sep 17 00:00:00 2001 From: Varun Varatharajan <59575040+V4run14@users.noreply.github.com> Date: Sat, 24 Aug 2024 22:54:03 +0000 Subject: [PATCH 08/12] Added manual workflow --- .github/workflows/git_commit_workflow.yml | 35 +++++++++++++++++++++++ README.md | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/git_commit_workflow.yml diff --git a/.github/workflows/git_commit_workflow.yml b/.github/workflows/git_commit_workflow.yml new file mode 100644 index 0000000..94c745e --- /dev/null +++ b/.github/workflows/git_commit_workflow.yml @@ -0,0 +1,35 @@ +name: Tests + +on: + push: + branches: + - varun + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.12"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with Ruff + run: | + pip install ruff + ruff --format=github --target-version=py310 . + continue-on-error: true + - name: Test with pytest + run: | + coverage run -m pytest -v -s + - name: Generate Coverage Report + run: | + coverage report -m \ No newline at end of file diff --git a/README.md b/README.md index f1f50bf..8606b84 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54) ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) -<>![Unit tests](https://github.com/GradHackersGuild/se-homework/actions/workflows/git_commit_workflow.yml/badge.svg) \ No newline at end of file +#![Unit tests](https://github.com/GradHackersGuild/se-homework/actions/workflows/git_commit_workflow.yml/badge.svg) \ No newline at end of file From a4b14c23daa71637edf0f479b918b4f043b11096 Mon Sep 17 00:00:00 2001 From: Varun Varatharajan <59575040+V4run14@users.noreply.github.com> Date: Sat, 24 Aug 2024 22:55:45 +0000 Subject: [PATCH 09/12] All tests pass --- tests/test_all.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_all.py b/tests/test_all.py index 2298ce8..9046b7b 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -10,5 +10,5 @@ def test_multiply(): assert multiply(4,1) == 4 def test_divide(): - assert divide(4,1) == 0 + assert divide(4,1) == 4 From f968fd562c5dab5b746d4905f65f37cc5f4e13a3 Mon Sep 17 00:00:00 2001 From: Varun Varatharajan <59575040+V4run14@users.noreply.github.com> Date: Sat, 24 Aug 2024 23:01:16 +0000 Subject: [PATCH 10/12] updated readme with badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8606b84..5b01961 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54) ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) -#![Unit tests](https://github.com/GradHackersGuild/se-homework/actions/workflows/git_commit_workflow.yml/badge.svg) \ No newline at end of file +#![Unit tests](https://github.com/V4run14/se-homework/actions/workflows/git_commit_workflow.yml/badge.svg) \ No newline at end of file From cf39cfa62dc2c88f3cdf023052ddcafc547dd8d5 Mon Sep 17 00:00:00 2001 From: Varun Varatharajan <59575040+V4run14@users.noreply.github.com> Date: Sat, 24 Aug 2024 23:28:01 +0000 Subject: [PATCH 11/12] Testing coverage badge --- .github/workflows/node.js.yml | 72 +++++++++++++++++++++++++++++++++++ README.md | 3 +- 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..19aaec2 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,72 @@ +name: Build Status + +on: + push: + branches: [ varun ] + +jobs: + build: + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node-version: [14.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} on ${{ matrix.os }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + # basically npm install but only installs from package-lock + - run: npm ci + - run: npm run lint + - run: npm t + + # Only run the coverage once + - if: ${{ matrix.node-version == '14.x' }} + name: Get Coverage for badge + run: | + # var SUMMARY = [ + # '', + # '=============================== Coverage summary ===============================', + # 'Statements : 32.5% ( 39/120 )', + # 'Branches : 38.89% ( 21/54 )', + # 'Functions : 21.74% ( 5/23 )', + # 'Lines : 31.93% ( 38/119 )', + # '================================================================================', + # '' + # ]; + # SUMMARY = SUMMARY.split('\n')[5]; // 'Lines : 31.93% ( 38/119 )' + # SUMMARY = SUMMARY.split(':')[1].split('(')[0].trim(); // '31.93%' + SUMMARY="$(npm test -- --coverageReporters='text-summary' | tail -2 | head -1)" + TOKENS=($SUMMARY) + # process.env.COVERAGE = '31.93%'; + echo "COVERAGE=$(echo ${TOKENS[2]})" >> $GITHUB_ENV + + # var REF = 'refs/pull/27/merge.json'; + REF=${{ github.ref }} + # console.log('github.ref: ' + REF); + echo "github.ref: $REF" + # var PATHS = REF.split('/'); + IFS='/' read -ra PATHS <<< "$REF" + # var BRANCH_NAME = PATHS[1] + '_' + PATHS[2]; + BRANCH_NAME="${PATHS[1]}_${PATHS[2]}" + # console.log(BRANCH_NAME); // 'pull_27' + echo $BRANCH_NAME + # process.env.BRANCH = 'pull_27'; + echo "BRANCH=$(echo ${BRANCH_NAME})" >> $GITHUB_ENV + - if: ${{ matrix.node-version == '14.x' }} + name: Create the Badge + uses: schneegans/dynamic-badges-action@v1.0.0 + with: + auth: ${{ secrets.GIST_SECRET }} + gistID: f4f5b59d0c75a1335d7ab6ab69dfcbba + filename: se_homework${{ env.BRANCH }}.json + label: Test Coverage + message: ${{ env.COVERAGE }} + color: green + namedLogo: jest \ No newline at end of file diff --git a/README.md b/README.md index 5b01961..44fbf5a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54) ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) -#![Unit tests](https://github.com/V4run14/se-homework/actions/workflows/git_commit_workflow.yml/badge.svg) \ No newline at end of file +![Unit tests](https://github.com/V4run14/se-homework/actions/workflows/git_commit_workflow.yml/badge.svg) +![Coverage Badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/V4run14/f4f5b59d0c75a1335d7ab6ab69dfcbba/raw/se-homework__heads_varun.json) \ No newline at end of file From b181f159ddd0b3690fe7f3c588724e0ff8536132 Mon Sep 17 00:00:00 2001 From: Varun Varatharajan <59575040+V4run14@users.noreply.github.com> Date: Sat, 24 Aug 2024 23:33:22 +0000 Subject: [PATCH 12/12] Show failed tests in workflow --- .github/workflows/node.js.yml | 72 ----------------------------------- README.md | 3 +- tests/test_all.py | 2 +- 3 files changed, 2 insertions(+), 75 deletions(-) delete mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index 19aaec2..0000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Build Status - -on: - push: - branches: [ varun ] - -jobs: - build: - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest] - node-version: [14.x] - - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} on ${{ matrix.os }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - # basically npm install but only installs from package-lock - - run: npm ci - - run: npm run lint - - run: npm t - - # Only run the coverage once - - if: ${{ matrix.node-version == '14.x' }} - name: Get Coverage for badge - run: | - # var SUMMARY = [ - # '', - # '=============================== Coverage summary ===============================', - # 'Statements : 32.5% ( 39/120 )', - # 'Branches : 38.89% ( 21/54 )', - # 'Functions : 21.74% ( 5/23 )', - # 'Lines : 31.93% ( 38/119 )', - # '================================================================================', - # '' - # ]; - # SUMMARY = SUMMARY.split('\n')[5]; // 'Lines : 31.93% ( 38/119 )' - # SUMMARY = SUMMARY.split(':')[1].split('(')[0].trim(); // '31.93%' - SUMMARY="$(npm test -- --coverageReporters='text-summary' | tail -2 | head -1)" - TOKENS=($SUMMARY) - # process.env.COVERAGE = '31.93%'; - echo "COVERAGE=$(echo ${TOKENS[2]})" >> $GITHUB_ENV - - # var REF = 'refs/pull/27/merge.json'; - REF=${{ github.ref }} - # console.log('github.ref: ' + REF); - echo "github.ref: $REF" - # var PATHS = REF.split('/'); - IFS='/' read -ra PATHS <<< "$REF" - # var BRANCH_NAME = PATHS[1] + '_' + PATHS[2]; - BRANCH_NAME="${PATHS[1]}_${PATHS[2]}" - # console.log(BRANCH_NAME); // 'pull_27' - echo $BRANCH_NAME - # process.env.BRANCH = 'pull_27'; - echo "BRANCH=$(echo ${BRANCH_NAME})" >> $GITHUB_ENV - - if: ${{ matrix.node-version == '14.x' }} - name: Create the Badge - uses: schneegans/dynamic-badges-action@v1.0.0 - with: - auth: ${{ secrets.GIST_SECRET }} - gistID: f4f5b59d0c75a1335d7ab6ab69dfcbba - filename: se_homework${{ env.BRANCH }}.json - label: Test Coverage - message: ${{ env.COVERAGE }} - color: green - namedLogo: jest \ No newline at end of file diff --git a/README.md b/README.md index 44fbf5a..20eac9e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54) ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) -![Unit tests](https://github.com/V4run14/se-homework/actions/workflows/git_commit_workflow.yml/badge.svg) -![Coverage Badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/V4run14/f4f5b59d0c75a1335d7ab6ab69dfcbba/raw/se-homework__heads_varun.json) \ No newline at end of file +![Unit tests](https://github.com/V4run14/se-homework/actions/workflows/git_commit_workflow.yml/badge.svg) \ No newline at end of file diff --git a/tests/test_all.py b/tests/test_all.py index 9046b7b..09bc62e 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -10,5 +10,5 @@ def test_multiply(): assert multiply(4,1) == 4 def test_divide(): - assert divide(4,1) == 4 + assert divide(4,1) == 5