Skip to content

Commit

Permalink
Merge pull request #10 from bcgov/fix/release
Browse files Browse the repository at this point in the history
ci: fixing ci
  • Loading branch information
paulushcgcj authored Aug 15, 2023
2 parents e5538ce + 7939bdb commit eb7e334
Show file tree
Hide file tree
Showing 8 changed files with 175 additions and 78 deletions.
48 changes: 18 additions & 30 deletions .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
cache: "maven"
server-id: "github"

- uses: bcgov-nr/[email protected]
- uses: bcgov-nr/[email protected]
name: Core Coverage
with:
commands: |
Expand All @@ -134,11 +126,13 @@ jobs:
sonar_project_token: ${{ secrets.SONAR_TOKEN_COMMONS }}

- name: Publish Core
working-directory: ./core
run: |
mvn versions:set -DnewVersion='${{ needs.release.outputs.version }}' -DskipTests -Dtests.skip=true --file pom.xml
mvn versions:commit
mvn -B source:jar deploy --file pom.xml
uses: paulushcgcj/[email protected]
with:
dir: core
app-version: ${{ needs.release.outputs.version }}
extra-params: -DskipTests -Dtests.skip=true
add-sources: true
add-javadoc: true
env:
GITHUB_TOKEN: ${{ github.token }}

Expand All @@ -153,19 +147,11 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
cache: "maven"
server-id: "github"

- uses: bcgov-nr/[email protected]
- uses: bcgov-nr/[email protected]
name: Spring Coverage
with:
commands: |
mvn versions:use-dep-version -DdepVersion=${{ needs.release.outputs.version }} -Dincludes=ca.bc.gov.nrs-commons:forest-client-core -DforceVersion=true --file pom.xml
mvn versions:use-dep-version -DdepVersion='${{ needs.release.outputs.version }}' -Dincludes=ca.bc.gov.nrs-commons:forest-client-core -DforceVersion=true --file pom.xml
mvn -B verify -P all-tests checkstyle:checkstyle -Dcheckstyle.skip=false --file pom.xml
dir: spring
java-cache: maven
Expand All @@ -177,11 +163,13 @@ jobs:
sonar_project_token: ${{ secrets.SONAR_TOKEN_COMMONS }}

- name: Publish Spring
working-directory: ./spring
run: |
mvn versions:use-dep-version -DdepVersion=${{ needs.release.outputs.version }} -Dincludes=ca.bc.gov.nrs-commons:forest-client-core -DforceVersion=true --file pom.xml
mvn versions:set -DnewVersion='${{ needs.release.outputs.version }}' -DskipTests -Dtests.skip=true --file pom.xml
mvn versions:commit --file pom.xml
mvn -B source:jar deploy --file pom.xml
uses: paulushcgcj/[email protected]
with:
commands: mvn versions:use-dep-version -DdepVersion=${{ needs.release.outputs.version }} -Dincludes=ca.bc.gov.nrs-commons:forest-client-core -DforceVersion=true --file pom.xml
dir: spring
app-version: ${{ needs.release.outputs.version }}
extra-params: -DskipTests -Dtests.skip=true
add-sources: true
add-javadoc: true
env:
GITHUB_TOKEN: ${{ github.token }}
6 changes: 0 additions & 6 deletions .github/workflows/pr-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
steps:
- name: Checkout branch
uses: actions/checkout@v3
with:
ref: refs/heads/${{ github.head_ref }}

- name: Conventional Changelog Update
continue-on-error: true
Expand All @@ -31,12 +29,8 @@ jobs:
skip-version-file: "true"
skip-commit: "true"
git-push: "false"
git-branch: refs/heads/${{ github.head_ref }}
skip-on-empty: "false"

- name: Checkout pr
uses: actions/checkout@v3

- name: Removing dev core
uses: paulushcgcj/[email protected]
continue-on-error: true
Expand Down
46 changes: 17 additions & 29 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
cache: "maven"
server-id: "github"

