untitled

Pasted Oct 2, 2026, 6:21 PM1 file177 lines

Scan to open on your phone

Point a camera at the QR code - it opens this exact paste, no app needed.

https://codepastes.com/circleci
untitled
Download github for desktop Link for download- https://desktop.github.com/
Download git bash for windows Link for download- https://git-scm.com/download/win
Download vs code for windows
Download python extension in vs code by clicking on extension icon in vs code.
 Create folder with name CIRCLE-CI.
Open the folder with Open with Code
Create one new file with name main.py inside CIRCLE-CI folder
def to_upper(name):
    return name.upper()

def say_hello(name):
    print(f'Hello, {name}')
    
if __name__ == '__main__':
    name = 'TrainWithTannu'
    say_hello(name)
    up = to_upper(name)
    print(up)
  --------------------------------------
  Create one new file with name test.py inside circle-ci folder
import unittest
from main import to_upper

class MyTestCase(unittest.TestCase):
    def test_to_upper(self):
        name = 'Tannu'
        upper_name = to_upper(name)
        self.assertEqual(upper_name, "Tannu")

if __name__ == '__main__':
    unittest.main()
 -----------------------------------
 Open New Terminal → Click on Terminal → New Terminal
 Right Side-Git Bash Option Should Come as shown below
 If Git Bash is not visible than install Git for Windows
 Select Git Bash option in Terminal
  Open Github for desktop click on sign in and make Account on Github to store the
Repository
After successfully created New Account Github Sign In by entering username and
password
Create readme.md file in visual code in circle-ci folder and write below code in
readme.md file.
Create new repository in github by going to github.com and after signing in below
screen will appear click on Create repository button.
nter Repository name CircleCI-Python3 and select Add a README file option and
Click On Create Repository button at bottom.
Click on Code and Copy the url of your repository
https://github.com/Tannuk17/CircleCI-Python3.git
Clone this repository on vscode by typing below command
git clone  https://github.com/archana1235678/CIRCLE-CI.git
(MINGW64"LOCATION")
After successfully cloning go to that directory on terminal by typing
command: cd CircleCI-Python3
Check the status of git repository by command: git status
Here files are not added than to add file copy paste that file on repository
CircleCI-Python3/
Both the readme.md files are required to be
Add your pasted file on github by typing below command
Command: git add . → Click Enter
Commit your file on github write command git commit -m “added python file by
archana"
Now push the code on git by command: git push origin main
To run the project type command: python main.py
Create new folder .circleci inside CircleCI-Python3/ FOLDER
Create file config.yml file inside .circleci FOLDER
version: 2.1

jobs:
  build:
    docker:
      - image: cimg/python:3.11

    steps:
      - checkout
      - run: python main.py

workflows:
  build_and_test_deploy:
    jobs:
      - build
---------------------------
After writing the above code push the code in git by running following commands:
git status – to check status of changes
Git add .
git commit -m “updated file by foldername"
git push origin main – after enter below popup will come click on sign in with browser and finish
authentication.
Now after pushing changes login to circleci website by clicking on log in with Github.
After clicking on Log in with Github below screen will appear click on Authorize
After clicking on Authorize circle below message will appear
After successfully authorizing Set up your code by selecting organization and
repository → Click on Set Up Project.
After Setting up project below Dashboard will appear.
If its showing running then go to project tab and click on unfollow project for your
project
After unfollowing → Click on Set Up Project below screen will appear Select your
project and check it is in main branch → Click on Set Up Project.
After Setting Up Project your Project Status will show Success
After clicking on down arrow build link will appear where you can see your main.py
Running.
After clicking on build below screen will appear where you can see main.py file
running.
After successfully building we will test test.py file by writing below code in config.yml
file.
version: 2.1

jobs:
  build:
    docker:
      - image: cimg/python:3.11
    steps:
      - checkout
      - run: python main.py

  test:
    docker:
      - image: cimg/python:3.11
    steps:
      - checkout
      - run: python test.py

workflows:
  build_and_test_deploy:
    jobs:
      - build
      - test
-------------------------------------
After writing above code commit and push updated code on git by running git command
(git status, git add, git commit -m "added test job", git push origin main)
After pushing modified code we can see in dashboard two jobs successful build and
open.
When clicked on test link we can see test.py file successfully executing.
After this write below code in config.yml file to run deploy code.
version: 2.1

jobs:
  build:
    docker:
      - image: cimg/python:3.11
    steps:
      - checkout
      - run: python main.py

  test:
    docker:
      - image: cimg/python:3.11
    steps:
      - checkout
      - run: python test.py

  deploy:
    docker:
      - image: cimg/python:3.11
    steps:
      - run: echo "Deploying Successful!"

workflows:
  build_and_test_deploy:
    jobs:
      - build
      - test:
          requires:
            - build
      - deploy:
          requires:
            - test
          filters:
            branches:
              only: main
              
Push this updated code in git by executing git commands.
(git status, git add, git commit -m "added deploy job", git push origin main)
After successfully pushing config.yml file → Open circleci we can see three jobs done
build, test and deploy success in status.
When clicked on deploy link we can see below screen with “Deploying Successful”
message.

5,851 chars · codepastes.com