@@ -10,98 +10,72 @@ jobs:
1010 test :
1111 name : Test
1212 runs-on : ubuntu-latest
13- permissions :
14- contents : read
15- id-token : write
1613 strategy :
1714 matrix :
1815 node-version : [18.x, 20.x]
1916
2017 steps :
21- - name : Checkout code
22- uses : actions/checkout@v4
23-
24- - name : Setup Node.js ${{ matrix.node-version }}
25- uses : actions/setup-node@v4
26- with :
27- node-version : ${{ matrix.node-version }}
28- cache : ' npm'
29-
30- - name : Install dependencies
31- run : npm ci
32-
33- - name : Run type checking
34- run : npm run type-check
35-
36- - name : Run linting
37- run : npm run lint
38-
39- - name : Check code formatting
40- run : npm run format:check
41-
42- - name : Run tests
43- run : npm run test:coverage
44-
45- # 🔹 Always upload the coverage folder so you can inspect reports from CI runs
46- - name : Upload coverage artifact
47- if : always()
48- uses : actions/upload-artifact@v4
49- with :
50- name : coverage-${{ matrix.node-version }}
51- path : coverage/
52- retention-days : 7
53-
54- # 🔹 Codecov upload using OIDC (skips forked PRs)
55- - name : Upload coverage to Codecov (OIDC)
56- if : ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }}
57- uses : codecov/codecov-action@v5
58- with :
59- use_oidc : true
60- files : ./coverage/lcov.info
61- flags : unittests
62- name : codecov-umbrella
63- fail_ci_if_error : true
64-
65- # 🔹 Best-effort Codecov on forked PRs (won't fail CI if upload is blocked)
66- - name : Upload coverage to Codecov (best-effort on forks)
67- if : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }}
68- uses : codecov/codecov-action@v5
69- with :
70- use_oidc : true
71- files : ./coverage/lcov.info
72- flags : unittests
73- name : codecov-umbrella
74- fail_ci_if_error : false
18+ - name : Checkout code
19+ uses : actions/checkout@v4
20+
21+ - name : Setup Node.js ${{ matrix.node-version }}
22+ uses : actions/setup-node@v4
23+ with :
24+ node-version : ${{ matrix.node-version }}
25+ cache : ' npm'
26+
27+ - name : Install dependencies
28+ run : npm ci
29+
30+ - name : Run type checking
31+ run : npm run type-check
32+
33+ - name : Run linting
34+ run : npm run lint
35+
36+ - name : Check code formatting
37+ run : npm run format:check
38+
39+ - name : Run tests
40+ run : npm run test:coverage
41+
42+ - name : Upload coverage to Codecov
43+ uses : codecov/codecov-action@v3
44+ with :
45+ token : ${{ secrets.CODECOV_TOKEN }}
46+ file : ./coverage/lcov.info
47+ flags : unittests
48+ name : codecov-umbrella
7549
7650 build :
7751 name : Build
7852 runs-on : ubuntu-latest
7953 needs : test
8054
8155 steps :
82- - name : Checkout code
83- uses : actions/checkout@v4
56+ - name : Checkout code
57+ uses : actions/checkout@v4
8458
85- - name : Setup Node.js
86- uses : actions/setup-node@v4
87- with :
88- node-version : ' 18.x'
89- cache : ' npm'
59+ - name : Setup Node.js
60+ uses : actions/setup-node@v4
61+ with :
62+ node-version : ' 18.x'
63+ cache : ' npm'
9064
91- - name : Install dependencies
92- run : npm ci
65+ - name : Install dependencies
66+ run : npm ci
9367
94- - name : Build application
95- run : npm run build
68+ - name : Build application
69+ run : npm run build
9670
97- - name : Validate configuration
98- run : npm run validate-config
71+ - name : Validate configuration
72+ run : npm run validate-config
9973
100- - name : Upload build artifacts
101- uses : actions/upload-artifact@v4
102- with :
103- name : build-artifacts
104- path : dist/
74+ - name : Upload build artifacts
75+ uses : actions/upload-artifact@v4
76+ with :
77+ name : build-artifacts
78+ path : dist/
10579
10680 docker :
10781 name : Docker Build
@@ -110,60 +84,60 @@ jobs:
11084 if : github.event_name == 'push'
11185
11286 steps :
113- - name : Checkout code
114- uses : actions/checkout@v4
115-
116- - name : Set up Docker Buildx
117- uses : docker/setup-buildx-action@v3
118-
119- - name : Login to Docker Hub
120- uses : docker/login-action@v3
121- with :
122- username : ${{ secrets.DOCKER_USERNAME }}
123- password : ${{ secrets.DOCKER_PASSWORD }}
124-
125- - name : Extract metadata
126- id : meta
127- uses : docker/metadata-action@v5
128- with :
129- images : onamfc/mcp-starter-template
130- tags : |
131- type=ref,event=branch
132- type=ref,event=pr
133- type=sha
134-
135- - name : Build and push Docker image
136- uses : docker/build-push-action@v5
137- with :
138- context : .
139- platforms : linux/amd64,linux/arm64
140- push : true
141- tags : ${{ steps.meta.outputs.tags }}
142- labels : ${{ steps.meta.outputs.labels }}
143- cache-from : type=gha
144- cache-to : type=gha,mode=max
87+ - name : Checkout code
88+ uses : actions/checkout@v4
89+
90+ - name : Set up Docker Buildx
91+ uses : docker/setup-buildx-action@v3
92+
93+ - name : Login to Docker Hub
94+ uses : docker/login-action@v3
95+ with :
96+ username : ${{ secrets.DOCKER_USERNAME }}
97+ password : ${{ secrets.DOCKER_PASSWORD }}
98+
99+ - name : Extract metadata
100+ id : meta
101+ uses : docker/metadata-action@v5
102+ with :
103+ images : onamfc/mcp-starter-template
104+ tags : |
105+ type=ref,event=branch
106+ type=ref,event=pr
107+ type=sha
108+
109+ - name : Build and push Docker image
110+ uses : docker/build-push-action@v5
111+ with :
112+ context : .
113+ platforms : linux/amd64,linux/arm64
114+ push : true
115+ tags : ${{ steps.meta.outputs.tags }}
116+ labels : ${{ steps.meta.outputs.labels }}
117+ cache-from : type=gha
118+ cache-to : type=gha,mode=max
145119
146120 security :
147121 name : Security Scan
148122 runs-on : ubuntu-latest
149123 needs : test
150124
151125 steps :
152- - name : Checkout code
153- uses : actions/checkout@v4
126+ - name : Checkout code
127+ uses : actions/checkout@v4
154128
155- - name : Setup Node.js
156- uses : actions/setup-node@v4
157- with :
158- node-version : ' 18.x'
159- cache : ' npm'
129+ - name : Setup Node.js
130+ uses : actions/setup-node@v4
131+ with :
132+ node-version : ' 18.x'
133+ cache : ' npm'
160134
161- - name : Install dependencies
162- run : npm ci
135+ - name : Install dependencies
136+ run : npm ci
163137
164- - name : Run security audit
165- run : npm audit --audit-level=moderate
138+ - name : Run security audit
139+ run : npm audit --audit-level=moderate
166140
167- - name : Run dependency check
168- if : github.event_name == 'pull_request'
169- uses : actions/dependency-review-action@v4
141+ - name : Run dependency check
142+ uses : actions/dependency-review-action@v3
143+ if : github.event_name == 'pull_request'
0 commit comments