How to Connect GitHub to Jenkins and Automate CI/CD Pipelines.
Step 1 : Create a New Project folder workspace in C or D drive in the Name of : Project_Github_Jenkins_Integration
Project_Github_Jenkins_IntegrationStep 2: Create a New project folder in the name of : Github_jenkins_project
Github_jenkins_projectStep 3: Open the project in vs code
code .Step 4 : Based on the image, clicking “Manage” inside the blue warning banner will open a menu or dialog box that allows you to configure your Workspace Trust settings in Cursor/VS Code.
Step 5: Based on the image, clicking “Trust” (indicated by the blue button and red arrow) means you are declaring that you trust the authors of the files in your current project folder.
When you click this button, you exit Restricted Mode and unlock the full capabilities of your editor for this workspace. Specifically, it enables the following functions that are currently blocked:
Step 6: Based on the image, clicking the “X” (Close/Cancel) button indicated by the red arrow means you are simply closing the Workspace Trust configuration window.
Because you already clicked “Trust” in the previous step, the window now states “You trust this folder” at the top. Clicking the “X” will save this trusted state, close the screen, and return you directly to your empty code editor workspace so you can begin working with all features fully enabled.
Now that your project folder is trusted and ready, would you like help opening a specific file, setting up a new code file, or opening the terminal (Ctrl + Alt + Z) to start working?
Step 7: In VS Code: Terminal → New Terminal , Make sure you’re using PowerShell. Your terminal might show:
PS D:\Project_Github_Jenkins_Integration\Github_jenkins_project>Step 8: Create a virtual environment by running the following command:
i. On Windows (Command Prompt):
python -m venv venv
venv\Scripts\activateii.On Windows (PowerShell):
(Note: If you get an execution policy error, run Set-ExecutionPolicy RemoteSigned -Scope Process first.)
python -m venv venv
.\.venv\Scripts\Activate.ps1iii. On macOS / Linux:
python3 -m venv venv
source venv/bin/activateAfter entering above command user can create .venv file is created below.
You’ll now have:
Github_jenkins_project
└── .venv
Step 9: Activate the Virtual Environment in PowerShell After creating the .venv virtual environment, run the following command to activate it: Activate it:
.\.venv\Scripts\Activate.ps1Step 10: After activating you will see like
(.venv) PS D:\Project_Github_Jenkins_Integration\Github_jenkins_project>Step11: After activating the virtual environment in VS Code, select Python: Select Interpreter from the Command Palette.
- Open VS Code.
- Press
Ctrl + Shift + P - The Command Palette will appear.
- Type or Search Python: Select Interpreter in search bar and click on it.
Python: Select InterpreterAfter selecting Python: Select Interpreter, you will see the available Python interpreters, as shown in the image belo
Step 12: click on
Python: Select InterpreterStep 13: Select the interpreter similar to: Python 3.x.x (‘.venv’) Or manually select: .\.venv\Scripts\python.exe , then Click on
.venv(3.14.7.final.0) .\.venv\Scripts\python.exeStep 14 : Ctrl+Shift+P → Developer: Reload Window after selecting .venv(3.14.7.final.0) .\.venv\Scripts\python.exe
Step 15: Install Playwright + Pytest With (.venv) visible in the terminal,
run:
pip install pytest-playwrightStep 16 : If user see such type warning then upgrade the pip version type below command :
To update, run:
python.exe -m pip install - upgrade pipAfter updating pip version you will see such type latest upgrade version of pip.
Step 17 : Verify pip version by entering below command.
pip - - versionAfter upgrading now pip version is 26.2.1 is latest version.
Step 18 : Or you can directly put below command to install playwright test Option 1: single command to install all the required plugins:
pip install pytest playwright pytest-xdist pytest-html allure-pytest pytest-rerunfailures openpyxl Faker python-slugifyStep 19 : Then install Playwright browsers:
playwright installUninstall Playwright browser:
playwright uninstallPlaywright uninstall all browser
playwright uninstall - allOr You can also install the dependencies for a single browser by passing it as an argument:
playwright install-deps chromiumIt’s also possible to combine install-deps with install so that the browsers and OS dependencies are installed with a single command.
playwright install - with-deps chromiumStep 20: Install Allure pytest plugin.
First Verify that allure pytest plugin is present put below command.
pip show allure-pytestStep 21:Then Run the below following command to install the required plugin:
pip install allure-pytestStep 22: Once the virtual environment is active, the project structure looks like this:
Step 23 : Enter below command :
pip list Step 24: Project folder structure breakdown
Based on your uploaded VS Code sidebar image, this layout follows an industry-standard Page Object Model (POM) pattern for a Python-based automation framework (like Pytest + Playwright). Here is what each part represents:
Github_jenkins_project
The root directory of your project hosted on GitHub and built via Jenkins.
- 📁
.github/
Contains GitHub-specific configurations. This is typically where your GitHub Actions workflow YAML files live if you trigger pipelines directly from GitHub. - 📁
.venv/
The isolated Python virtual environment folder where all project dependencies (likepytestandplaywright) are installed locally. - 📁
pages/
The core of the Page Object Model design pattern. This folder contains Python files representing different web pages, storing their UI locators and functional interaction methods. - 📁
reports/
The destination folder where test framework execution outputs—such as HTML reports, JUnit XML files, logs, and screenshots—are stored. - 📁
testdata/
Stores external data files utilized for data-driven testing, such as JSON files, CSV configurations, or environment variables. - 📁
tests/
Houses your actual functional execution script files (e.g., files namedtest_*.py) that carry out assertions against your application components. - 📁
utilities/
Contains custom helper scripts, database connectors, custom loggers, or API client wrapper functions reusable across multiple test files. - 🐍
config.py
Global framework settings configuration file hosting details like base URLs, timeout intervals, or target execution browser indicators. - 🐍
conftest.py
The centralized Pytest infrastructure file defining initialization fixtures, browser context setups, teardown scripts, and custom command-line flags. - ⚙️
pytest.ini
The master initialization configuration file used by Pytest to dictate default command line arguments, register markers, and define test discovery paths. - 📄
requirements.txt
The dependency manifest cataloging required application third-party libraries (pytest,playwright, etc.) used by Jenkins to reproduce your system workspace.
Git and GitHub Commands Used in the Project.
Step 25: git init is used to initialize a new Git repository in your current project folder.
Git creates a hidden .git folder inside your project directory. This folder stores Git-related information such as commits, branches, and configuration.
git initStep 26: Add your project files
git add .Step 27: Make your first commit
git commit -m "Added Github Jenkins Integration Project"Step 28: If your GitHub repository is completely empty and you want your initial code directly on the main branch, you can bypass creating a separate feature branch.
git branch -M mainStep 29: Link your local repository to GitHub by adding it as a remote origin:
git remote add origin https://github.com/DurgeshYaduvanshi2026/GitHub-Jenkins-integration-project.gitStep 30: Push your local code to the main branch on GitHub.
git push -u origin mainStep 31: Once the push is complete, refresh your GitHub repository page to view your project files on the main branch.
Step 32: Delete from GitHub but keep it on your computer
Get Context-driven-testing’s stories in your inbox
Join Medium for free to get updates from this writer.
If you want to remove the file from the online GitHub repository but keep the actual file on your local computer.
git rm --cached reporting-labsSteps : Delete from GitHub but keep it on your computer
- Go to your GitHub repository dashboard. Locate and click on the file or folder you want to delete (e.g., reporting-labs).
2. Click the three dots … menu on the upper right, select Delete directory, and confirm the deletion. Once the folder is removed from GitHub, open your local project environment.
3. Open your terminal in VS Code and run the following command to remove the directory from Git tracking while keeping the physical files on your local computer:
git rm -r --cached reporting-labs4. Commit and push the updates to GitHub
After adding reporting-labs/ to your .gitignore file, save the file and run the following commands in your terminal to sync your changes with GitHub:
git add .
git commit -m "Deleted the reporting-labs file"
git push 4. Verify the final changes on GitHub
After pushing the changes, navigate back to your GitHub repository dashboard to confirm that the reporting-labs directory is no longer present and that your .gitignore file has been updated successfully.
Step 33: Open your browser and log into your Jenkins dashboard.
Step 34: Click on “New Item” in the left-hand navigation panel to create a new project.
Step 35: Enter your project name in the input field, select Freestyle project from the item type options, and then click OK at the bottom of the page.
Step 36: In the Enter an item name field, type GitHub-Jenkins-Project. Ensure Freestyle project remains selected, then click the OK button at the bottom left to proceed.
Step 37: After clicking the OK button, you will be automatically redirected to the project configuration dashboard, where you can manage your job settings.
Step 38: Scroll down to the Source Code Management section, select the Git radio button, and paste your GitHub repository link into the Repository URL field.
Step 39: Scroll down to the Branches to build section. In the Branch Specifier field, change the value to */main to match your GitHub repository’s default branch. If you are using a different branch for your deployment, enter its name here instead.
Step 40: Leave the other configuration fields at their default values and scroll down to the Triggers section. Select the Build periodically checkbox, then enter your desired cron schedule expression in the Schedule text box to define when the project should run automatically.
Step 41: Enter H 22 * * * to run the build daily between 10:00 PM and 10:59 PM. The H symbol is a Jenkins best practice that randomizes the exact minute to prevent resource spikes.
Step 42: Configure Build Steps.
Scroll down to the Build Steps section and click on the Add build step dropdown button to choose the execution environment for your project commands.
Step 43: Select the build execution environment.
From the Add build step dropdown menu, select Execute Windows batch command to open the terminal input area for your project scripts.
Step 44: Access the Command Input Field.
Once you select the option, an Execute Windows batch command configuration block will appear. You will now see the empty Command text box where you can input your automation or execution scripts.
Step 45: Enter your build automation commands.
In the Command text box, enter the following sequence of batch commands to set up the virtual environment, install dependencies, clear old test data, and run your tests:
python -m venv .venv
call .venv\Scripts\activate
pip install -r requirements.txt
playwright install
rmdir /s /q reports\allure-results
pytest tests Note: If you’re on Mac/Linux, select “Execute shell” and use:
python -m venv .venv
call .venv\Scripts\activate
pip install -r requirements.txt
playwright install
rmdir /s /q reports\allure-results
pytest tests\Step 46: Navigate to Post-build Actions.
Once you finish configuring your build steps, scroll down to the “Post-build Actions” section.
Step 47: Add an Allure Report post-build action.
Click the Add post-build action dropdown button to open the actions menu. From the list of available options, select Allure Report to add test reporting to your pipeline configuration.
Step 48: Inside the Allure Report “Path” input box, specify your results directory as reports/allure-results.
reports/allure-resultsStep 49: Add an Email Notification post-build action.
Click the Add post-build action dropdown button once again. From the expanded options menu, select E-mail Notification to configure build status alerts for your team.
Step 50: Configure email notification recipients.
In the Recipients input box under the E-mail Notification section, enter the email addresses that should receive the build alerts. If you want to add multiple email IDs, separate them using spaces.
Step 51: Save and apply your configurations.
Once all build settings and post-build actions are complete, click the Apply button to register your changes, and then click Save to finalize the project setup and return to the main pipeline dashboard.
Step 52: Access the project overview dashboard.
After saving your configuration, you will be redirected to the main dashboard for GitHub-Jenkins-Project.
Step 53: Run the manual build execution.
Click on Build Now in the left sidebar menu to immediately trigger the pipeline and start your first automated integration run.
Step 54: Monitor the execution in the Build History panel.
Under the Builds card in the lower-left corner, you will see your first pipeline run (#1) appearing with a animated progress bar. This indicates that Jenkins is actively pulling your code from GitHub and executing the batch script commands.
Step 55: View the live execution logs.
From the build overview dashboard on the left-hand sidebar menu, click on Console Output to monitor the live execution details and terminal output of your running automation script.
Step 56: Verify the build logs and execution status.
The Console Output page displays the live execution logs. You can monitor the entire build lifecycle, including cloning the GitHub repository, installing python dependencies, executing the Playwright tests, and generating the final Allure test report. At the end of the log, confirm that the build finished with a Finished: SUCCESS status.
Step 57: Return to the Build Status dashboard.
From the left-hand sidebar navigation menu, click on Status to go back to the overview dashboard for this specific build execution (#1). Here, you can view generated build artifacts and access reporting links.
Step 58: Open the Allure Test Report.
Click on Allure Report in the left sidebar menu (or the matching link in the main center pane) to open your interactive graphical dashboard and review your test results.
Step 59: Analyze your execution results in the Allure Report Dashboard.
Clicking the link opens the comprehensive Allure Report web dashboard. You can navigate through the left sidebar tabs to fully analyze your test results:
i. Overview: Displays the global pass rate metric (100% success across all 7 test cases).
ii. Suites & Packages: Breaks down executions by specific functional folders like tests.login, tests.cart, and tests.checkout.
iii. Behaviors: Maps test cases back to core feature requirements and user stories.
iv. Graphs & Timeline: Visualizes test statistics, duration trends, severity status, and historical execution timelines.
Step 60: Return to the Jenkins project page.
Click the browser’s Back button in the upper-left corner to exit the Allure Report interface and return to your main Jenkins project dashboard.
Step 61: Click the “Jenkins” logo in the top-left corner to return to the main dashboard.
Step 62: Verify project status on the main dashboard.
You will now be back on the main Jenkins home dashboard. Look at your project list to confirm that GitHub-Jenkins-Project displays a green checkmark status icon under the S (Status) column, indicating a successful execution.
Step 63: Trigger a re-run from the main dashboard.
If you want to run the project again, you can trigger a build directly from the dashboard in two ways: click the dropdown arrow next to the project name and select Build Now, or click the green Play icon on the far right side of the project row.
Step 64: Click on “Build History” in the left sidebar navigation panel to view a detailed record of all past project executions.
Step 65: Click the “Jenkins” logo in the upper-left header panel to go back to your main project dashboard.








