Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions .github/workflows/test-springboot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,21 @@ on:
description: 'Path to the generated artifact to upload'
required: false
default: 'build/reports/tests/test/'

compose-file:
type: string
description: 'Path to a composefile to run before running tests'
required: false
compose-profile:
type: string
description: 'The profile of the composefile to load'
required: false

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ inputs.working-directory }}
services:
postgres:
image: postgres
env:
POSTGRES_DB: app
POSTGRES_USER: app
POSTGRES_PASSWORD: app
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- uses: actions/checkout@v4
Expand All @@ -57,7 +53,10 @@ jobs:
java-version: ${{ inputs.java-version }}
distribution: ${{ inputs.java-distribution }}
cache: gradle

- name: Run compose-file
if: inputs.compose-file != ''
run: |
docker compose up -f ${{ inputs.compose-file }} --profile ${{ $inputs.compose-profile }} -d
- name: Build with Gradle
env:
DATABASE_URL: postgresql://localhost:5432/app
Expand All @@ -71,3 +70,6 @@ jobs:
with:
name: ${{ inputs.artifact-name }}
path: ${{ inputs.working-directory }}/${{ inputs.artifact-path }}
- name: Stop compose-file
if: inputs.compose-file != '' && always()
run: docker compose down -f ${{ inputs.compose-file }} --profile ${{ $inputs.compose-profile }}
Loading