-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (114 loc) · 3.54 KB
/
ci.yml
File metadata and controls
139 lines (114 loc) · 3.54 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: CI Checks
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
ui-checks:
name: UI Checks (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['20.x', '21.x']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-${{ matrix.node-version }}-
- name: Install dependencies
run: npm ci
- name: Check formatting
run: npm run format:ui
- name: Lint check
run: npm run lint:ui
- name: Type check
run: npm run types:ui
- name: Run tests
run: npm run ui:test
- name: Upload test coverage
uses: actions/upload-artifact@v4
if: success()
with:
name: ui:coverage-node-${{ matrix.node-version }}
path: coverage/
retention-days: 5
backend-checks:
name: Backend Checks (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['20.x', '21.x']
# Add MySQL service container
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: dappykit_apps
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: |
~/.npm
backend/node_modules
key: ${{ runner.os }}-backend-${{ matrix.node-version }}-${{ hashFiles('backend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-backend-${{ matrix.node-version }}-
- name: Install root dependencies
run: npm ci
- name: Install backend dependencies
run: cd backend && npm ci
- name: Check formatting
run: npm run format:backend
- name: Lint check
run: npm run lint:backend
- name: Type check
run: cd backend && npx tsc --noEmit --project tsconfig.json
# Add environment variables for MySQL connection
- name: Run tests
run: npm run backend:test
env:
DB_HOST: localhost
DB_USER: root
DB_PASSWORD: root
DB_NAME: dappykit_apps
notify:
name: Notify status
needs: [ui-checks, backend-checks]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check workflow status
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
- name: Successful run
if: ${{ !contains(needs.*.result, 'failure') }}
run: echo "All checks passed successfully!"