feat: Add sentry to bundler plugins #257
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
- staging | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
install: | |
name: Install deps | |
runs-on: ubuntu-latest | |
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 | |
lint: | |
name: Run Lint | |
runs-on: ubuntu-latest | |
needs: install | |
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 packages | |
run: pnpm run build | |
- name: Run linter | |
run: pnpm run lint | |
type-check: | |
name: Run Type Checker | |
runs-on: ubuntu-latest | |
needs: install | |
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 packages | |
run: pnpm run build | |
- name: Run TSC | |
run: pnpm run type-check | |
codecov-startup: | |
name: Codecov Startup | |
runs-on: ubuntu-latest | |
needs: install | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Install CLI | |
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} | |
run: | | |
pip install --no-cache-dir codecov-cli | |
- name: Run Startup | |
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }} | |
run: | | |
codecovcli -u ${{ secrets.CODECOV_URL }} create-commit --fail-on-error | |
codecovcli -u ${{ secrets.CODECOV_URL }} create-report --fail-on-error | |
- name: Run Startup Staging | |
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} | |
run: | | |
codecovcli -u ${{ secrets.CODECOV_STAGING_URL }} create-commit -t ${{ secrets.CODECOV_ORG_TOKEN_STAGING }} --fail-on-error | |
codecovcli -u ${{ secrets.CODECOV_STAGING_URL }} create-report -t ${{ secrets.CODECOV_ORG_TOKEN_STAGING }} --fail-on-error | |
unit-test: | |
name: Run Unit Tests | |
runs-on: ubuntu-latest | |
needs: [install, codecov-startup] | |
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 packages | |
run: pnpm run build | |
- name: Run unit tests | |
run: pnpm run test:unit:ci --maxWorkers=2 | |
- name: Install CLI | |
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} | |
run: | | |
pip install --no-cache-dir codecov-cli | |
- name: Upload coverage reports to Codecov | |
## Don't upload on forks for now. | |
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} | |
run: | | |
codecovcli -u ${{ secrets.CODECOV_URL }} do-upload -t ${{ secrets.CODECOV_ORG_TOKEN }} --fail-on-error | |
- name: Upload coverage reports to Codecov staging | |
## Don't upload on forks for now. | |
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} | |
run: | | |
codecovcli -u ${{ secrets.CODECOV_STAGING_URL }} do-upload -t ${{ secrets.CODECOV_ORG_TOKEN_STAGING }} --fail-on-error | |
integration-test: | |
name: Run Integration Tests (Node ${{ matrix.node-version }}) | |
needs: install | |
runs-on: ubuntu-latest | |
services: | |
test-api: | |
image: codecov/codecov-javascript-bundler-plugins-test-api | |
ports: | |
- 8000:8000 | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: ["18.x", "20.x"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- 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 packages | |
run: pnpm run build | |
- name: Run e2e tests | |
run: pnpm run test:e2e | |
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] | |
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_STAGING }} | |
NEXT_API_URL: ${{ secrets.CODECOV_STAGING_API_URL }} | |
ROLLUP_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }} | |
ROLLUP_API_URL: ${{ secrets.CODECOV_STAGING_API_URL }} | |
VITE_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }} | |
VITE_API_URL: ${{ secrets.CODECOV_STAGING_API_URL }} | |
WEBPACK_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }} | |
WEBPACK_API_URL: ${{ secrets.CODECOV_STAGING_API_URL }} | |
run: pnpm run build |