Skip to content

Commit de46b47

Browse files
committed
change the version of the node JS
1 parent 61f971d commit de46b47

3 files changed

Lines changed: 108 additions & 3 deletions

File tree

.github/workflows/cicd.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
strategy:
2121
matrix:
22-
node-version: [18.x, 20.x]
22+
node-version: [12.x, 14.x, 16.x]
2323

2424
steps:
2525
- name: Checkout code
@@ -87,7 +87,6 @@ jobs:
8787
- name: Run ESLint with annotations
8888
run: |
8989
npx eslint --config eslintrc.json src tests --format @microsoft/eslint-formatter-sarif --output-file eslint-results.sarif
90-
continue-on-error: true
9190
9291
- name: Upload ESLint results to GitHub
9392
uses: github/codeql-action/upload-sarif@v3

README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

req.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
Implementing Continuous Integration with GitHub Actions
2+
Welcome to Module 3 of our GitHub Actions course, focused on Implementing Continuous Integration. In this module, you will delve into more advanced aspects of GitHub Actions, learning how to configure build matrices for testing across multiple environments and integrating essential code quality checks. Whether you are an aspiring developer or an experienced coder looking to streamline your workflow, this module is designed to enhance your skills in automating and improving the quality of your software development process.
3+
4+
Why Continuous Integration is Essential for Learners
5+
puzzle analogy
6+
7+
Imagine you're building a complex puzzle. Each piece represents a part of your code - a feature, a bug fix, or a new functionality. In the absence of continuous integration, adding a new piece to the puzzle is like working in the dark. You hope it fits perfectly without affecting the existing pieces, but you can't be sure until the entire puzzle is complete. This approach is time-consuming and prone to errors.
8+
9+
Now, imagine having a system that illuminates each new piece as you add it, instantly showing you how it fits with the existing ones. This is what continuous integration does for software development. It allows you to integrate changes frequently and detect issues early, ensuring that each 'piece' of your code seamlessly integrates with the existing 'puzzle' without disruptions. By mastering continuous integration with GitHub Actions, you are not just learning to code; you are learning to build your software puzzle efficiently, piece by piece, ensuring quality and cohesion at every step.
10+
11+
Pre-requisites
12+
Proficiency in YAML (Refer to Project 2):
13+
14+
Basic understanding of YAML syntax and structure.
15+
Familiarity with writing and interpreting YAML files, as GitHub Actions workflows are defined in YAML.
16+
Resource: Learn YAML in Y Minutes.
17+
Experience with GitHub and GitHub Actions:
18+
19+
Basic knowledge of how to use GitHub, including creating repositories and pushing code.
20+
A foundational understanding of GitHub Actions and how they work.
21+
Resource: GitHub Actions Documentation.
22+
Understanding of Node.js and npm:
23+
24+
Experience with Node.js, as the project examples are based on Node.js environments.
25+
Familiarity with npm (Node Package Manager) for managing Node.js project dependencies.
26+
Resource: Node.js Documentation.
27+
Familiarity with Software Testing Concepts:
28+
29+
Basic knowledge of software testing principles.
30+
Understanding of automated testing and its role in CI/CD.
31+
Knowledge of Code Quality Tools:
32+
33+
Familiarity with static code analysis and linting tools, especially ESLint for JavaScript.
34+
Resource: ESLint - Pluggable JavaScript Linter.
35+
Access to a Development Environment:
36+
37+
A computer with Git, Node.js, and a text editor or IDE installed.
38+
Internet access to clone the project repository and perform tasks online.
39+
Willingness to Experiment and Learn:
40+
41+
An open-minded approach to learning new CI/CD practices.
42+
Eagerness to apply new concepts and troubleshoot potential issues.
43+
By fulfilling these prerequisites, learners will be well-prepared to dive into the lessons on configuring build matrices and integrating code quality checks, gaining hands-on experience in implementing continuous integration workflows with GitHub Actions.
44+
45+
Lesson 2: Configuring Build Matrices
46+
Objectives:
47+
Implement matrix builds to test across multiple versions or environments.
48+
Manage build dependencies efficiently.
49+
Detailed Steps and Code Explanation:
50+
Parallel and Matrix Builds:
51+
52+
A matrix build allows you to run jobs across multiple environments and versions simultaneously, increasing efficiency.
53+
This is useful for testing your application in different versions of runtime environments or dependencies.
54+
55+
Copy
56+
strategy:
57+
matrix:
58+
node-version: [12.x, 14.x, 16.x] # This matrix will run the job multiple times, once for each specified Node.js version (12.x, 14.x, 16.x). # The job will be executed separately for each version, ensuring compatibility across these versions.
59+
Managing Build Dependencies:
60+
61+
Handling dependencies and services required for your build process is crucial.
62+
Utilize caching to reduce the time spent on downloading and installing dependencies repeatedly.
63+
64+
Copy
65+
66+
- name: Cache Node Modules
67+
uses: actions/cache@v2
68+
with:
69+
path: ~/.npm
70+
key: ${{" runner.os "}}-node-${{" hashFiles('**/package-lock.json') "}}
71+
restore-keys: |
72+
${{" runner.os "}}-node-
73+
# This snippet caches the installed node modules based on the hash of the 'package-lock.json' file.
74+
# It helps in speeding up the installation process by reusing the cached modules when the 'package-lock.json' file hasn't changed.
75+
Lesson 3: Integrating Code Quality Checks
76+
Objectives:
77+
Integrate code analysis tools into the GitHub Actions workflow.
78+
Configure linters and static code analyzers for maintaining code quality.
79+
Detailed Steps and Code Explanation:
80+
Adding Code Analysis Tools:
81+
82+
Include steps in your workflow to run tools that analyze code quality and adherence to coding standards.
83+
84+
Copy
85+
86+
- name: Run Linter
87+
run: npx eslint .
88+
# 'npx eslint .' runs the ESLint tool on all the files in your repository.
89+
# ESLint is a static code analysis tool used to identify problematic patterns in JavaScript code.
90+
Configuring Linters and Static Code Analyzers:
91+
92+
Ensure your repository includes configuration files for these tools, such as .eslintrc for ESLint.
93+
94+
Copy
95+
96+
# Ensure to include a .eslintrc file in your repository
97+
98+
# This file configures the rules for ESLint, specifying what should be checked.
99+
100+
# Example .eslintrc content:
101+
102+
# {"\n # \"extends\": \"eslint:recommended\",\n # \"rules\": {\n # // additional, custom rules here\n # "}
103+
104+
# }
105+
106+
Previous step
107+
How to start a CI pipeline with Actions

0 commit comments

Comments
 (0)