-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (135 loc) · 4.97 KB
/
cicd.yml
File metadata and controls
163 lines (135 loc) · 4.97 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: CI/CD Pipeline
on:
pull_request:
types: [opened, synchronize]
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
checks: write
actions: read
pull-requests: write
env:
NODE_VERSION: "24"
jobs:
build-and-test:
name: Build & Test
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Enable Corepack (Yarn Berry)
run: corepack enable
- name: Setup Yarn Berry
run: yarn set version 4.12.0
- name: Restore Yarn Cache
uses: actions/cache@v4
with:
path: |
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.pnp.cjs
key: yarn-${{runner.os}}-${{hashFiles('**/yarn.lock')}}
restore-keys: yarn-${{runner.os}}-
- name: Install Dependencies (Yarn Berry)
run: yarn install --immutable
- name: Restore Turborepo Cache
uses: actions/cache@v4
with:
path: .turbo
key: turbo-${{runner.os}}-${{hashFiles('turbo.json', 'package.json', '**/package.json')}}
restore-keys: turbo-${{runner.os}}-
- name: Run Typecheck
run: yarn typecheck
- name: Run Lint
run: yarn lint
- name: Run Tests with Coverage
run: yarn test:coverage
- name: Build All Packages
run: yarn build
- name: Upload Inspector Client Build
uses: actions/upload-artifact@v4
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
name: inspector-client-dist
path: packages/patchlogr-inspector/client/dist
retention-days: 1
- name: Upload Inspector Server Build
uses: actions/upload-artifact@v4
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
name: inspector-server-dist
path: packages/patchlogr-inspector/server/dist
retention-days: 1
- name: Report Test Logs
uses: dorny/test-reporter@v1
if: (!cancelled())
with:
name: Test Logs
path: "**/.coverage/report.xml"
reporter: java-junit
- name: Upload Test Artifacts
uses: actions/upload-artifact@v4
if: (!cancelled())
with:
name: Test Reports
path: |
**/.coverage/report.xml
**/coverage/**/*
retention-days: 7
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: (!cancelled())
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: packages/**/.coverage/lcov.info
fail_ci_if_error: false
verbose: true
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: (!cancelled())
with:
files: "**/.coverage/report.xml"
deploy-client:
name: Deploy Inspector Client
needs: build-and-test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Download Client Build Artifact
uses: actions/download-artifact@v4
with:
name: inspector-client-dist
path: dist
- name: Deploy to Hosting
run: |
echo "Client build files downloaded to ./dist"
ls -la dist/
# TODO: 배포 step 추가 필요
deploy-server:
name: Deploy Inspector Server
needs: build-and-test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Download Server Build Artifact
uses: actions/download-artifact@v4
with:
name: inspector-server-dist
path: packages/patchlogr-inspector/server/dist
- name: Deploy to Server
run: |
echo "Server build files downloaded"
ls -la packages/patchlogr-inspector/server/dist/
# TODO: 배포 step 추가 필요