Skip to content

Commit dbf6dbc

Browse files
authored
Merge pull request #1 from Devn913/copilot/integrate-ci-cd-and-deploy
feat: SQL Chess — playable chess with SQL query panel, guest mode, invite links & GitHub Pages CI/CD
2 parents c12a28a + 5618a7d commit dbf6dbc

9 files changed

Lines changed: 3750 additions & 1 deletion

File tree

.github/workflows/deploy.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CI / Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
# ── Validate ─────────────────────────────────────────────────
14+
validate:
15+
name: Validate HTML & JS
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
26+
- name: Install validators
27+
run: npm install -g html-validate
28+
29+
- name: Validate HTML
30+
run: html-validate index.html
31+
32+
# ── Deploy (only on push to main) ────────────────────────────
33+
deploy:
34+
name: Deploy to GitHub Pages
35+
needs: validate
36+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
37+
runs-on: ubuntu-latest
38+
39+
permissions:
40+
contents: read
41+
pages: write
42+
id-token: write
43+
44+
environment:
45+
name: github-pages
46+
url: ${{ steps.deployment.outputs.page_url }}
47+
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
52+
- name: Configure GitHub Pages
53+
uses: actions/configure-pages@v4
54+
55+
- name: Upload Pages artifact
56+
uses: actions/upload-pages-artifact@v3
57+
with:
58+
# Deploy everything in the repo root
59+
path: '.'
60+
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Dependencies installed locally (vendored copy in /vendor is committed)
2+
node_modules/
3+
package-lock.json
4+
5+
# OS artefacts
6+
.DS_Store
7+
Thumbs.db
8+
9+
# Editor / IDE
10+
.vscode/
11+
.idea/
12+
*.swp
13+
*.swo
14+
15+
# Logs
16+
*.log

.htmlvalidate.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": ["html-validate:recommended"],
3+
"rules": {
4+
"no-inline-style": "off",
5+
"svg-focusable": "off",
6+
"long-title": "off"
7+
}
8+
}

README.md

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,67 @@
1-
# SQL_Chess
1+
# ♟ SQL Chess
2+
3+
> Play chess — and watch every move translated into real SQL queries in real time.
4+
5+
[![Deploy to GitHub Pages](https://github.com/Devn913/SQL_Chess/actions/workflows/deploy.yml/badge.svg)](https://github.com/Devn913/SQL_Chess/actions/workflows/deploy.yml)
6+
7+
**Live demo:** https://devn913.github.io/SQL_Chess/
8+
9+
---
10+
11+
## Features
12+
13+
| Feature | Details |
14+
|---|---|
15+
|**Fully playable chess** | All rules enforced via [chess.js](https://github.com/jhlywa/chess.js) — en passant, castling, pawn promotion, check/checkmate/stalemate |
16+
|**SQL Panel** | Every move generates real `INSERT`, `UPDATE`, `DELETE` SQL statements with syntax highlighting |
17+
|**Toggle SQL** | Hide the SQL panel to play as a traditional chess board |
18+
| 👤 **Guest mode** | No login required — just open the page and play |
19+
|**Invite link** | Click "Invite" to generate a shareable URL that encodes the full game state — anyone who opens it continues the same game |
20+
|**Flip board** | Swap perspective between white and black |
21+
|**Undo** | Take back the last move |
22+
23+
## How the SQL works
24+
25+
Each game gets its own `game_id`. Three tables are used:
26+
27+
```sql
28+
chess_game -- one row per game (id, players, status, winner)
29+
chess_piece -- one row per piece (position updated on every move)
30+
chess_move -- one row per move (full audit log)
31+
```
32+
33+
Example — white pawn e2 → e4:
34+
35+
```sql
36+
INSERT INTO chess_move (game_id, move_number, color, piece_type, from_square, to_square, san)
37+
VALUES ('a1b2-c3d4-e5f6-g7h8', 1, 'white', 'pawn', 'e2', 'e4', 'e4');
38+
39+
UPDATE chess_piece
40+
SET position = 'e4'
41+
WHERE game_id = 'a1b2-c3d4-e5f6-g7h8'
42+
AND position = 'e2'
43+
AND color = 'white';
44+
```
45+
46+
## CI/CD
47+
48+
The repository uses **GitHub Actions** (`.github/workflows/deploy.yml`):
49+
50+
1. **Validate** — runs `html-validate` on every push/PR to `main`
51+
2. **Deploy** — automatically publishes the site to **GitHub Pages** on every push to `main`
52+
53+
## Local development
54+
55+
No build step required — it's a plain HTML/CSS/JS site.
56+
57+
```bash
58+
# Clone and open
59+
git clone https://github.com/Devn913/SQL_Chess.git
60+
cd SQL_Chess
61+
# Open index.html in your browser, or serve with any static server:
62+
npx serve .
63+
```
64+
65+
## License
66+
67+
[MIT](LICENSE)

0 commit comments

Comments
 (0)