Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/axonivy-market/marketplace
Browse files Browse the repository at this point in the history
… into nqhoan-axonivy-patch-1

# Conflicts:
#	.github/workflows/dev-build.yml
  • Loading branch information
nqhoan-axonivy committed Jul 5, 2024
2 parents 4df2ac6 + d57f98e commit 03882c1
Show file tree
Hide file tree
Showing 210 changed files with 23,545 additions and 24 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/dev-build.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/service-ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Service CI Build
run-name: Build Service on branch ${{github.ref_name}} triggered by ${{github.actor}}

on:
push:
workflow_dispatch:

jobs:
build:
name: Executes Tests
runs-on: self-hosted

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Tests with Maven
run: mvn clean install --file ./marketplace-service/pom.xml
analysis:
name: Sonarqube analysis
needs: build
runs-on: self-hosted
env:
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_PROJECT_KEY : ${{ secrets.SONAR_PROJECT_KEY }}
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Run SonarQube Scanner
run: |
mvn -B verify sonar:sonar --file ./marketplace-service/pom.xml \
-Dsonar.host.url=${{ env.SONAR_HOST_URL }} \
-Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }} \
-Dsonar.projectName="AxonIvy Market Service" \
-Dsonar.token=${{ env.SONAR_TOKEN }} \
- name: SonarQube Quality Gate check
id: sonarqube-quality-gate-check
uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
with:
scanMetadataReportFile: ./marketplace-service/target/sonar/report-task.txt
args: -Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }}
42 changes: 42 additions & 0 deletions .github/workflows/service-dev-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Service DEV Build
run-name: Build and Deploy Marketplace-Service on branch ${{github.ref_name}} by ${{github.actor}}

on:
push:
branches: [ "develop" ]
workflow_dispatch:

