From d4f2caee62427979c2a12ad1caedad78dbfb2cb9 Mon Sep 17 00:00:00 2001 From: Maurici Abad Gutierrez Date: Wed, 18 Oct 2023 00:44:35 +0200 Subject: [PATCH] Setup CI (#85) --- .github/workflows/auto-assign.yaml | 24 +++++----- .github/workflows/ci.yaml | 59 +++++++++++++++++++++++++ .nvmrc | 2 +- .prettierignore | 2 + README.md | 1 + package.json | 10 ++--- src/app/[locale]/(app)/profile/page.tsx | 2 +- src/components/under-construction.tsx | 5 +-- 8 files changed, 82 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 .prettierignore diff --git a/.github/workflows/auto-assign.yaml b/.github/workflows/auto-assign.yaml index 96ce7d98..cd9a0d1c 100644 --- a/.github/workflows/auto-assign.yaml +++ b/.github/workflows/auto-assign.yaml @@ -1,17 +1,17 @@ name: Auto-assign issue or PR on: - issues: - types: [opened] - pull_request: - types: [opened, edited, synchronize, reopened] + issues: + types: [opened] + pull_request: + types: [opened, edited, synchronize, reopened] jobs: - auto-assign: - runs-on: ubuntu-latest - permissions: write-all - steps: - - name: 'Auto-assign issue or PR' - uses: pozil/auto-assign-issue@v1 - with: - assignees: mauriciabad + auto-assign: + runs-on: ubuntu-latest + permissions: write-all + steps: + - name: 'Auto-assign issue or PR' + uses: pozil/auto-assign-issue@v1 + with: + assignees: mauriciabad diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..4f081def --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,59 @@ +name: CI +on: push + +permissions: + contents: write + +jobs: + lintfix: + name: Lint and fix + runs-on: ubuntu-latest + steps: + - name: 🚀 Checkout + uses: actions/checkout@v3 + with: + persist-credentials: false + fetch-depth: 0 + + - name: 🎯 Read .nvmrc + run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" + id: nvm + + - name: 🏗️ Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '${{ steps.nvm.outputs.NVMRC }}' + + - name: 📦 Setup pnpm - Install pnpm + uses: pnpm/action-setup@v2 + with: + run_install: false + + - name: 📦 Setup pnpm - Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: 📦 Setup pnpm - Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: 📦 Install dependencies + run: pnpm install + + - name: 🔦 Run lint + run: pnpm lint --fix + + - name: 🖌️ Run format + run: pnpm format + + - name: 🍾 Commit & Push changes + uses: actions-js/push@master + with: + message: 'chore: Auto-fix lint errors' + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} diff --git a/.nvmrc b/.nvmrc index 3c032078..209e3ef4 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18 +20 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..64e88c47 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +/drizzle +pnpm-lock.yaml diff --git a/README.md b/README.md index c6ff7134..bc9d00b5 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Source code for the app. ``` 1. If you want to use a **local database**: + 1. Install [docker](https://www.docker.com/products/docker-desktop/). 1. Run the database in another console: diff --git a/package.json b/package.json index b2dec930..b48021c8 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,11 @@ { - "name": "next-app-router-template", + "name": "descobreix-begur-app", "version": "0.0.0", - "license": "MIT", - "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", - "lint": "next lint", + "lint": "SKIP_ENV_VALIDATION=true next lint", "format": "prettier . --write", "db:generate": "drizzle-kit generate:mysql", "db:push": "drizzle-kit push:mysql", @@ -58,5 +56,7 @@ "prettier-plugin-tailwindcss": "0.5.5", "server-only": "0.0.1", "tailwind-merge": "1.14.0" - } + }, + "license": "GNU GENERAL PUBLIC LICENSE", + "packageManager": "pnpm@8.9.2" } diff --git a/src/app/[locale]/(app)/profile/page.tsx b/src/app/[locale]/(app)/profile/page.tsx index c9587c0d..052e69d9 100644 --- a/src/app/[locale]/(app)/profile/page.tsx +++ b/src/app/[locale]/(app)/profile/page.tsx @@ -21,7 +21,7 @@ const ProfilePage: FC = () => { return ( <> -

{t('content')}

+

{t('content')}

) diff --git a/src/components/under-construction.tsx b/src/components/under-construction.tsx index 95002f56..c424898d 100644 --- a/src/components/under-construction.tsx +++ b/src/components/under-construction.tsx @@ -2,10 +2,7 @@ import type { FC } from 'react' export const UnderConstruction: FC = () => { return ( - +