From 557addbd2df0b6cc38669f7128d02a884838a599 Mon Sep 17 00:00:00 2001 From: glozanoa Date: Wed, 1 Sep 2021 10:27:39 -0500 Subject: [PATCH 01/21] what's happen if I make a push --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a1689ef0..2caeb8a2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # [Codecov](https://codecov.io) Python Example [![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) +[![CircleCI](https://circleci.com/gh/glozanoa/example-python/tree/master.svg?style=svg)](https://circleci.com/gh/glozanoa/example-python/tree/master) ## Guide From 483b60438855b64913d2d6d0d15a7b2d25b72280 Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 6 Sep 2021 17:57:46 -0500 Subject: [PATCH 02/21] update circleci config file --- .circleci/config.yml | 9 ++++++--- README.md | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index edf6a031..16ef0ae4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,6 @@ version: 2.1 -orbs: - codecov: codecov/codecov@3.0.0 +#orbs: +# codecov: codecov/codecov@3.0.0 jobs: build: @@ -16,7 +16,10 @@ jobs: command: | coverage run tests.py coverage xml - - codecov/upload + - run: + name: Upload coverage + command: + bash <(curl -s https://codecov.io/bash) workflow: version: 2.1 diff --git a/README.md b/README.md index 2caeb8a2..e995dc25 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![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) [![CircleCI](https://circleci.com/gh/glozanoa/example-python/tree/master.svg?style=svg)](https://circleci.com/gh/glozanoa/example-python/tree/master) +[![codecov](https://codecov.io/gh/glozanoa/example-python/branch/master/graph/badge.svg?token=2HIMOD4F7J)](https://codecov.io/gh/glozanoa/example-python) ## Guide From 44973ecc4c26a8cbaa820144117adc1b3067c967 Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 6 Sep 2021 18:01:44 -0500 Subject: [PATCH 03/21] upload .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..68858b56 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +awesome/__pycache__/ From a23ca5747c207efcbb8062afd8f76e043eeae8fb Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 6 Sep 2021 18:02:46 -0500 Subject: [PATCH 04/21] update circleci config --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 16ef0ae4..b34819d8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,9 +17,9 @@ jobs: coverage run tests.py coverage xml - run: - name: Upload coverage - command: - bash <(curl -s https://codecov.io/bash) + name: Upload coverage + command: + bash <(curl -s https://codecov.io/bash) workflow: version: 2.1 From b0aa3ee401cfdd8fcbbfe7ce69cdb7a689988130 Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 6 Sep 2021 18:06:53 -0500 Subject: [PATCH 05/21] update tests --- tests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests.py b/tests.py index 92aa2034..a775df01 100644 --- a/tests.py +++ b/tests.py @@ -6,6 +6,8 @@ class TestMethods(unittest.TestCase): def test_add(self): self.assertEqual(awesome.smile(), ":)") + def test_sub(self): + self.assertEqual(awesome.frown(), ":(") if __name__ == '__main__': From 7f735d6f58177d647f80f4e31c400f0041e2a2bf Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 6 Sep 2021 20:03:00 -0500 Subject: [PATCH 06/21] split tests --- setup.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests.py | 14 -------------- tests/frown.py | 8 ++++++++ tests/smile.py | 8 ++++++++ 4 files changed, 67 insertions(+), 14 deletions(-) create mode 100644 setup.py delete mode 100644 tests.py create mode 100644 tests/frown.py create mode 100644 tests/smile.py diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..a261f2d3 --- /dev/null +++ b/setup.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +# +# adas setup +# +# date: Sep 1 2021 +# Maintainer: glozanoa + + +from setuptools import setup, find_packages, Extension + +#from adas import VERSION +VERSION = '0.0.1' + +f = open('README.md', 'r') +LONG_DESCRIPTION = f.read() +f.close() + +def get_requirements(): + requirements = [] + with open('requirements.txt', 'r') as adas_requirements: + for line in adas_requirements: + line = line.rstrip() + if line != '' or line.startwith("#"): + continue + + requirements.append(line) + + return requirements + + +setup( + name='awesome', + version=VERSION, + description='Generic algorithms and data structures', + long_description=LONG_DESCRIPTION, + long_description_content_type='text/markdown', + keywords=['Algorithms', 'Data Structures'], + author='glozanoa', + author_email='glozanoa@uni.pe', + url='https://github.com/glozanoa/adas', + license='GPL3', + classifiers = [ + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9" + ], + packages=find_packages(), + install_requires = get_requirements(), + include_package_data=True +) diff --git a/tests.py b/tests.py deleted file mode 100644 index a775df01..00000000 --- a/tests.py +++ /dev/null @@ -1,14 +0,0 @@ -import unittest - -import awesome - - -class TestMethods(unittest.TestCase): - def test_add(self): - self.assertEqual(awesome.smile(), ":)") - def test_sub(self): - self.assertEqual(awesome.frown(), ":(") - - -if __name__ == '__main__': - unittest.main() diff --git a/tests/frown.py b/tests/frown.py new file mode 100644 index 00000000..55cef052 --- /dev/null +++ b/tests/frown.py @@ -0,0 +1,8 @@ +import unittest + +import awesome + + +class TestSmile(unittest.TestCase): + def test_frown(self): + self.assertEqual(awesome.frown(), ":(") diff --git a/tests/smile.py b/tests/smile.py new file mode 100644 index 00000000..d9f91f48 --- /dev/null +++ b/tests/smile.py @@ -0,0 +1,8 @@ +import unittest + +import awesome + + +class TestSmile(unittest.TestCase): + def test_smile(self): + self.assertEqual(awesome.smile(), ":)") From ab0a6af69ed14908cdea1ef7912f21751a6eecf8 Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 6 Sep 2021 20:05:38 -0500 Subject: [PATCH 07/21] update circleci config --- .circleci/config.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b34819d8..ffaa4130 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,13 +9,15 @@ jobs: steps: - checkout - run: - name: Install dependencies - command: pip install -r requirements.txt + name: Install dependencies and package + command: | + pip install -r requirements.txt + pip install . - run: name: Run tests and collect coverage command: | - coverage run tests.py - coverage xml + pip install pytest-cov + pytest --cov tests --cov-report xml - run: name: Upload coverage command: From 390f930c39ae06690f4b510e5065e2656afe2d6a Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 6 Sep 2021 20:10:34 -0500 Subject: [PATCH 08/21] update circle config --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ffaa4130..a3dbb6ce 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,7 +17,7 @@ jobs: name: Run tests and collect coverage command: | pip install pytest-cov - pytest --cov tests --cov-report xml + pytest --cov=awesome --cov-report=xml tests/ - run: name: Upload coverage command: From 310be0bba27c9d97b46d1a46983242535eaa9b57 Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 6 Sep 2021 20:16:01 -0500 Subject: [PATCH 09/21] update circle config --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a3dbb6ce..2a359d92 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,7 +17,7 @@ jobs: name: Run tests and collect coverage command: | pip install pytest-cov - pytest --cov=awesome --cov-report=xml tests/ + pytest --cov=awesome --cov-report=xml tests/*.py - run: name: Upload coverage command: From b5caef96986e6530aee5be75c95c5b8a7230aea8 Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 6 Sep 2021 20:20:02 -0500 Subject: [PATCH 10/21] adding __init__ to tests --- tests/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/__init__.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b From bfea7b6f333bc52c90dec51bcd89a7b7e06419da Mon Sep 17 00:00:00 2001 From: glozanoa Date: Wed, 8 Sep 2021 17:57:04 -0500 Subject: [PATCH 11/21] This push will triger my discord bot? --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 68858b56..ff2fbbb6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ awesome/__pycache__/ +tests/__pycache__/ +.coverage +coverage.xml From 45c04c122d374be19f77eb549243a237d667aa5f Mon Sep 17 00:00:00 2001 From: glozanoa Date: Wed, 8 Sep 2021 18:02:55 -0500 Subject: [PATCH 12/21] Avoid file that start with . --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ff2fbbb6..7a9cd89c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +**/.* awesome/__pycache__/ tests/__pycache__/ .coverage From 1d653033f57be18d8e76a42f3252a496e6c63a14 Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 27 Dec 2021 13:59:59 +0000 Subject: [PATCH 13/21] add Jenkinsfile --- .circleci/config.yml | 30 ------------------------------ .github/workflows/ci.yml | 20 -------------------- Jenkinsfile | 28 ++++++++++++++++++++++++++++ setup.py | 10 ++++------ 4 files changed, 32 insertions(+), 56 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 .github/workflows/ci.yml create mode 100644 Jenkinsfile diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 2a359d92..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,30 +0,0 @@ -version: 2.1 -#orbs: -# codecov: codecov/codecov@3.0.0 - -jobs: - build: - docker: - - image: cimg/python:3.9.6 - steps: - - checkout - - run: - name: Install dependencies and package - command: | - pip install -r requirements.txt - pip install . - - run: - name: Run tests and collect coverage - command: | - pip install pytest-cov - pytest --cov=awesome --cov-report=xml tests/*.py - - run: - name: Upload coverage - command: - bash <(curl -s https://codecov.io/bash) - -workflow: - version: 2.1 - build-test: - jobs: - - build diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 433eac75..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Workflow for Codecov example-python -on: [push, pull_request] -jobs: - run: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up Python 3.9 - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - name: Install dependencies - run: pip install -r requirements.txt - - name: Run tests and collect coverage - run: | - coverage run tests.py - coverage xml - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..4b3a699f --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,28 @@ +pipeline { + agent { + docker { image 'python:3.9' } + } + + environment { + DISABLE_AUTH = 'true' + DB_ENGINE = 'sqlite' + } + + stages { + stage('build') { + steps { + echo "Database engine is ${DB_ENGINE}" + echo "DISABLE_AUTH is ${DISABLE_AUTH}" + sh 'printenv' + sh 'python3 --version' + sh 'python3 -m pip install -r requirements.txt' + sh 'python3 setup.py install' + } + } + stage('tests'){ + steps{ + sh 'pytest -v tests' + } + } + } +} diff --git a/setup.py b/setup.py index a261f2d3..fc1c832f 100644 --- a/setup.py +++ b/setup.py @@ -31,18 +31,16 @@ def get_requirements(): setup( name='awesome', version=VERSION, - description='Generic algorithms and data structures', + description='x', long_description=LONG_DESCRIPTION, long_description_content_type='text/markdown', - keywords=['Algorithms', 'Data Structures'], - author='glozanoa', - author_email='glozanoa@uni.pe', - url='https://github.com/glozanoa/adas', + author='x', + author_email='x', + url='https://github.com/glozanoa/example-python', license='GPL3', classifiers = [ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: POSIX :: Linux", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9" ], packages=find_packages(), From 2bee09d32ebf84bc837728ce1b722b999f5dbae8 Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 27 Dec 2021 14:15:43 +0000 Subject: [PATCH 14/21] update Jenkisfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4b3a699f..02f217c3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { sh 'printenv' sh 'python3 --version' sh 'python3 -m pip install -r requirements.txt' - sh 'python3 setup.py install' + sh 'python3 setup.py install --user' } } stage('tests'){ From 9bed53aa9266bd85dfa83b1a98a4c4f77275b5f2 Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 27 Dec 2021 14:19:42 +0000 Subject: [PATCH 15/21] adding --user flag to Jenkins file --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 02f217c3..4d76da68 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ pipeline { echo "DISABLE_AUTH is ${DISABLE_AUTH}" sh 'printenv' sh 'python3 --version' - sh 'python3 -m pip install -r requirements.txt' + sh 'python3 -m pip install --user -r requirements.txt' sh 'python3 setup.py install --user' } } From 20ba708e755122440b483d7bc0ead4f16347ad25 Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 27 Dec 2021 14:43:08 +0000 Subject: [PATCH 16/21] add push trigger --- Jenkinsfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 4d76da68..11ce365c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,6 +2,10 @@ pipeline { agent { docker { image 'python:3.9' } } + + triggers { + githubPush() + } environment { DISABLE_AUTH = 'true' From 34b36a48aa2d37673ae94af9f2d94e326d2d7383 Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 27 Dec 2021 14:52:07 +0000 Subject: [PATCH 17/21] create python virtualenv --- Jenkinsfile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 11ce365c..a9f1719d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,15 +17,20 @@ pipeline { steps { echo "Database engine is ${DB_ENGINE}" echo "DISABLE_AUTH is ${DISABLE_AUTH}" - sh 'printenv' - sh 'python3 --version' - sh 'python3 -m pip install --user -r requirements.txt' - sh 'python3 setup.py install --user' + sh "python3 -m venv ${WORKSPACE}/env" + withPythonEnv("${WORKSPACE}/env/bin/python3"){ + sh 'printenv' + sh 'python3 --version' + sh 'python3 -m pip install --user -r requirements.txt' + sh 'python3 setup.py install --user' + } } } stage('tests'){ steps{ - sh 'pytest -v tests' + withPythonEnv("{WORKSPACE}/env/bin/python3"){ + sh 'pytest -v tests' + } } } } From a751cd9965dd2954d3d1366de345a37fcbc22902 Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 27 Dec 2021 14:54:15 +0000 Subject: [PATCH 18/21] update Jenkinsfile --- Jenkinsfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a9f1719d..743684df 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,9 +20,10 @@ pipeline { sh "python3 -m venv ${WORKSPACE}/env" withPythonEnv("${WORKSPACE}/env/bin/python3"){ sh 'printenv' + sh 'whereis python3' sh 'python3 --version' - sh 'python3 -m pip install --user -r requirements.txt' - sh 'python3 setup.py install --user' + sh 'python3 -m pip install -r requirements.txt' + sh 'python3 setup.py install' } } } From 8419a7d2787feb92be19e7b08367cba38d800187 Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 27 Dec 2021 14:58:46 +0000 Subject: [PATCH 19/21] update python virtual env --- Jenkinsfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 743684df..919d4a20 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,19 +17,18 @@ pipeline { steps { echo "Database engine is ${DB_ENGINE}" echo "DISABLE_AUTH is ${DISABLE_AUTH}" - sh "python3 -m venv ${WORKSPACE}/env" - withPythonEnv("${WORKSPACE}/env/bin/python3"){ + withPythonEnv('Python3'){ sh 'printenv' sh 'whereis python3' sh 'python3 --version' - sh 'python3 -m pip install -r requirements.txt' + sh 'pip install -r requirements.txt' sh 'python3 setup.py install' } } } stage('tests'){ steps{ - withPythonEnv("{WORKSPACE}/env/bin/python3"){ + withPythonEnv('Python3'){ sh 'pytest -v tests' } } From cc5d13e62627afba1fb590cf0bb7661f54387b9b Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 27 Dec 2021 15:05:16 +0000 Subject: [PATCH 20/21] update Jenkisfile --- Jenkinsfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 919d4a20..81fa7678 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,8 @@ pipeline { steps { echo "Database engine is ${DB_ENGINE}" echo "DISABLE_AUTH is ${DISABLE_AUTH}" - withPythonEnv('Python3'){ + sh "python3 -m venv ${WORKSPACE}/env" + withPythonEnv("${WORKSPACE}/env"){ sh 'printenv' sh 'whereis python3' sh 'python3 --version' @@ -28,7 +29,7 @@ pipeline { } stage('tests'){ steps{ - withPythonEnv('Python3'){ + withPythonEnv("${WORKSPACE}/env"){ sh 'pytest -v tests' } } From 63ca42a6eb0353d24c37295803e4b533fff0770f Mon Sep 17 00:00:00 2001 From: glozanoa Date: Mon, 27 Dec 2021 15:06:50 +0000 Subject: [PATCH 21/21] update Jenkisfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 81fa7678..370af27c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { echo "Database engine is ${DB_ENGINE}" echo "DISABLE_AUTH is ${DISABLE_AUTH}" sh "python3 -m venv ${WORKSPACE}/env" - withPythonEnv("${WORKSPACE}/env"){ + withPythonEnv("${WORKSPACE}/env/bin/python3"){ sh 'printenv' sh 'whereis python3' sh 'python3 --version' @@ -29,7 +29,7 @@ pipeline { } stage('tests'){ steps{ - withPythonEnv("${WORKSPACE}/env"){ + withPythonEnv("${WORKSPACE}/env/bin/python3"){ sh 'pytest -v tests' } }