jobs:
build:
name: Packge project and deploy to tomcat
runs-on: self-hosted

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Update configuration
env:
APP_PROPERTIES_FILE: './marketplace-service/src/main/resources/application.properties'
GITHUB_TOKEN_FILE: './marketplace-service/src/main/resources/github.token'
MONGODB_HOST: ${{ secrets.MONGODB_HOST }}
MONGODB_DATABASE: ${{ secrets.MONGODB_DATABASE }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
sed -i "s/^spring.data.mongodb.host=.*$/spring.data.mongodb.host=$MONGODB_HOST/" $APP_PROPERTIES_FILE
sed -i "s/^spring.data.mongodb.database=.*$/spring.data.mongodb.database=$MONGODB_DATABASE/" $APP_PROPERTIES_FILE
sed -i '1d;$d' $GITHUB_TOKEN_FILE && echo $GH_TOKEN > $GITHUB_TOKEN_FILE
- name: Build with Maven
run: mvn clean package -DskipTests --file ./marketplace-service/pom.xml
- name: Prepare deployment directory
run: mkdir -p deployment && cp target/*.war deployment/
- name: Copy WAR to Tomcat server
run: sudo cp deployment/*.war /opt/tomcat/webapps/marketplace-service.war
- name: Restart Tomcat server
run: |
sudo systemctl stop tomcat
sudo systemctl start tomcat
57 changes: 57 additions & 0 deletions .github/workflows/ui-ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: UI CI Build
run-name: Build on branch ${{github.ref_name}} triggered by ${{github.actor}}

on:
push:
branches-ignore:
- develop
- master
workflow_dispatch:

jobs:
build:
name: Build
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Build project
run: npm run build

analysis:
name: Sonarqube
needs: build
runs-on: self-hosted
env:
SONAR_PROJECT_KEY: 'AxonIvy-Market-UI'
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

steps:
- name: Execute Tests
run: npm run test
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ env.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ env.SONAR_HOST_URL }}
with:
args:
-Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }}
- name: SonarQube Quality Gate check
id: sonarqube-quality-gate-check
uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ env.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ env.SONAR_HOST_URL }}

- name: Clean up
run: |
rm -rf *
28 changes: 28 additions & 0 deletions .github/workflows/ui-dev-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: UI Dev Build
run-name: Build and Deploy Marketplace-UI on branch ${{github.ref_name}} by ${{github.actor}}

on:
push:
branches: [ "develop" ]
workflow_dispatch:

jobs:
build:
name: Build and deploy new code to Deployment directory
runs-on: self-hosted

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Build Angular app
run: npm run build -- --configuration production --output-path=dist
- name: Execute Tests
run: npm run test
- name: Copy files to Deployment directory
if: success()
run: sudo cp -r dist/* /var/www/marketplace-ui
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
/bin/

### Token
*.token
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Getting Started

### Reference Documentation
For further reference, please consider the following sections:

* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.2.5/maven-plugin/reference/html/)
* [Spring Data MongoDB](https://docs.spring.io/spring-boot/docs/3.2.5/reference/htmlsingle/index.html#data.nosql.mongodb)
* [Spring Web](https://docs.spring.io/spring-boot/docs/3.2.5/reference/htmlsingle/index.html#web)

### Guides
The following guides illustrate how to use some features concretely:

* Installing mongodb, and access it as Url mongodb://localhost:27017/, and you can create and name whatever you want ,then you should put them to application.properties
* You can change the MongoDB configuration in file `application.properties`
```
spring.data.mongodb.host=
spring.data.mongodb.database=
```
* Update GitHub token in file `github.token`
* Run mvn clean install to build project
* Run mvn test to test all tests
### Access Swagger URL: http://{your-host}/swagger-ui/index.html
### Install Lombok for Eclipse IDE
* Download lombok here https://projectlombok.org/download
* run command "java -jar lombok.jar" then you can access file “eclipse.ini“ in eclipse folder where you install → there is a text like this: -javaagent:C:\Users\tvtphuc\eclipse\jee-2024-032\eclipse\lombok.jar → it means you are successful
* Start eclipse
* Import the project then in the eclipse , you should run the command “mvn clean install“
* After that you go to class MarketplaceServiceApplication → right click to main method → click run as → choose Java Application
* Then you can send a request in postman
* If you want to run single test in class UserServiceImplTest. You can right-click to method testFindAllUser and right click → select Run as → choose JUnit Test
1 change: 1 addition & 0 deletions marketplace-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Placeholder
22 changes: 22 additions & 0 deletions marketplace-build/Marketplace Tomcat v10.1 Server.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jst.server.tomcat.core.launchConfigurationType">
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<mapAttribute key="org.eclipse.debug.core.environmentVariables">
<mapEntry key="MONGODB_DATABASE" value="marketplace"/>
<mapEntry key="MONGODB_HOST" value="localhost:27017"/>
<mapEntry key="MONGODB_PASSWORD" value=""/>
<mapEntry key="MONGODB_USERNAME" value=""/>
</mapAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-17.0.4.1&quot; path=&quot;2&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry externalArchive=&quot;D:/work/Projects/AxonMarket/IDE/eclipse-workspace/apache-tomcat-10.1.19/bin/bootstrap.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry externalArchive=&quot;D:/work/Projects/AxonMarket/IDE/eclipse-workspace/apache-tomcat-10.1.19/bin/tomcat-juli.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-17.0.4.1"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="start"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dcatalina.base=&quot;D:\work\Projects\AxonMarket\IDE\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1&quot; -Dcatalina.home=&quot;D:\work\Projects\AxonMarket\IDE\eclipse-workspace\apache-tomcat-10.1.19&quot; -Dwtp.deploy=&quot;D:\work\Projects\AxonMarket\IDE\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps&quot; --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED"/>
<stringAttribute key="server-id" value="Tomcat v10.1 Server at localhost"/>
</launchConfiguration>
1 change: 1 addition & 0 deletions marketplace-build/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Placeholder
36 changes: 36 additions & 0 deletions marketplace-service/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
/bin/

### Token
*.token
34 changes: 34 additions & 0 deletions marketplace-service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Getting Started

### Reference Documentation
For further reference, please consider the following sections:

* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.2.5/maven-plugin/reference/html/)
* [Spring Data MongoDB](https://docs.spring.io/spring-boot/docs/3.2.5/reference/htmlsingle/index.html#data.nosql.mongodb)
* [Spring Web](https://docs.spring.io/spring-boot/docs/3.2.5/reference/htmlsingle/index.html#web)

### Guides
The following guides illustrate how to use some features concretely:

* Installing mongodb, and access it as Url mongodb://localhost:27017/, and you can create and name whatever you want ,then you should put them to application.properties
* You can change the MongoDB configuration in file `application.properties`
```
spring.data.mongodb.host=
spring.data.mongodb.database=
```
* Update GitHub token in file `github.token`
* Run mvn clean install to build project
* Run mvn test to test all tests
### Access Swagger URL: http://{your-host}/swagger-ui/index.html
### Install Lombok for Eclipse IDE
* Download lombok here https://projectlombok.org/download
* run command "java -jar lombok.jar" then you can access file “eclipse.ini“ in eclipse folder where you install → there is a text like this: -javaagent:C:\Users\tvtphuc\eclipse\jee-2024-032\eclipse\lombok.jar → it means you are successful
* Start eclipse
* Import the project then in the eclipse , you should run the command “mvn clean install“
* After that you go to class MarketplaceServiceApplication → right click to main method → click run as → choose Java Application
* Then you can send a request in postman
* If you want to run single test in class UserServiceImplTest. You can right-click to method testFindAllUser and right click → select Run as → choose JUnit Test
2 changes: 2 additions & 0 deletions marketplace-service/lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true
Loading

0 comments on commit 03882c1

Please sign in to comment.