-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (77 loc) · 2.31 KB
/
http4k-backend-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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Http4k Backend Tests
on:
push:
branches:
- main
- master
- 'renovate/**'
paths:
- 'conduit-backend/**'
- 'build-src/**'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
env:
DB_NAME: test-db
DB_USER: test-user
DB_PASSWORD: test-password
services:
postgres:
image: postgres:alpine
env:
POSTGRES_DB: ${{ env.DB_NAME }}
POSTGRES_USER: ${{ env.DB_USER }}
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
options: >-
--health-cmd "pg_isready -U test-user -d test-db"
--health-interval 3s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 3s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Run Database Migrations
uses: docker://flyway/flyway:latest-alpine
env:
FLYWAY_URL: jdbc:postgresql://postgres:5432/${{ env.DB_NAME }}
FLYWAY_USER: ${{ env.DB_USER }}
FLYWAY_PASSWORD: ${{ env.DB_PASSWORD }}
FLYWAY_LOCATIONS: filesystem:/github/workspace/conduit-backend/db-migration/main,filesystem:/github/workspace/conduit-backend/db-migration/test
# Set container's JAVA_HOME to prevent GitHub Actions from passing its own Java path
# This ensures the container uses its internal Java installation at /opt/java/openjdk
JAVA_HOME: /opt/java/openjdk
with:
args: migrate
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Run Backend Tests
working-directory: conduit-backend
env:
DB__URL: jdbc:postgresql://localhost:5432/${{ env.DB_NAME }}
DB__USER: ${{ env.DB_USER }}
DB__PASSWORD: ${{ env.DB_PASSWORD }}
run: |
./gradlew check
- name: Upload build reports
uses: actions/upload-artifact@v4
if: always()
with:
name: backend-build-reports
path: conduit-backend/build/reports/