mirror of
https://github.com/jetkvm/cloud-api.git
synced 2026-05-21 05:20:36 +00:00
66 lines
1.5 KiB
YAML
66 lines
1.5 KiB
YAML
name: 'Pull Request'
|
|
on:
|
|
pull_request:
|
|
paths-ignore:
|
|
- .gitignore
|
|
- README.md
|
|
- LICENSE
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
DATABASE_URL: postgresql://jetkvm:jetkvm@localhost:5432/jetkvm?schema=public
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_USER: jetkvm
|
|
POSTGRES_PASSWORD: jetkvm
|
|
POSTGRES_DB: jetkvm
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U jetkvm -d jetkvm"
|
|
--health-interval 5s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: v22.21.0
|
|
cache: 'npm'
|
|
cache-dependency-path: '**/package-lock.json'
|
|
|
|
- name: Cache NPM dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.npm
|
|
key: npm-cache-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
|
|
restore-keys: |
|
|
npm-cache-${{ runner.os }}-
|
|
|
|
- name: Install Dependencies and Build
|
|
run: |
|
|
npm ci
|
|
npx prisma generate
|
|
npm run build
|
|
env:
|
|
CI: true
|
|
|
|
- name: Run Prisma Migrations
|
|
run: npx prisma migrate deploy
|
|
|
|
- name: Run Tests
|
|
run: npm test
|
|
|
|
- name: Cache Prisma Binary
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.npm/_npx
|
|
key: prisma-binary-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
|
|
restore-keys: prisma-binary-${{ runner.os }}-
|