Skip to content

Commit 5ab03cd

Browse files
feat: Add CI/CD workflow for React Todo App with build and test steps
1 parent 2bdc269 commit 5ab03cd

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ jobs:
1717
# Checkout the repository
1818
- name: Checkout repository
1919
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
23+
with:
24+
node-version: '22'
25+
cache: 'npm'
2026

2127
# Install dependencies
2228
- name: Install dependencies
23-
run: npm install
29+
run: npm ci
2430

2531
# Generate SBOM from the dependencies (scanning the workspace directory)
2632
- name: Generate SBOM

.github/workflows/ci-cd.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: React Todo App CI/CD
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
# Explicitly define permissions
10+
permissions:
11+
contents: read
12+
pull-requests: read
13+
checks: write
14+
15+
jobs:
16+
build-and-test:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
25+
with:
26+
node-version: '22'
27+
cache: 'npm'
28+
29+
- name: Install dependencies
30+
run: npm ci
31+
32+
- name: Build application
33+
run: npm run build
34+
35+
- name: Run tests
36+
run: npm test
37+
38+
# TODO: Add linting steps
39+
# - name: Run ESLint
40+
# run: npm run lint
41+
#
42+
# - name: Run accessibility checks
43+
# run: npm run lint:a11y

0 commit comments

Comments
 (0)