Skip to content

Commit 9cac186

Browse files
authored
Merge pull request #3 from Ogenbertrand/docker-build-with-tests
modify workflow
2 parents a24aeba + 57ac481 commit 9cac186

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/build-test.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build and test
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
tags-ignore:
8+
- "v*"
9+
pull_request:
10+
branches:
11+
- "**"
12+
13+
jobs:
14+
build:
15+
name: Build
16+
runs-on: ubuntu-latest
17+
18+
services:
19+
postgres:
20+
image: postgres:latest
21+
ports:
22+
- 5432:5432
23+
env:
24+
POSTGRES_DB: demo
25+
POSTGRES_USER: postgres
26+
POSTGRES_PASSWORD: password
27+
options: >-
28+
--health-cmd pg_isready
29+
--health-interval 10s
30+
--health-timeout 5s
31+
--health-retries 5
32+
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v4
36+
with:
37+
submodules: "recursive"
38+
39+
- name: Setup Java
40+
uses: actions/setup-java@v4
41+
with:
42+
java-version: "17"
43+
distribution: "temurin"
44+
45+
- name: Wait for Postgres
46+
run: |
47+
while ! pg_isready -h localhost -p 5432; do
48+
echo "Waiting for postgres..."
49+
sleep 1
50+
done
51+
52+
- name: Run Build
53+
env:
54+
SPRING_DATASOURCE_URL: jdbc:postgresql://localhost:5432/demo
55+
SPRING_DATASOURCE_USERNAME: postgres
56+
SPRING_DATASOURCE_PASSWORD: password
57+
run: ./gradlew clean build
58+

0 commit comments

Comments
 (0)