Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
138 changes: 138 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
version: 2.1

orbs:
sonarcloud: sonarsource/sonarcloud@2.0.0

executors:
java-executor:
docker:
- image: cimg/openjdk:21.0.4
working_directory: /home/circleci/flexo-cli-client

docker-executor:
docker:
- image: cimg/base:stable
working_directory: /home/circleci/flexo-cli-client

workflows:
version: 2
build-and-test:
jobs:
- build
- build-dist:
requires:
- build
- scan:
requires:
- build
context:
- SonarCloud

release:
jobs:
- release:
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/

jobs:
build:
executor: java-executor
steps:
- checkout
- setup_remote_docker
- run:
name: Clear Gradle Cache
command: rm -rf ~/.gradle/caches/8.5
- restore_cache:
keys:
- v1-gradle-{{ checksum "build.gradle" }}
- v1-gradle-
- run:
name: Build
command: ./gradlew build
environment:
GRADLE_OPTS: --enable-native-access=ALL-UNNAMED
- run:
name: Run Tests
command: ./gradlew test
environment:
GRADLE_OPTS: --enable-native-access=ALL-UNNAMED
- save_cache:
key: v1-gradle-{{ checksum "build.gradle" }}
paths:
- ~/.gradle/caches
- ~/.gradle/wrapper
- store_test_results:
path: build/test-results/
- store_artifacts:
path: build/
destination: build
- persist_to_workspace:
root: /home/circleci/
paths:
- flexo-cli-client/*
scan:
executor: docker-executor
steps:
- checkout
- attach_workspace:
at: /home/circleci/
- run:
command: ls -al .
- sonarcloud/scan

build-dist:
executor: java-executor
steps:
- checkout
- restore_cache:
keys:
- v1-gradle-dist-{{ checksum "build.gradle" }}
- v1-gradle-dist-
- run:
name: Build Distribution
command: ./gradlew installDist
environment:
GRADLE_OPTS: --enable-native-access=ALL-UNNAMED
- save_cache:
key: v1-gradle-dist-{{ checksum "build.gradle" }}
paths:
- ~/.gradle/caches
- store_artifacts:
path: build/install/
destination: distribution


release:
executor: java-executor
steps:
- checkout
- restore_cache:
keys:
- v1-gradle-release-{{ checksum "build.gradle" }}
- v1-gradle-release-
- run:
name: Build Distribution
command: ./gradlew installDist fatJar
environment:
GRADLE_OPTS: --enable-native-access=ALL-UNNAMED
- save_cache:
key: v1-gradle-release-{{ checksum "build.gradle" }}
paths:
- ~/.gradle/caches
- run:
name: Create GitHub Release
command: |
if [ -n "$GITHUB_TOKEN" ]; then
curl -L https://github.com/softprops/action-gh-release/releases/latest/download/action-gh-release-linux-linux-amd64.tar.gz | tar -xz
./dist/release
mv build/libs/*.jar .
mv build/install/flexo/bin/flexo .
mv build/install/flexo/bin/flexo.bat .
./action-gh-release --files "*.jar,flexo,flexo.bat" --generate-release-notes
fi
environment:
GITHUB_TOKEN: ${GITHUB_TOKEN}
29 changes: 11 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'java'
id 'application'
id 'org.owasp.dependencycheck' version '10.0.4'
id 'org.sonarqube' version '6.0.1.5171'
}

group = 'org.openmbee.flexo'
Expand Down Expand Up @@ -76,21 +76,14 @@ tasks.register('fatJar', Jar) {
with jar
}

// OWASP Dependency Check configuration
dependencyCheck {
// Fail build on CVSS score >= 7.0 (High severity)
failBuildOnCVSS = 7.0

// Suppress false positives (configure as needed)
suppressionFile = file('dependency-check-suppressions.xml').exists() ?
'dependency-check-suppressions.xml' : null

// Analyze all configurations
scanConfigurations = ['runtimeClasspath', 'compileClasspath']

// Report formats
formats = ['HTML', 'JSON']

// Update vulnerability database automatically
autoUpdate = true
// SonarQube configuration
sonar {
properties {
property 'sonar.projectKey', 'Open-MBEE_flexo-cli-client'
property 'sonar.organization', 'openmbee'
property 'sonar.host.url', 'https://sonarcloud.io'
property 'sonar.java.source', '17'
property 'sonar.java.target', '17'
property 'sonar.sourceEncoding', 'UTF-8'
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sonar.projectKey=Open-MBEE_flexo-cli-client
sonar.organization=openmbee
sonar.language=kotlin
sonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml
sonar.sources=src/main/
sonar.tests=src/test/
sonar.java.binaries=build/
4 changes: 2 additions & 2 deletions src/main/java/org/openmbee/flexo/cli/config/FlexoConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ public String getSshKeyPath() {
}

public String getDefaultOrg() {
return get("default.org");
return get("default.org", "");
}

public String getDefaultRepo() {
return get("default.repo");
return get("default.repo", "");
}

public String getDefaultBranch() {
Expand Down