GitHub Actions CI Pipeline Documentation
As a former 3D Animator with more than 12 years of experience, I have always been fascinated by the intersection of technology and creativity. That's why I recently shifted my career towards MERN stack development and software engineering, where I have been serving since 2021.
With my background in 3D animation, I bring a unique perspective to software development, combining creativity and technical expertise to build innovative and visually engaging applications. I have a passion for learning and staying up-to-date with the latest technologies and best practices, and I enjoy collaborating with cross-functional teams to solve complex problems and create seamless user experiences.
In my current role as a MERN stack developer, I have been responsible for developing and implementing web applications using MongoDB, Express, React, and Node.js. I have also gained experience in Agile development methodologies, version control with Git, and cloud-based deployment using platforms like Heroku and AWS.
I am committed to delivering high-quality work that meets the needs of both clients and end-users, and I am always seeking new challenges and opportunities to grow both personally and professionally.
This document provides a comprehensive explanation of the GitHub Actions CI pipeline, detailing each command and step used in the workflow configuration file. The pipeline is designed to run tests across multiple operating systems when code is pushed to the main branch or when a pull request is made to the main branch.
Workflow Configuration File
name: BE-SMIT-B-11
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install dependencies
run: npm install
Explanation of Commands
name: BE-SMIT-B-11
Purpose: Defines the name of the workflow. This name will appear in the GitHub Actions interface.
Value:
BE-SMIT-B-11– This is a custom name chosen for the workflow.
on:
Purpose: Specifies the events that trigger the workflow.
Sub-commands:
push:: Triggers the workflow when code is pushed to themainbranch.pull_request:: Triggers the workflow when a pull request is made to themainbranch.
jobs:
- Purpose: Defines the jobs that make up the workflow. Each job contains a set of steps that GitHub Actions will execute.
build:
- Purpose: This is the name of the job that is defined. It will run the specified tasks on different operating systems.
strategy:
Purpose: Specifies the strategy for running the job across a matrix of different environments.
Sub-commands:
matrix:: Defines the set of different environments (in this case, operating systems) on which the job will run.os: [ubuntu-latest, windows-latest, macos-latest]: Specifies that the job should run on the latest versions of Ubuntu, Windows, and macOS.
runs-on: ${{ matrix.os }}
Purpose: Instructs GitHub Actions to run the job on the operating system specified in the matrix.
Value:
${{ matrix.os }}– This dynamically refers to each operating system listed in thematrix.
steps:
- Purpose: Lists the steps that will be executed in the job.
- name: Checkout code
Purpose: Checks out the repository's code so that the workflow can access it.
Command:
uses: actions/checkout@v2uses: Specifies that the step uses thecheckoutaction from GitHub's marketplace.@v2: Indicates that version 2 of thecheckoutaction should be used.
- name: Set up Node.js
Purpose: Sets up the Node.js environment.
Command:
uses: actions/setup-node@v2uses: Specifies that the step uses thesetup-nodeaction from GitHub's marketplace.@v2: Indicates that version 2 of thesetup-nodeaction should be used.
with:: Provides additional configuration for thesetup-nodeaction.node-version: '18': Specifies that Node.js version 18 should be used.
- name: Install dependencies
Purpose: Installs the project dependencies defined in the
package.jsonfile.Command:
run: npm installrun: Executes the command within the CI environment.npm install: Runs the Node Package Manager (npm) to install the project dependencies.
Summary
This GitHub Actions CI pipeline runs on multiple operating systems (Ubuntu, Windows, and macOS) when code is pushed or a pull request is made to the main branch. It sets up a Node.js environment, checks out the code, installs dependencies, and ensures that the project can run successfully across different platforms. This setup helps in maintaining consistency and detecting issues across various environments early in the development cycle.