├── .github └── workflows │ ├── coverage.yml │ └── lint.yml ├── .gitignore ├── README.md ├── main.py ├── main_test.py └── requirements.txt /.github/workflows/coverage.yml: -------------------------------------------------------------------------------- 1 | name: Coverage Report 2 | 3 | # Run this workflow every time a new commit pushed to your repository 4 | on: push 5 | 6 | jobs: 7 | coverage-report: 8 | name: Coverage Report 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - name: Checkout code 13 | uses: actions/checkout@v2 14 | 15 | - name: Set up Python 3.7 16 | uses: actions/setup-python@v2 17 | with: 18 | # Semantic version range syntax or exact version of a Python version 19 | python-version: '3.7' 20 | # Optional - x64 or x86 architecture, defaults to x64 21 | architecture: 'x64' 22 | 23 | - name: Install dependencies 24 | run: | 25 | python -m pip install --upgrade pip 26 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi 27 | - name: Generate coverage report 28 | run: | 29 | coverage run --source=./ -m unittest discover -p "*_test.py" 30 | coverage xml 31 | 32 | - name: Upload coverage to code climate 33 | env: 34 | CODECLIMATE_REPO_TOKEN: 51642184e2902baab3007c428a39a553590c79209aa133eb7fc093e3b021b775 35 | run: | 36 | codeclimate-test-reporter 37 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint Code Base 2 | 3 | on: push 4 | 5 | jobs: 6 | # Set the job key. The key is displayed as the job name 7 | # when a job name is not provided 8 | super-lint: 9 | # Name the Job 10 | name: Lint Code Base 11 | # Set the type of machine to run on 12 | runs-on: ubuntu-latest 13 | 14 | env: 15 | OS: ${{ matrix.os }} 16 | PYTHON: '3.7' 17 | 18 | steps: 19 | # Checks out a copy of your repository on the ubuntu-latest machine 20 | - name: Checkout code 21 | uses: actions/checkout@v2 22 | 23 | # Runs the Super-Linter action 24 | - name: Lint Code Base 25 | uses: github/super-linter@v3 26 | env: 27 | DEFAULT_BRANCH: master 28 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 29 | VALIDATE_PYTHON_BLACK: true 30 | VALIDATE_PYTHON_FLAKE8: true 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | *.pyc -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # research-ci-tutorial 2 | 3 | [![GitHub Super-Linter](https://github.com/chris-chris/research-ci-tutorial/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/chris-chris/research-ci-tutorial/actions?query=workflow%3A%22Lint+Code+Base%22) 4 | 5 | [![GitHub Super-Linter](https://github.com/chris-chris/research-ci-tutorial/workflows/Coverage%20Report/badge.svg)](https://github.com/chris-chris/research-ci-tutorial/actions?query=workflow%3A%22Coverage+Report%22) 6 | 7 | [![Maintainability](https://api.codeclimate.com/v1/badges/2fd0df0932dc941a684d/maintainability)](https://codeclimate.com/github/chris-chris/research-ci-tutorial/maintainability) 8 | 9 | [![Test Coverage](https://api.codeclimate.com/v1/badges/2fd0df0932dc941a684d/test_coverage)](https://codeclimate.com/github/chris-chris/research-ci-tutorial/test_coverage) 10 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | def helloworld(): 2 | return "Hello World!" 3 | -------------------------------------------------------------------------------- /main_test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from main import helloworld 4 | 5 | 6 | class MainTest(unittest.TestCase): 7 | def test_helloworld(self): 8 | ret = helloworld() 9 | self.assertEqual(ret, "Hello World!") 10 | 11 | 12 | if __name__ == "__main__": 13 | unittest.main() 14 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | coverage==4.3 2 | codeclimate-test-reporter 3 | --------------------------------------------------------------------------------