- uses: bcgov-nr/[email protected]
- uses: bcgov-nr/[email protected]
name: Core Coverage
with:
commands: |
Expand All @@ -176,11 +168,13 @@ jobs:
sonar_project_token: ${{ secrets.SONAR_TOKEN_COMMONS }}

- name: Publish Core
working-directory: ./core
run: |
mvn versions:set -DnewVersion='${{ needs.pr-validation.outputs.version }}.PR${{ github.event.number }}' -DskipTests -Dtests.skip=true --file pom.xml
mvn versions:commit
mvn -B source:jar deploy --file pom.xml
uses: paulushcgcj/[email protected]
with:
dir: core
app-version: ${{ needs.pr-validation.outputs.version }}.PR${{ github.event.number }}
extra-params: -DskipTests -Dtests.skip=true
add-sources: true
add-javadoc: true
env:
GITHUB_TOKEN: ${{ github.token }}

Expand All @@ -196,15 +190,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
cache: "maven"
server-id: "github"

- uses: bcgov-nr/[email protected]
- uses: bcgov-nr/[email protected]
name: Spring Coverage
with:
commands: |
Expand All @@ -220,11 +206,13 @@ jobs:
sonar_project_token: ${{ secrets.SONAR_TOKEN_COMMONS }}

- name: Publish Spring
working-directory: ./spring
run: |
mvn versions:use-dep-version -DdepVersion=${{ needs.pr-validation.outputs.version }}.PR${{ github.event.number }} -Dincludes=ca.bc.gov.nrs-commons:forest-client-core -DforceVersion=true --file pom.xml
mvn versions:set -DnewVersion='${{ needs.pr-validation.outputs.version }}.PR${{ github.event.number }}' -DskipTests -Dtests.skip=true --file pom.xml
mvn versions:commit --file pom.xml
mvn -B source:jar deploy --file pom.xml
uses: paulushcgcj/[email protected]
with:
commands: mvn versions:use-dep-version -DdepVersion=${{ needs.pr-validation.outputs.version }}.PR${{ github.event.number }} -Dincludes=ca.bc.gov.nrs-commons:forest-client-core -DforceVersion=true --file pom.xml
dir: spring
app-version: ${{ needs.pr-validation.outputs.version }}.PR${{ github.event.number }}
extra-params: -DskipTests -Dtests.skip=true
add-sources: true
add-javadoc: true
env:
GITHUB_TOKEN: ${{ github.token }}
11 changes: 10 additions & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down Expand Up @@ -160,7 +169,7 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<source>8</source>
<source>${java.version}</source>
<doctitle>Javadoc Documentation for ${project.name} ${project.version}
</doctitle>
<windowtitle>${project.name} ${project.version}
Expand Down
27 changes: 17 additions & 10 deletions core/src/main/java/ca/bc/gov/app/dto/ValidationError.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
package ca.bc.gov.app.dto;

import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.With;

