Skip to content

Commit 9ed7279

Browse files
authored
Merge pull request #2 from frckbrice/feat/schema-validation
Feat/schema validation
2 parents 330d27a + a441797 commit 9ed7279

File tree

16 files changed

+1900
-0
lines changed

16 files changed

+1900
-0
lines changed

.github/dependabot.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Dependabot Configuration
2+
#
3+
# This file configures Dependabot to automatically check for and create PRs
4+
# for dependency updates. It helps keep your project dependencies secure and up-to-date.
5+
#
6+
# Dependabot will:
7+
# - Check for updates daily
8+
# - Create PRs for security updates immediately
9+
# - Group related updates together
10+
# - Use the same package manager (pnpm) as your project
11+
12+
version: 2
13+
updates:
14+
# Enable version updates for npm/pnpm packages
15+
- package-ecosystem: "npm"
16+
directory: "/"
17+
schedule:
18+
interval: "daily" # Check for updates daily
19+
time: "04:00" # At 4 AM UTC
20+
open-pull-requests-limit: 10 # Maximum number of open PRs
21+
reviewers:
22+
- "frckbrice" # Add your GitHub username here
23+
labels:
24+
- "dependencies"
25+
- "automated"
26+
# Group updates by dependency type
27+
groups:
28+
production-dependencies:
29+
patterns:
30+
- "*"
31+
update-types:
32+
- "minor"
33+
- "patch"
34+
# Ignore specific packages if needed
35+
ignore:
36+
# Example: Ignore major version updates for a specific package
37+
# - dependency-name: "package-name"
38+
# update-types: ["version-update:semver-major"]
39+
40+
# Commit message preferences
41+
commit-message:
42+
prefix: "chore"
43+
include: "scope"

.github/pull_request_template.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Pull Request
2+
3+
## Description
4+
<!-- Provide a brief description of what this PR does -->
5+
6+
## Type of Change
7+
<!-- Mark the relevant option with an 'x' -->
8+
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
9+
- [ ] ✨ New feature (non-breaking change which adds functionality)
10+
- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
11+
- [ ] 📚 Documentation update
12+
- [ ] 🎨 Code style/formatting changes
13+
- [ ] ♻️ Code refactoring
14+
- [ ] ⚡ Performance improvement
15+
- [ ] ✅ Test updates
16+
- [ ] 🔧 Build/config changes
17+
18+
## Related Issues
19+
<!-- Link to related issues using #issue_number -->
20+
Closes #
21+
Related to #
22+
23+
## Changes Made
24+
<!-- List the main changes in this PR -->
25+
-
26+
-
27+
-
28+
29+
## Testing
30+
<!-- Describe how you tested your changes -->
31+
- [ ] Unit tests pass
32+
- [ ] Integration tests pass
33+
- [ ] Manual testing completed
34+
- [ ] Type checking passes
35+
- [ ] Linting passes
36+
37+
## Checklist
38+
<!-- Mark completed items with an 'x' -->
39+
- [ ] My code follows the project's style guidelines
40+
- [ ] I have performed a self-review of my code
41+
- [ ] I have commented my code, particularly in hard-to-understand areas
42+
- [ ] I have updated the documentation accordingly
43+
- [ ] My changes generate no new warnings
44+
- [ ] I have added tests that prove my fix is effective or that my feature works
45+
- [ ] New and existing unit tests pass locally with my changes
46+
- [ ] Any dependent changes have been merged and published
47+
48+
## Screenshots (if applicable)
49+
<!-- Add screenshots to help explain your changes -->
50+
51+
## Additional Notes
52+
<!-- Any additional information that reviewers should know -->

.github/workflows/ci.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Continuous Integration Workflow
2+
#
3+
# This workflow runs on every push and pull request to ensure code quality.
4+
# It performs the following checks:
5+
# 1. Type checking (TypeScript compilation without emitting files)
6+
# 2. Linting (ESLint)
7+
# 3. Testing (Jest)
8+
# 4. Building (TypeScript compilation)
9+
#
10+
# The workflow uses pnpm as the package manager and supports multiple Node.js versions.
11+
12+
name: CI
13+
14+
# Trigger the workflow on push and pull requests
15+
on:
16+
push:
17+
branches:
18+
- main
19+
- develop
20+
- 'feature/**'
21+
- 'fix/**'
22+
- 'hotfix/**'
23+
- 'release/**'
24+
pull_request:
25+
branches:
26+
- main
27+
- develop
28+
29+
# Allow only one concurrent workflow per branch
30+
concurrency:
31+
group: ${{ github.workflow }}-${{ github.ref }}
32+
cancel-in-progress: true
33+
34+
jobs:
35+
# Main CI job that runs all checks
36+
ci:
37+
name: CI Checks
38+
runs-on: ubuntu-latest
39+
40+
# Strategy to test against multiple Node.js versions
41+
strategy:
42+
matrix:
43+
node-version: [20.x, 22.x]
44+
fail-fast: false
45+
46+
steps:
47+
# Checkout the repository code
48+
- name: Checkout code
49+
uses: actions/checkout@v4
50+
51+
# Setup pnpm package manager
52+
- name: Setup pnpm
53+
uses: pnpm/action-setup@v4
54+
with:
55+
version: 8
56+
57+
# Setup Node.js with the version from matrix
58+
- name: Setup Node.js ${{ matrix.node-version }}
59+
uses: actions/setup-node@v4
60+
with:
61+
node-version: ${{ matrix.node-version }}
62+
cache: 'pnpm'
63+
64+
# Install dependencies
65+
- name: Install dependencies
66+
run: pnpm install --frozen-lockfile
67+
68+
# Run TypeScript type checking
69+
- name: Type check
70+
run: pnpm check
71+
72+
# Run ESLint to check code quality
73+
- name: Lint
74+
run: pnpm lint
75+
continue-on-error: false
76+
77+
# Run tests with Jest
78+
- name: Test
79+
run: pnpm test
80+
env:
81+
NODE_ENV: test
82+
83+
# Build the TypeScript project
84+
- name: Build
85+
run: pnpm build
86+
87+
# Upload test coverage reports (optional, for coverage visualization)
88+
- name: Upload coverage reports
89+
if: matrix.node-version == '20.x'
90+
uses: codecov/codecov-action@v4
91+
with:
92+
file: ./coverage/lcov.info
93+
flags: unittests
94+
name: codecov-umbrella
95+
fail_ci_if_error: false
96+
97+
# Separate job for security checks (dependencies vulnerability scanning)
98+
security:
99+
name: Security Audit
100+
runs-on: ubuntu-latest
101+
102+
steps:
103+
- name: Checkout code
104+
uses: actions/checkout@v4
105+
106+
- name: Setup pnpm
107+
uses: pnpm/action-setup@v4
108+
with:
109+
version: 8
110+
111+
- name: Setup Node.js
112+
uses: actions/setup-node@v4
113+
with:
114+
node-version: '20.x'
115+
cache: 'pnpm'
116+
117+
- name: Install dependencies
118+
run: pnpm install --frozen-lockfile
119+
120+
# Run pnpm audit to check for known vulnerabilities
121+
- name: Run security audit
122+
run: pnpm audit --audit-level=moderate
123+
continue-on-error: true

