Skip to content

Commit 11c2001

Browse files
author
jawher.kallel
committed
update workflows pipeline
1 parent 6408b08 commit 11c2001

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

.github/workflows/node.js.yml

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3+
14
name: Node.js CI
25

36
on:
47
push:
58
branches: [ "main" ]
69
pull_request:
710
branches: [ "main" ]
8-
11+
912
jobs:
1013
build:
1114
runs-on: ubuntu-latest
1215

13-
strategy:
14-
matrix:
15-
node-version: [18.x, 20.x, 22.x]
16+
services:
17+
postgres:
18+
image: postgres:13
19+
env:
20+
POSTGRES_USER: bookdb_owner
21+
POSTGRES_PASSWORD: FDXS5CHc1sRa
22+
POSTGRES_DB: testdb
23+
ports:
24+
- 5432:5432
25+
options: --health-cmd "pg_isready -U bookdb_owner" --health-timeout 5s --health-start-period 5s
1626

1727
steps:
1828
- uses: actions/checkout@v4
@@ -21,17 +31,10 @@ jobs:
2131
with:
2232
node-version: ${{ matrix.node-version }}
2333
cache: 'npm'
24-
25-
- name: Install dependencies
26-
run: npm ci
27-
34+
- run: npm ci
2835
- name: Set up environment variables
2936
env:
30-
DATABASE_URL: ${{ secrets.DATABASE_URL }}
31-
run: echo "Environment variable DATABASE_URL has been set."
32-
33-
- name: Build project
34-
run: npm run build --if-present
35-
36-
- name: Run tests
37-
run: npm test
37+
DATABASE_URL: postgresql://bookdb_owner:FDXS5CHc1sRa@localhost:5432/testdb
38+
run: echo "Database connection is set."
39+
- run: npm run build --if-present
40+
- run: npm test

0 commit comments

Comments
 (0)