Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Introduce Common Open Source Tooling into Codebase to Increase Productivity and Developer Experience #43

Merged
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
1 change: 1 addition & 0 deletions .cz.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "path": "@commitlint/cz-commitlint" }
39 changes: 39 additions & 0 deletions .github/workflows/BUILD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build

on:
push:
branches: '*'
pull_request:
branches: '*'

jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]

steps:
- name: 🛎️ Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # All history for branches and tags

- name: 🍞 Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: 📂 Install Dependencies
run: bun install

- name: 🏗️ Build Project
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
run: bun run --bun build

- name: 💰 Profit
run: echo 🐞
40 changes: 40 additions & 0 deletions .github/workflows/RELEASE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
push:
branches: '*'
pull_request:
branches: '*'

jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]

steps:
- name: 🛎️ Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # All history for branches and tags

- name: 🍞 Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: 📂 Install Dependencies
run: bun install

- name: 🤖 Run Semantic Release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
run: bun run --bun semantic-release

- name: 💰 Profit
run: echo 🐞
32 changes: 13 additions & 19 deletions .github/workflows/e2e.yml → .github/workflows/TEST_e2e.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Playwright Tests
name: End-to-End Tests

on:
push:
branches: [main, master]
branches: '*'
pull_request:
branches: [main, master]
branches: '*'

jobs:
test:
timeout-minutes: 60
timeout-minutes: 5
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -20,32 +20,26 @@ jobs:
with:
fetch-depth: 0 # All history for branches and tags

- name: 📦 Install pnpm
uses: pnpm/action-setup@v4
- name: 🍞 Install Bun
uses: oven-sh/setup-bun@v2
with:
version: 9

- name: 🛠️ Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: '${{ matrix.node-version }}'
cache: pnpm
bun-version: latest

- name: 📂 Install Dependencies
run: pnpm i
run: bun install

- name: Install Playwright Browsers
run: pnpm playwright install --with-deps
- name: 🎭 Install Playwright Browsers
run: bun run --bun playwright install --with-deps

- name: Run E2E tests
- name: 💀 Run E2E tests
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
run: pnpm playwright test
run: bun run --bun playwright test

- name: Upload Artifact
- name: 📄 Upload Artifact
uses: actions/upload-artifact@v4
if: always()
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,7 @@ yarn-error.log*
/test-results/
/playwright-report/
/blob-report/

# caches
/playwright/.cache/
.eslintcache
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm dlx commitlint --edit
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm lint-staged
46 changes: 46 additions & 0 deletions commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import type { UserConfig } from '@commitlint/types'
import { RuleConfigSeverity } from '@commitlint/types'

const Configuration: UserConfig = {
// Extend conventional commit configurations
// https://www.conventionalcommits.org/en/v1.0.0/
extends: ['@commitlint/config-conventional'],
rules: {
// -------------- TYPE ----------------
// Ensure type is one of the specified values
'type-enum': [
RuleConfigSeverity.Error,
'always', // Always enforce this rule
[
'build', // Build-related changes (e.g., compile, package)
'chore', // Other changes that don't modify src or test files
'ci', // Continuous Integration changes
'docs', // Documentation changes
'feat', // New features
'fix', // Bug fixes
'perf', // Performance improvements
'refactor', // Code refactoring without changing functionality
'revert', // Revert previous commits
'style', // Code style changes (formatting, white-space, etc.)
'test', // Adding or updating tests
],
],
'type-case': [RuleConfigSeverity.Error, 'always', 'lower-case'],
'type-empty': [RuleConfigSeverity.Error, 'never'],

// -------------- SCOPE ----------------
// TODO: ADD SCOPE ENUMS
// "scope-case": [RuleConfigSeverity.Error, "always", "pascal-case"],
// 'scope-empty': [RuleConfigSeverity.Error, 'never'],

// -------------- SUBJECT ----------------
// "subject-case": [RuleConfigSeverity.Error, "always", "sentence-case"],
'subject-empty': [RuleConfigSeverity.Error, 'never'],

// -------------- HEADER ----------------
// Ensure the header does not exceed 72 characters
// "header-max-length": [RuleConfigSeverity.Error, "always", 72],
},
}

export default Configuration
19 changes: 17 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "hackathon",
"type": "module",
"version": "0.1.0",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/cuhacking/hackathon.git"
},
"private": true,
"scripts": {
"build": "next build",
"db:generate": "prisma migrate dev",
Expand All @@ -20,7 +20,9 @@
"lint:inspect": "npx @eslint/config-inspector --no-open",
"lint:inspect-open": "npx @eslint/config-inspector",
"start": "next start",
"test:playwright": "npx playwright test"
"test:playwright": "npx playwright test",
"prepare": "husky",
"commit": "cz"
},
"dependencies": {
"@auth/prisma-adapter": "^1.6.0",
Expand Down Expand Up @@ -48,6 +50,10 @@
},
"devDependencies": {
"@antfu/eslint-config": "^2.24.1",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@commitlint/cz-commitlint": "^19.2.0",
"@commitlint/types": "^19.0.3",
"@eslint-react/eslint-plugin": "^1.7.1",
"@playwright/test": "^1.45.2",
"@types/eslint": "^8.56.2",
Expand All @@ -57,23 +63,32 @@
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"autoprefixer": "^10.4.20",
"commitizen": "^4.3.0",
"commitlint": "^19.3.0",
"eslint": "^8.57.0",
"eslint-config-next": "^14.1.3",
"eslint-plugin-format": "^0.1.2",
"eslint-plugin-playwright": "^1.6.2",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.9",
"katex": "^0.16.11",
"husky": "^9.1.4",
"inquirer": "^9.3.6",
"lint-staged": "^15.2.8",
"postcss": "^8.4.34",
"prettier": "^3.2.5",
"prettier-plugin-tailwindcss": "^0.5.14",
"prisma": "^5.14.0",
"rehype-katex": "^7.0.0",
"rehype-mermaid": "^2.1.0",
"remark-math": "^6.0.0",
"semantic-release": "^24.0.0",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.2"
},
"lint-staged": {
"*": "eslint --cache --fix"
},
"ct3aMetadata": {
"initVersion": "7.36.0"
}
Expand Down
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default defineConfig({

/* Run your local dev server before starting the tests */
webServer: {
command: 'pnpm dev',
command: 'bun dev',
url: 'http://localhost:8000',
reuseExistingServer: !process.env.CI,
},
Expand Down
Loading
Loading