diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..7a95faa8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +name: CI + +on: + pull_request: + branches: ['main', 'develop'] + push: + branches: ['develop'] + +jobs: + lint-and-format: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '18.20.5' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run ESLint + run: npm run lint + + - name: Check Prettier formatting + run: npx prettier --check "src/**/*.{ts,tsx,js,jsx,json,css}" + + - name: Type check + run: npx tsc --noEmit diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index e6e879a6..97bab53a 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -34,7 +34,7 @@ jobs: cache: 'npm' - name: Install dependencies - run: npm install + run: npm ci - name: Build the project run: npm run build diff --git a/package.json b/package.json index 60e165a1..fd31f166 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,8 @@ "dev": "vite --host", "build": "tsc -b && vite build", "lint": "eslint .", + "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css}\"", + "format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css}\"", "preview": "vite preview", "predeploy": "npm run build", "deploy": "gh-pages -d build",