-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (75 loc) · 2.07 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Continuos Integration
on: [push, pull_request]
jobs:
lint:
name: Lint source code
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎
uses: actions/checkout@v4
- name: Install dependencies 📦
uses: bahmutov/npm-install@v1
- name: Check types 🧩
uses: icrawl/action-tsc@v1
- name: Lint 🧹
run: npm run lint
- name: Check format 💅
run: npx prettier --check .
unit-test:
name: Run unit and integration tests
runs-on: ubuntu-latest
needs: [lint]
steps:
- name: Checkout 🛎
uses: actions/checkout@v4
- name: Install Node.js with lts/* version
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: npm
- name: Install dependencies 📦
run: npm ci
- name: Run unit tests 🧪
run: npm t
e2e-test:
name: Run E2E tests
runs-on: ubuntu-latest
needs: [lint]
steps:
- name: Checkout 🛎
uses: actions/checkout@v4
- name: Install Node.js with latest LTS version
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: npm
- name: Install dependencies 📦
run: npm ci
- name: Build the server 🏗️
run: npm run build
- name: Run E2E tests 🧪
run: npm run start:e2e
env:
NODE_ENV: production
SECRET: ${{ github.sha }}
release:
name: Release a new version 🚀
runs-on: ubuntu-latest
needs: [unit-test, e2e-test]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout 🛎
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install Node.js with latest LTS version
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: npm
- name: Install dependencies 📦
run: npm ci
- name: Release 🚀
run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}