Skip to content

Commit 5a46c7b

Browse files
authored
Merge pull request #5 from GraphicsProgrammingKnights/chore/github-actions-cicd
chore: added GitHub Actions CI/CD workflows
2 parents 79e38e3 + 8d49c1b commit 5a46c7b

5 files changed

Lines changed: 123 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# =============================================================================
2+
# CI Workflow - Continuous Integration
3+
# Runs on all PRs and pushes to main
4+
# =============================================================================
5+
6+
name: CI
7+
8+
on:
9+
push:
10+
branches: [main]
11+
pull_request:
12+
branches: [main]
13+
14+
# Cancel in-progress runs when a new commit is pushed
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
# ---------------------------------------------------------------------------
21+
# Lint and Build
22+
# ---------------------------------------------------------------------------
23+
ci:
24+
name: Lint & Build
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 20
35+
cache: "npm"
36+
37+
- name: Install dependencies
38+
run: npm ci
39+
40+
- name: Run ESLint
41+
run: npm run lint
42+
43+
- name: Build application
44+
run: npm run build

.github/workflows/docker.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# =============================================================================
2+
# Docker Build Workflow
3+
# Verifies the Docker image builds successfully
4+
# =============================================================================
5+
6+
name: Docker Build
7+
8+
on:
9+
push:
10+
branches: [main]
11+
paths:
12+
- "Dockerfile"
13+
- "docker-compose.yml"
14+
- ".dockerignore"
15+
- "package.json"
16+
- "package-lock.json"
17+
- "next.config.ts"
18+
- "app/**"
19+
- "components/**"
20+
- "public/**"
21+
- "styles/**"
22+
- ".github/workflows/docker.yml"
23+
pull_request:
24+
branches: [main]
25+
paths:
26+
- "Dockerfile"
27+
- "docker-compose.yml"
28+
- ".dockerignore"
29+
- "package.json"
30+
- "package-lock.json"
31+
- "next.config.ts"
32+
- "app/**"
33+
- "components/**"
34+
- "public/**"
35+
- "styles/**"
36+
- ".github/workflows/docker.yml"
37+
38+
# Cancel in-progress runs when a new commit is pushed
39+
concurrency:
40+
group: ${{ github.workflow }}-${{ github.ref }}
41+
cancel-in-progress: true
42+
43+
jobs:
44+
# ---------------------------------------------------------------------------
45+
# Build Docker Image
46+
# ---------------------------------------------------------------------------
47+
docker-build:
48+
name: Build Docker Image
49+
runs-on: ubuntu-latest
50+
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v4
54+
55+
- name: Set up Docker Buildx
56+
uses: docker/setup-buildx-action@v3
57+
58+
- name: Build Docker image
59+
uses: docker/build-push-action@v6
60+
with:
61+
context: .
62+
push: false
63+
tags: gpkweb:test
64+
cache-from: type=gha
65+
cache-to: type=gha,mode=max

.github/workflows/temp.gitkeep

Whitespace-only changes.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# =============================================================================
22
# Dockerfile for GPK Website (Next.js)
3-
# Uses multi-stage build for optimized production images (293 MB)
3+
# Uses multi-stage build for optimized production images
44
# =============================================================================
55

66
# -----------------------------------------------------------------------------

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ npm run start
8989
- `fix/mobile-view-bug`
9090
- `chore/docker-setup`
9191
- Open a Pull Request into `main`.
92+
- GitHub Actions CI/CD runs and must pass checks.
9293
- At least 1 teammate review required before merge.
93-
- Use squash merge for clean history.
94+
- Use squash merge to main for clean history.
9495

9596
## Commit Convention
9697

@@ -110,6 +111,7 @@ Follow this commit style (examples provided):
110111
├── public/ # Static assets
111112
├── styles/ # Global/component styles
112113
├── .github/ # GitHub templates/workflows
114+
│ └── workflows/ # CI/CD pipelines
113115
├── Dockerfile # Production container
114116
├── docker-compose.yml # Local Docker setup
115117
├── .dockerignore # Docker build exclusions
@@ -163,8 +165,16 @@ Open [http://localhost:3000](http://localhost:3000)
163165

164166
## Infrastructure
165167

166-
- Docker files at repository root (`Dockerfile`, `.dockerignore`, `docker-compose.yml`)
167-
- CI/CD workflows under `.github/workflows/`
168+
### CI/CD Workflows
169+
170+
GitHub Actions workflows run automatically:
171+
172+
| Workflow | Trigger | What it does |
173+
|-----------------|-----------------------------------------------|---------------------------- |
174+
| **CI** | PRs and pushes to `main` | Runs lint and build |
175+
| **Docker Build**| PRs/pushes affecting app code or Docker files | Verifies Docker image builds|
176+
177+
View workflow runs: [Actions tab](https://github.com/GraphicsProgrammingKnights/gpkweb/actions)
168178

169179
## License
170180

0 commit comments

Comments
 (0)