diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index edf6a031..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,25 +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 - command: pip install -r requirements.txt - - run: - name: Run tests and collect coverage - command: | - coverage run tests.py - coverage xml - - codecov/upload - -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/.gitignore b/.gitignore new file mode 100644 index 00000000..7a9cd89c --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +**/.* +awesome/__pycache__/ +tests/__pycache__/ +.coverage +coverage.xml diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..370af27c --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,38 @@ +pipeline { + agent { + docker { image 'python:3.9' } + } + + triggers { + githubPush() + } + + environment { + DISABLE_AUTH = 'true' + DB_ENGINE = 'sqlite' + } + + stages { + stage('build') { + steps { + echo "Database engine is ${DB_ENGINE}" + echo "DISABLE_AUTH is ${DISABLE_AUTH}" + sh "python3 -m venv ${WORKSPACE}/env" + withPythonEnv("${WORKSPACE}/env/bin/python3"){ + sh 'printenv' + sh 'whereis python3' + sh 'python3 --version' + sh 'pip install -r requirements.txt' + sh 'python3 setup.py install' + } + } + } + stage('tests'){ + steps{ + withPythonEnv("${WORKSPACE}/env/bin/python3"){ + sh 'pytest -v tests' + } + } + } + } +} diff --git a/README.md b/README.md index a1689ef0..e995dc25 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # [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) +[![codecov](https://codecov.io/gh/glozanoa/example-python/branch/master/graph/badge.svg?token=2HIMOD4F7J)](https://codecov.io/gh/glozanoa/example-python) ## Guide diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..fc1c832f --- /dev/null +++ b/setup.py @@ -0,0 +1,49 @@ +#!/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='x', + long_description=LONG_DESCRIPTION, + long_description_content_type='text/markdown', + 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.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 92aa2034..00000000 --- a/tests.py +++ /dev/null @@ -1,12 +0,0 @@ -import unittest - -import awesome - - -class TestMethods(unittest.TestCase): - def test_add(self): - self.assertEqual(awesome.smile(), ":)") - - -if __name__ == '__main__': - unittest.main() diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b 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(), ":)")