@Data
@Schema(
description = "Represents a validation error during submission",
title = "ValidationError",
example = """
{
"fieldId": "person.name",
"errorMsg": "Name is required"
}"""
)
@With
@NoArgsConstructor
@AllArgsConstructor
public class ValidationError implements Serializable {
private String fieldId;
private String errorMsg;
public record ValidationError(
@Schema(description = "The field id that failed validation", example = "person.name")
String fieldId,
@Schema(description = "The error message for that specific field", example = "Name is required")
String errorMsg
) {

}
108 changes: 107 additions & 1 deletion core/src/main/java/ca/bc/gov/app/dto/legacy/ForestClientDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,130 @@

import ca.bc.gov.app.dto.client.ClientStatusCodeEnum;
import ca.bc.gov.app.dto.client.ClientTypeCodeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils;

@Schema(
description = "Represents a client from the legacy forest database.",
title = "ForestClient",
example = """
{
"clientNumber": "00000002",
"clientName": "BAXTER",
"legalFirstName": "",
"legalMiddleName": "",
"clientStatusCode": "ACT",
"clientTypeCode": "I",
"clientIdTypeCode": "C",
"clientIdentification": "00000002",
"registryCompanyTypeCode": "BC",
"corpRegnNmbr": "00000002",
"clientAcronym": "",
"wcbFirmNumber": "",
"ocgSupplierNmbr": "",
"clientComment": ""
}"""
)
public record ForestClientDto(
@Schema(
description = "The client number.",
example = "00000002"
)
String clientNumber,
@Schema(description = """
The client last name if it's an individual or
the company name if it's a company""",
example = "BAXTER"
)
String clientName,
@Schema(description = """
The first name of the individual,
or null if it's a company""",
example = "JAMES")
String legalFirstName,
@Schema(description = """
The middle name of the individual,
or null if it's a company""",
example = "Canter")
String legalMiddleName,
@Schema(description = """
The status of the client, can be any of the following:<br>
ACT (Active)<br>
DAC (Deactivated)<br>
DEC (Deceased)<br>
REC (Receivership)<br>
SPN (Suspended)""",
example = "ACT")
String clientStatusCode,
@Schema(description = """
The type of client, can be any of the following:<br>
A (Association)<br>
B (First Nation Band)<br>
C (Corporation)<br>
F (Ministry of Forests and Range)<br>
G (Government)<br>
I (Individual)<br>
L (Limited Partnership)<br>
P (General Partnership)<br>
R (First Nation Group)<br>
S (Society)<br>
T (First Nation Tribal Council)<br>
U (Unregistered Company)""",
example = "I")
String clientTypeCode,

@Schema(description = """
The type of client, can be any of the following:<br>
A (Association)<br>
B (First Nation Band)<br>
C (Corporation)<br>
F (Ministry of Forests and Range)<br>
G (Government)<br>
I (Individual)<br>
L (Limited Partnership)<br>
P (General Partnership)<br>
R (First Nation Group)<br>
S (Society)<br>
T (First Nation Tribal Council)<br>
U (Unregistered Company)""",
example = "C")
String clientIdTypeCode,
@Schema(description = "An ID to identify companies",example = "Wull.")
String clientIdentification,
@Schema(description = """
The type of company, such as:<br>
BC (BC Registered Business)<br>
FM (Sole Proprietorship)""",
example = "FM")
String registryCompanyTypeCode,
@Schema(description = "Company registration number",
example = "00000002")
String corpRegnNmbr,
@Schema(description = "An acronyms for this client",
example = "JAMES BAXTER")
String clientAcronym,
@Schema(description = "WCB firm number",
example = "00000002")
String wcbFirmNumber,
@Schema(description = "OCG supplier number",
example = "00000002")
String ocgSupplierNmbr,
@Schema(description = "A comment for this client",
example = "This is a comment")
String clientComment
) {

/**
* Returns the legal name of the client already formatted
* @return A string with the legal name
*/
public String legalName() {
if (StringUtils.defaultString(clientTypeCode).equalsIgnoreCase("I")) {
return
Expand All @@ -38,6 +140,10 @@ public String legalName() {
return StringUtils.defaultString(clientName);
}

/**
* Returns a map with the client information
* @return A map with the client information
*/
public Map<String, Object> description() {
return
Map.of(
Expand All @@ -47,7 +153,7 @@ public Map<String, Object> description() {
"type", ClientTypeCodeEnum.valueOf(clientTypeCode),
"identifier",
StringUtils.defaultString(registryCompanyTypeCode) +
StringUtils.defaultString(corpRegnNmbr)
StringUtils.defaultString(corpRegnNmbr)
);
}
}
5 changes: 5 additions & 0 deletions core/src/main/java/ca/bc/gov/app/util/LogUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
import org.slf4j.Logger;
import org.slf4j.event.Level;

/**
* <p><b>Log Util</b></p>
* <p>Utility class for logging.</p>
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class LogUtil {

/**
* <p><b>Log Content</b></p>
* Log the content of the future at the specified level.
Expand Down
Loading

0 comments on commit eb7e334

Please sign in to comment.