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