Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
e5f01bb
Add ci/cd setup to the project
Czooi Sep 3, 2024
5db49ce
Update ci.yml
Czooi Sep 3, 2024
7b53144
update ci.yml file
Czooi Sep 3, 2024
073a524
Merge branch 'ci/cd-setup' of https://github.com/XuHong0308/SpringBoo…
Czooi Sep 3, 2024
d1971f9
update ci.yml
Czooi Sep 3, 2024
74664e2
update ci.yml2
Czooi Sep 3, 2024
58a33f6
modify the setup postgresql
Czooi Sep 3, 2024
03725ca
modify the working directory for build backend
Czooi Sep 3, 2024
c3b6af2
add upload surface report step
Czooi Sep 3, 2024
491ffbd
Merge branch 'ci/cd-setup'
Czooi Sep 3, 2024
4ed83c7
testing
Czooi Sep 3, 2024
40d7a70
rectify the generate backend report step
Czooi Sep 3, 2024
257ec48
add step for generate build report
Czooi Sep 3, 2024
b2d46df
testing
Czooi Sep 3, 2024
49bfaef
testing2
Czooi Sep 3, 2024
a97447f
testing3
Czooi Sep 3, 2024
10a6dbb
modify for generate frontend build report in github action
Czooi Sep 3, 2024
d2179a9
error from non compatible node version
Czooi Sep 3, 2024
e12559e
option 1 open ssl cannot work, try downgrade node version
Czooi Sep 3, 2024
abc532a
remove the bundle analysis as it will run nonstop
Czooi Sep 3, 2024
8a8eb09
Modify the Analyze Script
Czooi Sep 3, 2024
d533d2f
Modify the analyze Script to generate the report as a static HTML file
Czooi Sep 3, 2024
5ae8636
testing
Czooi Sep 3, 2024
f72183d
testing2
Czooi Sep 3, 2024
1ddf94b
Generate frontend test report in project file
Czooi Sep 3, 2024
2f603e6
set step for upload frontend test report in artifact
Czooi Sep 3, 2024
f8295ce
testing
Czooi Sep 3, 2024
b771a56
fix node version using ssl
Czooi Sep 4, 2024
f050f7e
testing2
Czooi Sep 4, 2024
4b7a70b
debugging
Czooi Sep 4, 2024
fbebf06
debugging2
Czooi Sep 4, 2024
45ab664
debugging3
Czooi Sep 4, 2024
bcce656
debugging
Czooi Sep 4, 2024
e9ecf83
debugging
Czooi Sep 4, 2024
9f83a7e
Update ci.yml
Czooi Sep 4, 2024
dbd7589
debug
Czooi Sep 4, 2024
428aab7
debug
Czooi Sep 4, 2024
f536cfa
add unit test for angular
Czooi Sep 4, 2024
5015805
Change report naming
Czooi Sep 4, 2024
6402355
modify ci.yml
Czooi Sep 4, 2024
462f188
update building
kyiiiiiii Sep 6, 2024
bc5fd84
update building
kyiiiiiii Sep 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: CI Pipeline Setup

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
backend:
name: Build and Test Backend
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'

- name: Install PostgreSQL
run: sudo apt-get install -y postgresql postgresql-contrib

- name: Start PostgreSQL service
run: |
sudo service postgresql start
sudo -u postgres psql -q -c "SHOW server_version;"

- name: Set up PostgreSQL DB
run: |
sudo -u postgres psql -q -c "CREATE DATABASE mydatabase;"

- name: Build Backend
working-directory: ./backend
run: mvn install

- name: Generate Maven Site Report
working-directory: ./backend
run: mvn clean site

- name: Run Backend Tests
working-directory: ./backend
env:
DATABASE_URL: "jdbc:postgresql://localhost:5432/mydatabase"
DATABASE_USER: "postgres"
DATABASE_PASSWORD: "E@91e2l52"
run: mvn test

- name: Generate Surefire Report
working-directory: ./backend
run: mvn surefire-report:report-only

- name: Upload Backend Building Report
if: success()
uses: actions/upload-artifact@v3
with:
name: Backend-building-report
path: backend/target/site/

- name: Upload Backend Test Report
if: success()
uses: actions/upload-artifact@v3
with:
name: Backend-test-report
path: backend/target/site/surefire-report.html



frontend:
name: Build and Test Frontend
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16.13.0'

- name: Install Dependencies
working-directory: ./frontend
run: npm install

- name: Build Frontend
working-directory: ./frontend
run: npm run build

- name: Run Bundle Analysis
working-directory: ./frontend
run: npm run analyze

- name: Upload Frontend Building Rreport
if: success()
uses: actions/upload-artifact@v3
with:
name: Frontend-building-report
path: frontend/bundle-report.html

- name: Run Frontend Tests
working-directory: ./frontend
run: npm test

- name: Upload Frontend Test Report
if: always()
uses: actions/upload-artifact@v3
with:
name: Frontend-test-report
path: frontend/coverage
Empty file.
Empty file added backend/New Text Document.txt
Empty file.
15 changes: 15 additions & 0 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.28</version>
<optional>true</optional>
</dependency>
<dependency>
Expand All @@ -61,6 +62,20 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>3.0.0-M5</version> <!-- or the latest version -->
<executions>
<execution>
<id>surefire-report</id>
<phase>verify</phase>
<goals>
<goal>report-only</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
1 change: 1 addition & 0 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"statsJson": true,
"outputPath": "dist/shop",
"index": "src/index.html",
"main": "src/main.ts",
Expand Down
Loading