generated from ministryofjustice/hmpps-template-kotlin
-
Notifications
You must be signed in to change notification settings - Fork 1
106 lines (102 loc) · 2.99 KB
/
kotlin_localstack_postgres_validate.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: validate template for kotlin with localstack and postgres
on:
workflow_call:
inputs:
working_directory:
type: string
required: false
default: '~/app'
java_version:
type: string
required: false
default: '21'
java_options:
type: string
default: 'default: -Xmx512m -XX:ParallelGCThreads=2 -XX:ConcGCThreads=2 -Djava.util.concurrent.ForkJoinPool.common.parallelism=2 -Dorg.gradle.daemon=false -Dkotlin.compiler.execution.strategy=in-process -Dorg.gradle.workers.max=1'
required: false
postgres_tag:
type: string
required: true
postgres_password:
type: string
default: 'dev'
required: false
postgres_username:
type: string
default: 'root'
required: true
postgres_db:
type: string
default: 'postgres'
required: false
services:
type: string
default: 's3,sqs,sns,es,ec2,lambda'
required: false
localstack_tag:
type: string
default: 'latest'
required: false
permissions:
contents: read
jobs:
template_job:
runs-on: ubuntu-latest
# Label used to access the service container
services:
postgres:
# Docker Hub PostgreSQL image
image: postgres:${{ inputs.postgres_tag }}
# Provide the password for postgres
env:
POSTGRES_USER: ${{ inputs.postgres_username }}
POSTGRES_PASSWORD: ${{ inputs.postgres_password }}
POSTGRES_DB: ${{ inputs.postgres_db}}
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
localstack:
image: localstack/localstack:${{ inputs.localstack_tag }}
ports:
- 4566:4566
- 4571:4571
env:
ES_PORT_EXTERNAL: 4571
DOCKER_HOST: 'unix:///var/run/docker.sock'
AWS_EXECUTION_ENV: True
PERSISTENCE: 1
SERVICES: "${{ inputs.services }}"
steps:
- uses: actions/checkout@v4
- name: refresh cache
id: initial-cache
uses: actions/cache@v4
env:
cache-name: kotlin-cache
with:
path: |
- gradle-{{ checksum "build.gradle.kts" }}
- gradle-
key: ${{ runner.os }}-gradle-${{ env.cache-name }}-${{ hashFiles('build.gradle.kts') }}
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '${{ inputs.java_version }}'
cache: 'gradle'
cache-dependency-path: |
*.gradle*
**/gradle-wrapper.properties
- run: ./gradlew check
- name: upload the artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: upload kotlin valdation results
path: |
build/test-results
build/reports/tests