Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(188): code review #193

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f5e7be4
chore: updating pom
Dec 14, 2022
a0a5bfe
chore: adding commons-lang3
Dec 14, 2022
e68e552
chore: code cleanup
Dec 14, 2022
a367ca2
chore: removing dependencies
Dec 14, 2022
41448cf
chore: removing component from entity
Dec 14, 2022
198fe38
chore: removing ScopeConstant.java
Dec 14, 2022
427c5d8
chore: removing component from entity
Dec 14, 2022
53b14a8
chore: removing ScopeConstant.java
Dec 14, 2022
89ded74
Merge branch 'feat/ches' into fix/188-code-review
Dec 14, 2022
1c3598e
chore: adding lombok and refactoring
Dec 15, 2022
53621c4
Frontend(deps-dev): Bump @types/node in /frontend (#191)
dependabot[bot] Dec 14, 2022
5a97cbd
Frontend(deps-dev): Bump @typescript-eslint/eslint-plugin in /fronten…
dependabot[bot] Dec 14, 2022
7184242
Merge to main close #190: add checking duplicate api to frontend (#192)
MCatherine1994 Dec 15, 2022
05532c4
chore: code cleanup
Dec 14, 2022
5191d24
chore: removing dependencies
Dec 14, 2022
42334d9
chore: adding lombok and refactoring
Dec 15, 2022
d7649c4
chore: adding lombok and refactoring
Dec 15, 2022
019da69
chore: removing mapping
Dec 15, 2022
7f16335
chore: code cleanup
Dec 15, 2022
c5a3e8c
chore: updating gititnore
Dec 15, 2022
fe15e8a
chore: cleaning up repository
Dec 15, 2022
f9add0f
Merge branch 'main' into fix/188-code-review
paulushcgcj Dec 15, 2022
28ce411
chore: cleaning up repository
Dec 15, 2022
e23331e
chore: updating gitignore
Dec 16, 2022
8960fb9
chore: updating dependencies and cleanup
Dec 16, 2022
e3371ab
ci: updating workflow and labels
Dec 16, 2022
7aca6e4
ci: adding codechange detection
Dec 17, 2022
dce57dc
ci: fixing ci for frontend
Dec 17, 2022
666db3e
ci: limiting ci per folder
Dec 17, 2022
d5ea28c
ci: removing changes
Dec 17, 2022
c717220
ci: adding backend ci
Dec 17, 2022
2e4ea19
chore: moving packages out of core
Dec 19, 2022
08ca30c
Merge branch 'main' into fix/188-code-review
paulushcgcj Dec 30, 2022
8f5d0e9
Merge branch 'main' into fix/188-code-review
paulushcgcj Dec 30, 2022
a7f2fd3
Merge branch 'main' into fix/188-code-review
paulushcgcj Jan 4, 2023
028a5b0
Merge branch 'main' of https://github.com/bcgov/nr-forest-client into…
MCatherine1994 Jan 5, 2023
db3d769
fix/backend: fix backend unit test permission issue
MCatherine1994 Jan 6, 2023
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
63 changes: 63 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
github_actions:
- .github/*

tests:
- backend/src/test/**/*.java
- frontend/cypress/**/*
- frontend/src/tests/**/*.spec.ts

source:
- backend/src/main/**/*.java
- frontend/src/**/*.ts

docker:
- any: ['Dockerfile','dockerfile-entrypoint.sh']

controller:
- backend/src/main/**/controller/*.java

dto:
- backend/src/main/**/dto/*.java

entity:
- backend/src/main/**/entity/*.java

repository:
- backend/src/main/**/repository/*.java

configuration:
- backend/src/main/**/configuration/*.java
- backend/src/main/resources/**/*
- backend/config/**/*
- frontend/tsconfig*
- frontend/vite*
- frontend/*.json

service:
- backend/src/main/**/service/*.java

frontend:
- frontend/**/*

backend:
- backend/**/*

database:
- database/**/*

dependencies:
- any: ['backend/pom.xml','frontend/package.json','package-lock.json']

documentation:
- backend/docs/**/*
- frontend/docs/**/*
- docs/**/*

java:
- backend/**/*

javascript:
- frontend/**/*

openshift:
- '**/openshift.*.yml'
232 changes: 232 additions & 0 deletions .github/workflows/be-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
name: Project CI
on:
push:
branches:
- '*'
- '*/*'
- '**'
tags-ignore:
- '**'
paths:
- "backend/**"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

validate:
name: Validate Code
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
needs:
- cancel-prev-runs
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Cache Maven
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-maven-test-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-test-

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'

- name: Code Validation
run: mvn -B validate --file pom.xml

- name: Archive CycloneDX
uses: actions/upload-artifact@v2
with:
name: cyclone
path: target/bom.json
retention-days: 5

- name: Code Compilation
run: mvn -B clean compile --file pom.xml

- name: Checkstyle
run: mvn -B checkstyle:checkstyle -Dcheckstyle.skip=false --file pom.xml

- name: Use Checkstyle report
uses: jwgmeligmeyling/checkstyle-github-action@master
with:
path: '**/checkstyle-result.xml'

test:
name: Test Code
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
needs:
- validate
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Cache Maven
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-maven-test-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-test-

- name: Cache SonarCloud packages
uses: actions/cache@v2
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'

- name: Unit Tests
run: mvn -B test --file pom.xml

- name: Integration Tests
run: mvn -B verify -P integration-test --file pom.xml

- name: Code Coverage
run: mvn -B clean verify -P all-tests --file pom.xml

- name: Add coverage to PR
id: jacoco
uses: madrapps/[email protected]
with:
paths: target/coverage-reports/merged-test-report/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 70
min-coverage-changed-files: 70

- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
report_paths: 'target/**/TEST-*.xml'

- name: Generate JaCoCo Badge
uses: cicirello/jacoco-badge-generator@v2
with:
generate-branches-badge: true
jacoco-csv-file: target/coverage-reports/merged-test-report/jacoco.csv

- name: Log coverage percentage
run: |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"

- name: Commit the badge (if it changed)
run: |
if [[ `git status --porcelain` ]]; then
git config --global user.name 'CI Bot'
git config --global user.email '[email protected]'
git add -A
git commit -m "ci: autogenerated JaCoCo coverage badge"
git push
fi

- name: Upload JaCoCo coverage report
uses: actions/upload-artifact@v2
with:
name: jacoco-report
path: target/coverage-reports/merged-test-report/

- name: Qualitygate
run: mvn -B clean verify -P all-tests package sonar:sonar -Dsonar.projectKey=paulushcgcj_simple-webflux -Dsonar.coverage.jacoco.xmlReportPaths=target/coverage-reports/merged-test-report/jacoco.xml --file pom.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

security:
name: Security checks
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
permissions:
security-events: write
needs:
- validate
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Cache Maven
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-maven-test-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-test-

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'

- name: Code Compilation
run: mvn -B clean compile --file pom.xml

- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/maven@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high --sarif-file-output=snyk.sarif

vulnerability:
name: Vulnerability checks
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
permissions:
security-events: write
needs:
- validate
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Cache Maven
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-maven-test-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-test-

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: java

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'

- name: Code Compilation
run: mvn -B clean compile --file pom.xml

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
57 changes: 57 additions & 0 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,63 @@ concurrency:
cancel-in-progress: true

jobs:
pr-validation:
name: Pull Request Validation
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v3

- name: Pull request size and stability labels
uses: actions/labeler@v4
continue-on-error: true
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Conventional Label
uses: bcoe/conventional-release-labels@v1
continue-on-error: true
with:
token: ${{ secrets.GITHUB_TOKEN }}
ignored_types: '["chore","pr"]'
type_labels: '{"feat": "feature", "fix": "fix", "bug": "fix", "doc": "documentation", "ci": "ci", "chore": "chore", "breaking": "breaking", "BREAKING CHANGE": "breaking"}'

- name: Checkout branch
uses: actions/checkout@v3
with:
ref: refs/heads/${{ github.head_ref }}

- name: Conventional Changelog Update
continue-on-error: true
uses: TriPSs/conventional-changelog-action@v3
id: changelog
with:
github-token: ${{ github.token }}
output-file: 'CHANGELOG.md'
skip-version-file: 'true'
skip-commit: 'true'
git-push: 'false'
git-branch: refs/heads/${{ github.head_ref }}

- name: Checkout pr
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}

- name: Comment PR
continue-on-error: true
uses: thollander/actions-comment-pull-request@v1
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
message: |
# Current changelog

${{ steps.changelog.outputs.clean_changelog }}
comment_includes: '# Current changelog'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pr-greeting:
name: PR Greeting
env:
Expand Down
Loading