Skip to content

ci: add ci workflow

ci: add ci workflow #1

Workflow file for this run

name: CI
on:
pull_request:
push:
branches: [main]
jobs:
install:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Set up pnpm (optional if you already have pnpm in your environment)
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.2 # Adjust version as needed
# Cache the pnpm store
- name: Cache pnpm store
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
# Install deps using pnpm
- name: Install dependencies
run: pnpm install
# Upload node_modules as artifact so other jobs can use it
- name: Upload node_modules artifact
uses: actions/upload-artifact@v4
with:
name: node_modules
path: node_modules
build:
needs: [install]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download node_modules artifact
uses: actions/download-artifact@v4
with:
name: node_modules
path: node_modules
- name: Run build
run: pnpm build
lint:
needs: [install]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download node_modules artifact
uses: actions/download-artifact@v4
with:
name: node_modules
path: node_modules
- name: Lint code
run: pnpm lint