From 6b6d58e95ec018c695e9d865b8136319ad93e825 Mon Sep 17 00:00:00 2001
From: Sebastien Castiel
Date: Tue, 16 Jan 2024 13:49:37 -0500
Subject: [PATCH] Add GitHub actions
---
.github/workflows/ci.yml | 36 ++++++++++++++++++++++
.prettierignore | 1 +
package-lock.json | 2 +-
package.json | 4 ++-
src/app/groups/[groupId]/expenses/page.tsx | 7 +++--
src/components/donation-button.tsx | 5 ++-
6 files changed, 50 insertions(+), 5 deletions(-)
create mode 100644 .github/workflows/ci.yml
create mode 100644 .prettierignore
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 00000000..6b81bbbf
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,36 @@
+name: CI
+
+on:
+ push:
+ branches: ['main']
+ pull_request:
+ branches: ['main']
+
+jobs:
+ checks:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Check out repository
+ uses: actions/checkout@v3
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v3
+ with:
+ node-version: 18
+ cache: 'npm'
+
+ - name: Install dependencies
+ run: npm ci --ignore-scripts
+
+ - name: Generate Prisma client
+ run: npx prisma generate
+
+ - name: Check TypeScript types
+ run: npm run check-types
+
+ - name: Check ESLint
+ run: npm run lint
+
+ - name: Check Prettier formatting
+ run: npm run check-formatting
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 00000000..505542ff
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1 @@
+src/components/ui
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 94af5aea..bf150ffb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,7 +10,7 @@
"hasInstallScript": true,
"dependencies": {
"@hookform/resolvers": "^3.3.2",
- "@prisma/client": "5.6.0",
+ "@prisma/client": "^5.6.0",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-collapsible": "^1.0.3",
"@radix-ui/react-dialog": "^1.0.5",
diff --git a/package.json b/package.json
index e98e6fc6..26c8c791 100644
--- a/package.json
+++ b/package.json
@@ -7,13 +7,15 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
+ "check-types": "tsc --noEmit",
+ "check-formatting": "prettier -c src",
"postinstall": "prisma migrate deploy && prisma generate",
"build-image": "./scripts/build-image.sh",
"start-container": "docker compose --env-file container.env up"
},
"dependencies": {
"@hookform/resolvers": "^3.3.2",
- "@prisma/client": "5.6.0",
+ "@prisma/client": "^5.6.0",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-collapsible": "^1.0.3",
"@radix-ui/react-dialog": "^1.0.5",
diff --git a/src/app/groups/[groupId]/expenses/page.tsx b/src/app/groups/[groupId]/expenses/page.tsx
index bd4f600b..3ef84e37 100644
--- a/src/app/groups/[groupId]/expenses/page.tsx
+++ b/src/app/groups/[groupId]/expenses/page.tsx
@@ -10,7 +10,7 @@ import {
} from '@/components/ui/card'
import { Skeleton } from '@/components/ui/skeleton'
import { getGroup, getGroupExpenses } from '@/lib/api'
-import { Download, DownloadCloud, Plus } from 'lucide-react'
+import { Download, Plus } from 'lucide-react'
import { Metadata } from 'next'
import Link from 'next/link'
import { notFound } from 'next/navigation'
@@ -40,7 +40,10 @@ export default async function GroupExpensesPage({
diff --git a/src/components/donation-button.tsx b/src/components/donation-button.tsx
index 5518ce88..b2c360cc 100644
--- a/src/components/donation-button.tsx
+++ b/src/components/donation-button.tsx
@@ -112,7 +112,10 @@ function DonationForm({ donationUrl }: Props) {