.github/workflows/database.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Database Migration Workflow
2+
#
3+
# This workflow handles database migrations and schema checks.
4+
# It can be used to:
5+
# - Validate database schema changes
6+
# - Run migrations in a test environment
7+
# - Generate migration files
8+
#
9+
# Note: This workflow requires database credentials to be set as GitHub secrets.
10+
# Required secrets:
11+
# - DATABASE_URL: PostgreSQL connection string
12+
13+
name: Database
14+
15+
# Trigger manually or on specific file changes
16+
on:
17+
workflow_dispatch: # Allows manual triggering
18+
push:
19+
branches:
20+
- main
21+
- develop
22+
paths:
23+
- 'config/database/**'
24+
- 'drizzle/**'
25+
- 'drizzle.config.ts'
26+
27+
jobs:
28+
# Validate database schema
29+
validate-schema:
30+
name: Validate Schema
31+
runs-on: ubuntu-latest
32+
33+
# Skip if database URL is not available
34+
if: ${{ secrets.DATABASE_URL != '' }}
35+
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v4
39+
40+
- name: Setup pnpm
41+
uses: pnpm/action-setup@v4
42+
with:
43+
version: 8
44+
45+
- name: Setup Node.js
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version: '20.x'
49+
cache: 'pnpm'
50+
51+
- name: Install dependencies
52+
run: pnpm install --frozen-lockfile
53+
54+
# Generate migration files to check for schema changes
55+
- name: Generate migrations
56+
run: pnpm db:generate
57+
env:
58+
DATABASE_URL: ${{ secrets.DATABASE_URL }}
59+
60+
# Check if there are uncommitted migration files
61+
- name: Check for uncommitted migrations
62+
run: |
63+
if [ -n "$(git status --porcelain drizzle/)" ]; then
64+
echo "⚠️ Uncommitted migration files detected!"
65+
git status
66+
exit 1
67+
else
68+
echo "✅ All migrations are committed"
69+
fi
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Dependabot Auto-Merge Workflow
2+
#
3+
# This workflow automatically merges Dependabot PRs that pass all CI checks.
4+
# It helps keep dependencies up-to-date with minimal manual intervention.
5+
#
6+
# Requirements:
7+
# - Dependabot must be enabled in repository settings
8+
# - Branch protection rules should allow auto-merge
9+
10+
name: Dependabot Auto-Merge
11+
12+
on:
13+
pull_request:
14+
types: [opened, synchronize, reopened]
15+
16+
jobs:
17+
# Auto-merge Dependabot PRs that pass CI
18+
auto-merge:
19+
name: Auto-merge Dependabot PRs
20+
runs-on: ubuntu-latest
21+
22+
# Only run for Dependabot PRs
23+
if: github.actor == 'dependabot[bot]'
24+
25+
steps:
26+
- name: Wait for CI to complete
27+
uses: lewagon/wait-on-check-action@v1.3.4
28+
with:
29+
ref: ${{ github.event.pull_request.head.sha }}
30+
check-regexp: '^CI'
31+
repo-token: ${{ secrets.GITHUB_TOKEN }}
32+
wait-interval: 10
33+
allowed-conclusions: success,neutral
34+
35+
# Approve the PR
36+
- name: Approve PR
37+
uses: actions/github-script@v7
38+
with:
39+
script: |
40+
github.rest.pulls.createReview({
41+
owner: context.repo.owner,
42+
repo: context.repo.repo,
43+
pull_number: context.issue.number,
44+
event: 'APPROVE'
45+
})
46+
47+
# Enable auto-merge
48+
- name: Enable auto-merge
49+
uses: actions/github-script@v7
50+
with:
51+
script: |
52+
github.rest.pulls.merge({
53+
owner: context.repo.owner,
54+
repo: context.repo.repo,
55+
pull_number: context.issue.number,
56+
merge_method: 'squash'
57+
})

0 commit comments

Comments
 (0)