@@ -143,10 +143,39 @@ jobs:
143143 - name : Run TSC
144144 run : pnpm run type-check
145145
146+ codecov-startup :
147+ name : Codecov Startup
148+ runs-on : ubuntu-latest
149+ needs : install
150+ steps :
151+ - name : Checkout
152+ uses : actions/checkout@v4
153+ with :
154+ fetch-depth : 2
155+
156+ - name : Install CLI
157+ if : ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
158+ run : |
159+ pip install --no-cache-dir codecov-cli
160+
161+ - name : Run Startup
162+ if : ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
163+ env :
164+ CODECOV_TOKEN : ${{ secrets.CODECOV_ORG_TOKEN }}
165+ run : |
166+ codecovcli -u ${{ secrets.CODECOV_URL }} create-commit --fail-on-error
167+ codecovcli -u ${{ secrets.CODECOV_URL }} create-report --fail-on-error
168+
169+ - name : Run Startup Staging
170+ if : ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
171+ run : |
172+ codecovcli -u ${{ secrets.CODECOV_STAGING_URL }} create-commit -t ${{ secrets.CODECOV_ORG_TOKEN_STAGING }} --fail-on-error
173+ codecovcli -u ${{ secrets.CODECOV_STAGING_URL }} create-report -t ${{ secrets.CODECOV_ORG_TOKEN_STAGING }} --fail-on-error
174+
146175 unit-test :
147176 name : Run Unit Tests
148177 runs-on : ubuntu-latest
149- needs : install
178+ needs : [ install, codecov-startup]
150179 steps :
151180 - name : Checkout
152181 uses : actions/checkout@v4
@@ -189,10 +218,22 @@ jobs:
189218 - name : Run unit tests
190219 run : pnpm run test:unit:ci --maxWorkers=2
191220
221+ - name : Install CLI
222+ if : ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
223+ run : |
224+ pip install --no-cache-dir codecov-cli
225+
192226 - name : Upload coverage reports to Codecov
193- uses : codecov/codecov-action@v3
194- env :
195- CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
227+ # # Don't upload on forks for now.
228+ if : ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
229+ run : |
230+ codecovcli -u ${{ secrets.CODECOV_URL }} do-upload -t ${{ secrets.CODECOV_ORG_TOKEN }} --fail-on-error
231+
232+ - name : Upload coverage reports to Codecov staging
233+ # # Don't upload on forks for now.
234+ if : ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
235+ run : |
236+ codecovcli -u ${{ secrets.CODECOV_STAGING_URL }} do-upload -t ${{ secrets.CODECOV_ORG_TOKEN_STAGING }} --fail-on-error
196237
197238 integration-test :
198239 name : Run Integration Tests (Node ${{ matrix.node-version }})
@@ -201,10 +242,7 @@ jobs:
201242 strategy :
202243 fail-fast : false
203244 matrix :
204- node-version : [
205- " 18.x" ,
206- " 20.x"
207- ]
245+ node-version : ["18.x", "20.x"]
208246 steps :
209247 - name : Checkout
210248 uses : actions/checkout@v4
@@ -246,3 +284,66 @@ jobs:
246284
247285 - name : Run e2e tests
248286 run : pnpm run test:e2e --maxWorkers=2
287+
288+ upload-stats-data-to-staging :
289+ name : Build and upload ${{ matrix.example }} stats data to staging
290+ runs-on : ubuntu-latest
291+ needs : [install, unit-test, integration-test]
292+ strategy :
293+ fail-fast : false
294+ matrix :
295+ example : ["next-js", "rollup", "vite", "webpack"]
296+ steps :
297+ - name : Checkout
298+ uses : actions/checkout@v4
299+ with :
300+ fetch-depth : 0
301+
302+ - name : Setup node
303+ uses : actions/setup-node@v3
304+ with :
305+ node-version : 18
306+
307+ - name : Install pnpm
308+ uses : pnpm/action-setup@v2
309+ with :
310+ version : 8
311+ run_install : false
312+
313+ - name : Get pnpm store directory
314+ shell : bash
315+ run : |
316+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
317+
318+ - name : Cache node_modules
319+ id : cache-node-modules
320+ uses : actions/cache@v3
321+ env :
322+ cache-name : cache-codecov-js-bundle-plugin-node-modules
323+ with :
324+ path : ${{ env.STORE_PATH }}
325+ key : ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
326+ restore-keys : |
327+ ${{ runner.os }}-${{ env.cache-name }}-
328+
329+ - name : Install dependencies
330+ run : pnpm install
331+
332+ - name : Build plugins
333+ run : pnpm run build
334+
335+ - name : Install built plugins
336+ run : pnpm install
337+
338+ - name : Build ${{ matrix.example }} app
339+ working-directory : ./examples/${{ matrix.example }}
340+ env :
341+ NEXT_UPLOAD_TOKEN : ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
342+ NEXT_API_URL : ${{ secrets.CODECOV_STAGING_API_URL }}
343+ ROLLUP_UPLOAD_TOKEN : ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
344+ ROLLUP_API_URL : ${{ secrets.CODECOV_STAGING_API_URL }}
345+ VITE_UPLOAD_TOKEN : ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
346+ VITE_API_URL : ${{ secrets.CODECOV_STAGING_API_URL }}
347+ WEBPACK_UPLOAD_TOKEN : ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
348+ WEBPACK_API_URL : ${{ secrets.CODECOV_STAGING_API_URL }}
349+ run : pnpm run build
0 commit comments