From aa4ffc312821c3cffb981f837dc975d677bd8a47 Mon Sep 17 00:00:00 2001 From: nicholas-codecov Date: Tue, 13 Feb 2024 16:48:08 -0400 Subject: [PATCH] build: Add step to ci to upload stats to prod (#73) Update CI steps to upload stats data to production. --- .github/workflows/ci.yml | 67 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff1d9e27..4eaa5ef5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -285,7 +285,70 @@ jobs: - name: Run e2e tests run: pnpm run test:e2e --maxWorkers=2 - upload-stats-data-to-staging: + upload-build-stats-production: + name: Build and upload ${{ matrix.example }} stats data to production + runs-on: ubuntu-latest + needs: [install, unit-test, integration-test] + strategy: + fail-fast: false + matrix: + example: ["next-js", "rollup", "vite", "webpack"] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Cache node_modules + id: cache-node-modules + uses: actions/cache@v3 + env: + cache-name: cache-codecov-js-bundle-plugin-node-modules + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-${{ env.cache-name }}- + + - name: Install dependencies + run: pnpm install + + - name: Build plugins + run: pnpm run build + + - name: Install built plugins + run: pnpm install + + - name: Build ${{ matrix.example }} app for staging + working-directory: ./examples/${{ matrix.example }} + env: + NEXT_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }} + NEXT_API_URL: ${{ secrets.CODECOV_API_URL }} + ROLLUP_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }} + ROLLUP_API_URL: ${{ secrets.CODECOV_API_URL }} + VITE_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }} + VITE_API_URL: ${{ secrets.CODECOV_API_URL }} + WEBPACK_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }} + WEBPACK_API_URL: ${{ secrets.CODECOV_API_URL }} + run: pnpm run build + + upload-build-stats-staging: name: Build and upload ${{ matrix.example }} stats data to staging runs-on: ubuntu-latest needs: [install, unit-test, integration-test] @@ -335,7 +398,7 @@ jobs: - name: Install built plugins run: pnpm install - - name: Build ${{ matrix.example }} app + - name: Build ${{ matrix.example }} app for staging working-directory: ./examples/${{ matrix.example }} env: NEXT_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}