Skip to content

Commit abce38a

Browse files
Merge pull request jedancodeacademy-bit#16 from Solomonkassa/patch-15
Create ci.yml
2 parents fb30c6a + 2052e85 commit abce38a

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: CI Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [18.x, 20.x]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
cache: 'npm'
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Lint
29+
run: npm run lint
30+
31+
- name: Type check
32+
run: npx tsc --noEmit
33+
34+
- name: Test
35+
run: npm run test
36+
37+
- name: Build
38+
run: npm run build
39+
40+
- name: Upload coverage reports
41+
uses: codecov/codecov-action@v3
42+
with:
43+
file: ./coverage/lcov.info
44+
fail_ci_if_error: true
45+
46+
- name: Security audit
47+
run: npm run security
48+
49+
deploy:
50+
needs: test
51+
runs-on: ubuntu-latest
52+
if: github.ref == 'refs/heads/main'
53+
54+
steps:
55+
- uses: actions/checkout@v4
56+
57+
- name: Setup Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: '18.x'
61+
62+
- name: Install dependencies
63+
run: npm ci
64+
65+
- name: Build
66+
run: npm run build
67+
68+
- name: Deploy to GitHub Pages
69+
uses: peaceiris/actions-gh-pages@v3
70+
with:
71+
github_token: ${{ secrets.GITHUB_TOKEN }}
72+
publish_dir: ./docs

0 commit comments

Comments
 (0)