From 79d57fa26ce6d8170add86b9518888e96545d0fb Mon Sep 17 00:00:00 2001 From: Mark Linn Date: Fri, 25 Aug 2023 10:34:19 +0200 Subject: [PATCH 1/8] add: initial CICD settings; add them colors to DaisyUI --- .github/workflows/preview.yml | 18 ++++++++++++++++++ .github/workflows/test.yml | 31 +++++++++++++++++++++++++++++++ cypress.config.ts | 2 ++ package.json | 4 ++-- src/app/counter/page.tsx | 2 +- tailwind.config.js | 16 ++++++++++++++-- 6 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/preview.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 00000000..039bdb12 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,18 @@ +name: Vercel Preview Deployment +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: pull_request +jobs: + Deploy-Preview: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Vercel CLI + run: npm install --global vercel@latest + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Project Artifacts + run: vercel build --token=${{ secrets.VERCEL_TOKEN }} + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..2044e027 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,31 @@ +name: Lint & Test Workflow + +on: + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: "18" # current LTS (we have 16 in Docker) + + - name: Install dependencies + run: yarn install + + - name: Run Eslint + run: yarn lint --strict + + - name: Run Jest tests + run: yarn test + + - name: Run Cypress tests + run: yarn cypress diff --git a/cypress.config.ts b/cypress.config.ts index 17161e32..41d499da 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -6,4 +6,6 @@ export default defineConfig({ // implement node event listeners here }, }, + video: false, + screenshotOnRunFailure: false, }); diff --git a/package.json b/package.json index fe328747..7a0d648a 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "lint": "next lint", "prettier": "prettier . --write", "prepare": "husky install", - "test": "jest --watch", - "cypress": "cypress open" + "test": "jest", + "cypress": "cypress run" }, "dependencies": { "@prisma/client": "5.1.1", diff --git a/src/app/counter/page.tsx b/src/app/counter/page.tsx index 42aef32a..dd14c9a8 100644 --- a/src/app/counter/page.tsx +++ b/src/app/counter/page.tsx @@ -34,7 +34,7 @@ function CounterPage() {