Skip to content

Commit 2c61996

Browse files
Merge branch 'PSMRI:develop' into develop
2 parents 5670ba5 + da8d957 commit 2c61996

9 files changed

Lines changed: 2699 additions & 24 deletions

File tree

.github/workflows/build-on-pull-request.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ jobs:
1313
repository: ${{ github.event.pull_request.head.repo.full_name }}
1414

1515
- name: Setup JDK 17
16-
uses: actions/setup-java@v2
16+
uses: actions/setup-java@v4
1717
with:
1818
java-version: 17
19-
distribution: 'adopt'
19+
distribution: 'temurin'
2020

2121
- name: Test with Maven
2222
run: mvn test
2323

2424
- name: Initialize CodeQL
25-
uses: github/codeql-action/init@v2
25+
uses: github/codeql-action/init@v3
2626
with:
27-
languages: Java
27+
languages: Java
2828

2929
- name: Build with Maven
3030
run: mvn clean install
3131

3232
- name: Perform CodeQL Analysis
33-
uses: github/codeql-action/analyze@v2
33+
uses: github/codeql-action/analyze@v3

.github/workflows/commitlint.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Commit Compliance
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
commitlint:
9+
name: Lint commit messages
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code with submodules
14+
uses: actions/checkout@v4
15+
with:
16+
ref: ${{ github.event.pull_request.head.ref }}
17+
repository: ${{ github.event.pull_request.head.repo.full_name }}
18+
submodules: true
19+
fetch-depth: 0
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 18
25+
26+
- name: Install dependencies
27+
run: npm ci --legacy-peer-deps
28+
29+
- name: Run commitlint on PR
30+
run: |
31+
npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

.github/workflows/package.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ on:
55
branches: [ "develop"]
66
paths-ignore:
77
- target/**
8-
8+
99
pull_request:
1010
branches: [ "develop" ]
1111
paths-ignore:
1212
- target/**
13-
13+
1414
env:
1515
ENV_VAR: test
1616

@@ -25,24 +25,22 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
steps:
28-
29-
- name: Checkout code
30-
uses: actions/checkout@v2
28+
- name: Checkout code
29+
uses: actions/checkout@v3
3130
- name: Setup JDK 17
32-
uses: actions/setup-java@v2
31+
uses: actions/setup-java@v4
3332
with:
3433
java-version: 17
35-
distribution: 'adopt'
36-
34+
distribution: 'temurin'
3735

3836
- name: Build with Maven
3937
run: mvn clean install -DENV_VAR=${{ env.ENV_VAR }}
40-
38+
4139
- name: Build WAR file
4240
run: mvn -B package --file pom.xml
43-
41+
4442
- name: Upload WAR file as artifact
45-
uses: actions/upload-artifact@v4
43+
uses: actions/upload-artifact@v4
4644
with:
4745
name: Identity-API
48-
path: target/identity-0.0.1.war
46+
path: target/identity-0.0.1.war

.github/workflows/sast.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches: [ "develop" ]
66
paths-ignore:
77
- target/**
8-
8+
99
pull_request:
1010
branches: [ "develop" ]
1111
paths-ignore:
@@ -25,7 +25,7 @@ jobs:
2525
fail-fast: false
2626
matrix:
2727
language: [ 'java' ]
28-
28+
2929
steps:
3030
- name: Checkout code
3131
uses: actions/checkout@v3
@@ -35,18 +35,18 @@ jobs:
3535

3636
# Initializes the CodeQL tools for scanning.
3737
- name: Initialize CodeQL
38-
uses: github/codeql-action/init@v2
38+
uses: github/codeql-action/init@v3
3939

4040
- name: Setup JDK 17
41-
uses: actions/setup-java@v2
41+
uses: actions/setup-java@v4
4242
with:
4343
java-version: 17
44-
distribution: 'adopt'
45-
44+
distribution: 'temurin'
45+
4646
- name: Build with Maven
4747
run: mvn clean install
4848

4949
- name: Perform CodeQL Analysis
50-
uses: github/codeql-action/analyze@v2
50+
uses: github/codeql-action/analyze@v3
5151
with:
5252
category: "/language:${{matrix.language}}"

.husky/commit-msg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env sh
2+
3+
npx --no-install commitlint --edit "$1"

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,49 @@ Detailed information on API endpoints can be found in the [API Guide](https://pi
4040
## Integrations
4141
* RMNCH (Reproductive, Maternal, Newborn, and Child Health)
4242

43+
## Setting Up Commit Hooks
44+
45+
This project uses Git hooks to enforce consistent code quality and commit message standards. Even though this is a Java project, the hooks are powered by Node.js. Follow these steps to set up the hooks locally:
46+
47+
### Prerequisites
48+
- Node.js (v14 or later)
49+
- npm (comes with Node.js)
50+
51+
### Setup Steps
52+
53+
1. **Install Node.js and npm**
54+
- Download and install from [nodejs.org](https://nodejs.org/)
55+
- Verify installation with:
56+
```
57+
node --version
58+
npm --version
59+
```
60+
2. **Install dependencies**
61+
- From the project root directory, run:
62+
```
63+
npm ci
64+
```
65+
- This will install all required dependencies including Husky and commitlint
66+
3. **Verify hooks installation**
67+
- The hooks should be automatically installed by Husky
68+
- You can verify by checking if the `.husky` directory contains executable hooks
69+
### Commit Message Convention
70+
This project follows a specific commit message format:
71+
- Format: `type(scope): subject`
72+
- Example: `feat(login): add remember me functionality`
73+
Types include:
74+
- `feat`: A new feature
75+
- `fix`: A bug fix
76+
- `docs`: Documentation changes
77+
- `style`: Code style changes (formatting, etc.)
78+
- `refactor`: Code changes that neither fix bugs nor add features
79+
- `perf`: Performance improvements
80+
- `test`: Adding or fixing tests
81+
- `build`: Changes to build process or tools
82+
- `ci`: Changes to CI configuration
83+
- `chore`: Other changes (e.g., maintenance tasks, dependencies)
84+
Your commit messages will be automatically validated when you commit, ensuring project consistency.
85+
4386
## Usage
4487
All features have been exposed as REST endpoints. Refer to the SWAGGER API specification for details.
4588

commitlint.config.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
module.exports = {
2+
extends: ["@commitlint/config-conventional"],
3+
rules: {
4+
"body-leading-blank": [1, "always"],
5+
"body-max-line-length": [2, "always", 100],
6+
"footer-leading-blank": [1, "always"],
7+
"footer-max-line-length": [2, "always", 100],
8+
"header-max-length": [2, "always", 100],
9+
"subject-case": [
10+
2,
11+
"never",
12+
["sentence-case", "start-case", "pascal-case", "upper-case"],
13+
],
14+
"subject-empty": [2, "never"],
15+
"subject-full-stop": [2, "never", "."],
16+
"type-case": [2, "always", "lower-case"],
17+
"type-empty": [2, "never"],
18+
"type-enum": [
19+
2,
20+
"always",
21+
[
22+
"build",
23+
"chore",
24+
"ci",
25+
"docs",
26+
"feat",
27+
"fix",
28+
"perf",
29+
"refactor",
30+
"revert",
31+
"style",
32+
"test",
33+
],
34+
],
35+
},
36+
};

0 commit comments

Comments
 (0)