Skip to content

User

User #125

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: Gradle Build and Test
on:
pull_request:
branches: [ "main", "develope" ]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Import DB seed data
run: psql -d postgresql://postgres@localhost/postgres -f ddl.sql
# working-directory: ./test/data
env:
PGPASSWORD: postgres
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
- name: Add properties
run: echo "${{ secrets.APPLICATION_TEST }}" > ./src/main/resources/application.yml
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 7.5.1
arguments: build
- name: Upload Test Report
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: test-report
path: build/reports/tests/test
- name: Upload Jacoco Report
if: ${{ success() }}
uses: actions/upload-artifact@v3
with:
name: jacoco-coverage-report
path: build/reports/jacoco/test/html