├── .github └── workflows │ └── python-app.yml ├── .gitignore ├── README.md ├── requirements.txt ├── src ├── __init__.py └── math_operations.py └── tests ├── __init__.py └── test_operation.py /.github/workflows/python-app.yml: -------------------------------------------------------------------------------- 1 | name: Python CI 2 | 3 | # Trigger the workflow on any push to the main branch or pull request 4 | on: 5 | push: 6 | branches: 7 | - main 8 | pull_request: 9 | branches: 10 | - main 11 | 12 | jobs: 13 | test: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | # Step 1: Check out the code from the repository 18 | - name: Check out code 19 | uses: actions/checkout@v2 20 | 21 | # Step 2: Set up Python environment 22 | - name: Set up Python 23 | uses: actions/setup-python@v2 24 | with: 25 | python-version: '3.8' 26 | 27 | # Step 3: Install dependencies 28 | - name: Install dependencies 29 | run: | 30 | python -m pip install --upgrade pip 31 | pip install -r requirements.txt 32 | 33 | # Step 4: Run tests 34 | - name: Run tests 35 | run: pytest 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .github -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## This is the python app 1 2 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pandas 2 | pytest -------------------------------------------------------------------------------- /src/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishnaik06/appgithubaction/b84e335abe29bc8657b733bef044bf36732cae65/src/__init__.py -------------------------------------------------------------------------------- /src/math_operations.py: -------------------------------------------------------------------------------- 1 | def add(a,b): 2 | return a+b 3 | 4 | def sub(a,b): 5 | return a-b -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishnaik06/appgithubaction/b84e335abe29bc8657b733bef044bf36732cae65/tests/__init__.py -------------------------------------------------------------------------------- /tests/test_operation.py: -------------------------------------------------------------------------------- 1 | from src.math_operations import add,sub 2 | 3 | def test_add(): 4 | assert add(2,3)==5 5 | assert add(-1,1)==0 6 | 7 | def test_sub(): 8 | assert sub(5,3)==2 9 | assert sub(4,3)==1 10 | assert sub(3,3)==0 11 | assert sub(2,3)==-1 --------------------------------------------------------------------------------