Skip to content

Merge pull request #753 from techmatters/gian_CHI-2965-2 #2

Merge pull request #753 from techmatters/gian_CHI-2965-2

Merge pull request #753 from techmatters/gian_CHI-2965-2 #2

Workflow file for this run

# 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