Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Lint

on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
lint:
name: ESLint Code Quality Check
runs-on: ubuntu-latest
timeout-minutes: 10

strategy:
matrix:
node-version: [20.x]

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup BUN
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Cache BUN modules
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

- name: Cache node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Run ESLint
run: bun run lint
continue-on-error: false

- name: Upload lint results
if: always()
uses: actions/upload-artifact@v4
with:
name: lint-results
path: lint-results.json
retention-days: 30

lint-success:
name: Lint Check Status
runs-on: ubuntu-latest
needs: lint
if: always()
steps:
- name: Check lint status
run: |
if [ "${{ needs.lint.result }}" == "failure" ]; then
echo "❌ Linting failed. Please fix the issues before merging."
exit 1
else
echo "✅ Linting passed successfully!"
fi
28 changes: 28 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,34 @@ See `tools/README.md` for full documentation and examples.
- **Lint**: `bun run lint` - Run ESLint checks
- **Test**: `bun test` or `bun run test` - Run Vitest tests. Run single test: `bun test -- <test-file>`

## CI/CD Pipeline

### GitHub Actions Workflow
This project uses GitHub Actions to automatically run linting checks:
- **Workflow File**: `.github/workflows/lint.yml`
- **Trigger**: Pull requests and pushes to master branch
- **Status Check**: `ESLint Code Quality Check`
- **Branch Protection**: Master branch requires passing linting before merge

**Workflow Features:**
- Automated ESLint checks on all PRs
- Caching for BUN modules and node_modules
- Frozen lockfile for deterministic builds
- Full Node.js 20.x support
- ~2 minute average execution time

**Key Rules:**
- All code must pass linting before merging to master
- At least 1 code review approval required
- Stale reviews are automatically dismissed
- Force pushes and deletions are blocked on master

**For Developers:**
- Run `bun run lint` locally before committing
- Fix linting errors with `bun run lint -- --fix`
- Check GitHub Actions tab for workflow results
- Cannot merge PR unless linting passes

## Build System
This project uses **Vite** for fast development and production builds (migrated from Vue CLI).
- TypeScript enabled with Vue 3 support
Expand Down
106 changes: 106 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ⌨️ Typee

[![Lint](https://github.com/isaaceliape/typee/actions/workflows/lint.yml/badge.svg?branch=master)](https://github.com/isaaceliape/typee/actions/workflows/lint.yml)

A modern, high-performance touch typing practice tool built with Vue 3, TypeScript, and Vite.

**Live Demo:** [isaaceliape.github.io/typee](https://isaaceliape.github.io/typee)
Expand All @@ -16,6 +18,7 @@ A modern, high-performance touch typing practice tool built with Vue 3, TypeScri
- [Code Quality](#-code-quality)
- [Contributing](#-contributing)
- [Tools & Commands](#-tools--commands)
- [CI/CD Pipeline](#-cicd-pipeline)
- [Performance](#-performance)
- [Troubleshooting](#-troubleshooting)

Expand Down Expand Up @@ -861,6 +864,109 @@ bun test -- --reporter=verbose

See `tools/README.md` for complete documentation.

## 🔄 CI/CD Pipeline

### Automated Linting with GitHub Actions

This project uses GitHub Actions to automatically run ESLint checks on all pull requests and pushes to the master branch.

**Workflow Overview:**
- **Trigger**: Pull requests to `master` branch and pushes to `master`
- **Runtime**: Ubuntu Latest
- **Timeout**: 10 minutes
- **Status Check**: `ESLint Code Quality Check`

**Workflow Steps:**
1. Checkout code with full history
2. Setup BUN package manager (latest)
3. Setup Node.js 20.x
4. Cache BUN modules for faster builds
5. Cache node_modules for faster builds
6. Install dependencies with frozen lockfile
7. Run ESLint linting check
8. Report status and upload results

**Performance:**
- Average execution time: < 2 minutes
- Caching strategy minimizes reinstalls
- Deterministic builds with frozen lockfile

### Branch Protection Rules

The `master` branch is protected with the following rules:

- ✅ **Require status checks to pass before merging**
- ESLint Code Quality Check must pass
- ✅ **Require pull request reviews before merging**
- At least 1 approval required
- Stale reviews are dismissed
- ✅ **Enforce for administrators**
- Rules apply to all users including maintainers
- ✅ **Block force pushes and deletions**
- Prevents accidental branch removal

### Pull Request Workflow

1. Create a feature branch: `git checkout -b feature/my-feature`
2. Make changes and commit: `git commit -m "feat: description"`
3. Push to remote: `git push -u origin feature/my-feature`
4. Create pull request on GitHub
5. ESLint workflow automatically runs
6. Fix any linting errors if needed
7. Request code review
8. After approval, merge to master (only if ESLint passes)

### Workflow Status Badge

The workflow status is displayed in the README header with a badge:
- 🟢 **Green** - Latest commit passed linting
- 🔴 **Red** - Latest commit failed linting
- 🟡 **Yellow** - Workflow currently running

Click the badge to view detailed workflow runs and logs.

### Viewing Workflow Results

**On GitHub:**
1. Go to [Actions tab](https://github.com/isaaceliape/typee/actions)
2. Select "Lint" workflow
3. Click the run you want to inspect
4. View step-by-step execution and logs

**Locally:**
Run linting before pushing to catch issues early:
```bash
bun run lint
```

### Troubleshooting CI/CD Issues

**Workflow fails with "Module not found":**
```bash
# Clear cache and reinstall
rm -rf node_modules bun.lock
bun install
bun run lint
```

**Linting check failing on PR:**
1. Pull latest master: `git pull origin master`
2. Run linting locally: `bun run lint`
3. Fix issues: `bun run lint -- --fix`
4. Commit and push: `git commit -am "fix: lint errors" && git push`

**Can't merge PR due to failed checks:**
1. Wait for workflow to complete (check Actions tab)
2. Fix any linting errors locally
3. Push fixes to PR branch
4. Workflow re-runs automatically
5. Once passing and approved, merge PR

**Manual Workflow Trigger:**
```bash
gh workflow run lint.yml -r master
```

## ⚡ Performance

### Build Performance
Expand Down
Loading