From 9a401285b1b4917465fedfad48d2bbf1c2cda528 Mon Sep 17 00:00:00 2001 From: Pierre Berger Date: Mon, 29 Jan 2024 15:20:41 +0100 Subject: [PATCH] chore: setup github actions (#1) --- .env.example | 2 +- .github/workflows/ci.yml | 85 ++++++++++++++++++++++++++++++++++++++++ README.md | 2 +- package.json | 2 +- 4 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.env.example b/.env.example index ba86658..58b9691 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,2 @@ PORT=3000 -DATABASE_URL="file:./prisma/data.db" +DATABASE_URL="file:./data.db" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ed2999b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,85 @@ +name: 🚜 CI +on: + push: + branches: + - main + - dev + pull_request: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + actions: write + contents: read + +jobs: + lint: + name: ⬣ ESLint + runs-on: ubuntu-22.04 + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v3 + + - name: ⎔ Setup node + uses: actions/setup-node@v3 + with: + node-version: 20 + + - name: 🍞 Setup bun + uses: oven-sh/setup-bun@v1 + + - name: 📥 Download deps + run: bun install + + - name: 🔬 Lint + run: bun run lint + + typecheck: + name: ʦ TypeScript + runs-on: ubuntu-22.04 + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v3 + + - name: ⎔ Setup node + uses: actions/setup-node@v3 + with: + node-version: 20 + + - name: 🍞 Setup bun + uses: oven-sh/setup-bun@v1 + + - name: 📥 Download deps + run: bun install + + - name: 🔎 Type check + run: bun run typecheck + + vitest: + name: ⚡ Vitest + runs-on: ubuntu-22.04 + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v3 + + - name: ⎔ Setup node + uses: actions/setup-node@v3 + with: + node-version: 20 + + - name: 🍞 Setup bun + uses: oven-sh/setup-bun@v1 + + - name: 📥 Download deps + run: bun install + + - name: 🏄 Copy test env vars + run: cp .env.example .env + + - name: 💎 Setup prisma + run: bun prisma generate + + - name: ⚡ Run vitest + run: npm run test -- --coverage diff --git a/README.md b/README.md index 8f9d45f..0016993 100644 --- a/README.md +++ b/README.md @@ -69,5 +69,5 @@ come with these default values: ```bash # Port number PORT=3000 -DATABASE_URL="./prisma/data.db" +DATABASE_URL="./data.db" ``` diff --git a/package.json b/package.json index 6ccf760..12b128f 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "test:ui": "vitest --ui", "coverage": "vitest --coverage", "start": "bun run build && node dist/src/server.js", - "typecheck": "tsc -p --noEmit --pretty", + "typecheck": "tsc --noEmit --pretty", "lint": "eslint .", "format": "prettier -w .", "build": "tsc",