-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (56 loc) · 1.5 KB
/
jobs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: E2E Tests
on:
push:
branches:
- main
- dev
jobs:
build:
runs-on: ubuntu-latest
env:
NODE_ENV: testing
TEST_DATABASE_URL: postgres://testuser:testpassword@localhost:5432/testdb
services:
postgres:
image: postgres:16
ports:
- 5432:5432
env:
POSTGRES_DB: testdb
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpassword
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Verify Docker installation
run: docker --version
- name: List Docker containers
run: docker ps -a
- name: Install dependencies
run: npm ci
- name: Wait for PostgreSQL to be ready
run: |
until pg_isready -h localhost -p 5432 -U testuser; do
echo "Waiting for PostgreSQL..."
sleep 2
done
- name: Echo DATABASE_URL
run: echo $DATABASE_URL
- name: Run database migrations
run: npm run migrations
# env:
# NODE_ENV: testing
# DATABASE_URL: postgres://testuser:testpassword@localhost:5432/testdb
- name: Run unit tests
run: npm run test
- name: Run e2e tests
run: |
if [ "$RUNNER_OS" = "Windows" ]; then
set NODE_ENV=testing && npm run test:e2e
else
npm run test:e2e
fi