fix: improve deployment workflow by optimizing dependency installation and updating database URLs
This commit is contained in:
+32
-17
@@ -13,6 +13,7 @@ jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
@@ -29,24 +30,30 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
cd Backend && pnpm install
|
||||
cd ../UI && pnpm install
|
||||
cd Backend
|
||||
pnpm install --frozen-lockfile
|
||||
cd ../UI
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
- name: Generate Prisma client
|
||||
run: cd Backend && pnpm generate
|
||||
working-directory: Backend
|
||||
run: pnpm generate
|
||||
env:
|
||||
DATABASE_URL: postgresql://x:x@localhost/x
|
||||
|
||||
- name: Build backend
|
||||
run: cd Backend && pnpm run build
|
||||
working-directory: Backend
|
||||
run: pnpm run build
|
||||
|
||||
- name: Build UI
|
||||
run: cd UI && pnpm run build
|
||||
working-directory: UI
|
||||
run: pnpm run build
|
||||
|
||||
test-and-lint:
|
||||
name: Test & Lint
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
@@ -57,12 +64,15 @@ jobs:
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U patchpass"
|
||||
--health-cmd "pg_isready -U patchpass -d patchpass"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
env:
|
||||
TEST_DATABASE_URL: postgresql://patchpass:patchpass@patchpass:5432/patchpass
|
||||
DATABASE_URL: postgresql://patchpass:patchpass@postgres:5432/patchpass
|
||||
TEST_DATABASE_URL: postgresql://patchpass:patchpass@postgres:5432/patchpass
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
@@ -79,30 +89,35 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
cd Backend && pnpm install
|
||||
cd ../UI && pnpm install
|
||||
cd Backend
|
||||
pnpm install --frozen-lockfile
|
||||
cd ../UI
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
- name: Generate Prisma client
|
||||
run: cd Backend && pnpm generate
|
||||
env:
|
||||
DATABASE_URL: ${{ env.TEST_DATABASE_URL }}
|
||||
working-directory: Backend
|
||||
run: pnpm generate
|
||||
|
||||
- name: Backend lint
|
||||
run: cd Backend && pnpm lint
|
||||
working-directory: Backend
|
||||
run: pnpm lint
|
||||
|
||||
- name: UI lint
|
||||
run: cd UI && pnpm lint
|
||||
working-directory: UI
|
||||
run: pnpm lint
|
||||
|
||||
- name: Backend tests
|
||||
run: cd Backend && pnpm test
|
||||
working-directory: Backend
|
||||
run: pnpm exec vitest run --passWithNoTests
|
||||
|
||||
push-image:
|
||||
name: Build and Push Docker Image
|
||||
needs: [build, test-and-lint]
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev')
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Buildx
|
||||
@@ -138,4 +153,4 @@ jobs:
|
||||
provenance: false
|
||||
sbom: false
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
Reference in New Issue
Block a user