-
Notifications
You must be signed in to change notification settings - Fork 3
155 lines (128 loc) · 4.43 KB
/
hrm-ci.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Copyright (C) 2021-2023 Technology Matters
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see https://www.gnu.org/licenses/.
name: Lint and Test HRM
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout Branch
uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Install Packages
run: npm ci
- name: Run Lint
run: npm run lint
build-lambda-containers:
runs-on: ubuntu-latest
strategy:
matrix:
lambda_path:
- hrm-domain/lambdas/files-urls
- hrm-domain/lambdas/contact-retrieve-transcript
- lambdas/job-complete
- resources-domain/lambdas/import-consumer
- resources-domain/lambdas/import-producer
- resources-domain/lambdas/search-index
steps:
- name: Checkout Branch
uses: actions/checkout@v4
- name: Set Build Args
run: |
lambda_full_path=${{ matrix.lambda_path }}
# Extracting directory and lambda name from the lambda path
build_lambda_dir=$(dirname $lambda_full_path)
build_lambda_name=$(basename $lambda_full_path)
echo "build_lambda_name=$build_lambda_name"
echo "build_lambda_dir=$build_lambda_dir"
echo "build_lambda_name=$build_lambda_name" >> $GITHUB_ENV
echo "build_lambda_dir=$build_lambda_dir" >> $GITHUB_ENV
- name: Build Lambda Docker Images
uses: docker/build-push-action@v6
with:
context: ./
file: ./lambdas/Dockerfile
build-args: |
lambda_name=${{ env.build_lambda_name }}
lambda_dir=${{ env.build_lambda_dir }}
push: false
tags: ${{ env.build_lambda_name }}:ci-test
build-service-container:
runs-on: ubuntu-latest
steps:
- name: Checkout Branch
uses: actions/checkout@v4
- name: Build Service Docker Image
uses: docker/build-push-action@v6
with:
context: ./
file: ./hrm-domain/hrm-service/Dockerfile
push: false
tags: hrm-service-ci-test
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Run Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 8.7.0
security-enabled: false
- name: Checkout Branch
uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Install Packages
run: npm ci
- name: Build
run: npm run build
- name: Run Unit Tests
run: npm run test:unit
service-tests:
runs-on: ubuntu-latest
steps:
- name: Run Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 8.7.0
security-enabled: false
- name: Checkout Branch
uses: actions/checkout@v4
- name: Use Node.js 16.x
uses: actions/setup-node@v4
with:
node-version: 16.x
- name: Install Packages
run: npm ci
- name: Build
run: npm run build
- name: Setup database tables
uses: m4nu56/[email protected]
with:
# Version of PostgreSQL to use
postgresql version: 12.7
# POSTGRES_DB - name for the default database that is created
postgresql db: hrmdb
# POSTGRES_USER - create the specified user with superuser power
postgresql user: rdsadmin
# POSTGRES_PASSWORD - superuser password
postgresql password: postgres
# POSTGRES_INIT_SCRIPTS - directory containing DB init scripts
postgresql init scripts: test-support/db-init
- name: Run Service Tests
run: npm run test:service:ci