Skip to content

feat: Add BA support for SvelteKit #493

feat: Add BA support for SvelteKit

feat: Add BA support for SvelteKit #493

Workflow file for this run

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: 20
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9
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: 20
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9
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: 20
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9
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
unit-test:
name: Run Unit Tests
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: 20
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9
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
- name: Upload coverage reports to codecov
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_ORG_TOKEN }}
url: ${{ secrets.CODECOV_URL }}
- name: Upload coverage reports to codecov (Staging)
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
url: ${{ secrets.CODECOV_STAGING_URL }}
- name: Upload test result reports to codecov
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_ORG_TOKEN }}
url: ${{ secrets.CODECOV_URL }}
- name: Upload test result reports to codecov (Staging)
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
url: ${{ secrets.CODECOV_STAGING_URL }}
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: 9
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-example-stats-production:
name: "Production: upload ${{ matrix.example }} stats"
runs-on: ubuntu-latest
needs: [install, unit-test, integration-test]
strategy:
fail-fast: false
matrix:
example: ["next-js", "nuxt", "rollup", "sveltekit", "vite", "webpack"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9
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 production
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-example-stats-staging:
name: "Staging: upload ${{ matrix.example }} stats"
runs-on: ubuntu-latest
needs: [install, unit-test, integration-test]
strategy:
fail-fast: false
matrix:
example: ["next-js", "nuxt", "rollup", "sveltekit", "vite", "webpack"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9
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
upldate-plugin-stats-production:
name: "Production: upload ${{ matrix.package }} stats"
runs-on: ubuntu-latest
needs: [install, unit-test, integration-test]
strategy:
fail-fast: false
matrix:
package:
[
"bundler-plugin-core",
"nuxt-plugin",
"rollup-plugin",
"sveltekit-plugin",
"vite-plugin",
"webpack-plugin",
]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9
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 plugins
run: pnpm install
- name: Build ${{ matrix.package }} to collect stats for production
working-directory: ./packages/${{ matrix.package }}
env:
PLUGIN_CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
PLUGIN_CODECOV_API_URL: ${{ secrets.CODECOV_API_URL }}
run: pnpm run build
upldate-plugin-stats-staging:
name: "Staging: upload ${{ matrix.package }} stats"
runs-on: ubuntu-latest
needs: [install, unit-test, integration-test]
strategy:
fail-fast: false
matrix:
package:
[
"bundler-plugin-core",
"nuxt-plugin",
"rollup-plugin",
"sveltekit-plugin",
"vite-plugin",
"webpack-plugin",
]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9
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 plugins
run: pnpm install
- name: Build ${{ matrix.package }} to collect stats for staging
working-directory: ./packages/${{ matrix.package }}
env:
PLUGIN_CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
PLUGIN_CODECOV_API_URL: ${{ secrets.CODECOV_STAGING_API_URL }}
run: pnpm run build