-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (46 loc) · 1.39 KB
/
test.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
name: Run Tests
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
test:
if: github.event.pull_request.draft == false
name: Run Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpassword
POSTGRES_DB: testdb
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U testuser"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Wait for DB
timeout-minutes: 1
run: |
echo "Waiting for PostgreSQL to be ready..."
until pg_isready -h localhost -p 5432 -U testuser; do
>&2 echo "Postgres is unavailable - sleeping"
sleep 1
done
echo "PostgreSQL is ready!"
- name: Run migrations
run: docker run --rm --network=host -v "$(pwd)/db:/db" amacneil/dbmate:2.11 --url "postgres://testuser:testpassword@localhost:5432/testdb?sslmode=disable" up
- name: Install dependencies
run: yarn
- name: Run build
env:
DATABASE_URL: postgres://testuser:testpassword@localhost:5432/testdb?sslmode=disable
run: yarn build