build: Setup Initial CI #23
Workflow file for this run
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: Codecov JavaScript Bundler Plugins 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 | |
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: 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 | |
# fossa: | |
# name: Run Fossa | |
# runs-on: ubuntu-latest | |
# needs: install | |
# if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v4 | |
# - name: Setup Node | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: '18.8.0' | |
# - name: Run Fossa | |
# uses: fossas/[email protected] | |
# with: | |
# api-key: ${{secrets.FOSSA_API_KEY}} |