Skip to content

Commit 5f174f8

Browse files
authored
Merge pull request #48 from albertilagan/albert/pr-github-action
chore: pull request github action
2 parents 00281e6 + 7d34b43 commit 5f174f8

File tree

3 files changed

+65
-1
lines changed

3 files changed

+65
-1
lines changed

.github/actions/ci-setup/action.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "CI setup"
2+
runs:
3+
using: "composite"
4+
steps:
5+
- name: Setup Node.js
6+
uses: actions/setup-node@v3
7+
with:
8+
node-version: ${{ env.NODE_VERSION }}
9+
cache: 'npm'
10+
11+
- name: Cache NPM dependencies
12+
uses: actions/cache@v3
13+
id: cache-primes
14+
with:
15+
path: node_modules
16+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
17+
18+
- name: Install dependencies
19+
run: npm install
20+
shell: bash

.github/workflows/pull-request.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Pull Request
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
7+
env:
8+
NODE_VERSION: 18.16.0
9+
10+
jobs:
11+
linting:
12+
name: Linting
13+
timeout-minutes: 15
14+
runs-on: ubuntu-20.04
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: ./.github/actions/ci-setup
19+
20+
- name: Lint
21+
run: npm run lint
22+
23+
type-check:
24+
name: Typescript
25+
runs-on: ubuntu-20.04
26+
steps:
27+
- uses: actions/checkout@v3
28+
- uses: ./.github/actions/ci-setup
29+
30+
- name: Typescript
31+
run: npm run db:generate && npm run type-check
32+
33+
test:
34+
name: Test
35+
runs-on: ubuntu-20.04
36+
37+
steps:
38+
- uses: actions/checkout@v3
39+
- uses: ./.github/actions/ci-setup
40+
41+
- name: Prebuild
42+
run: CI=true SKIP_ENV_VALIDATION=1 npm run build

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"dev": "next dev",
88
"build": "next build",
99
"start": "next start",
10-
"lint": "next lint"
10+
"lint": "next lint",
11+
"type-check": "tsc --noEmit",
12+
"db:generate": "prisma generate"
1113
},
1214
"dependencies": {
1315
"@auth/prisma-adapter": "^1.0.0",

0 commit comments

Comments
 (0)