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
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ tab_width = 4
# ij_visual_guides = none
# ij_wrap_on_typing = false


[{*.yml,*.yaml}]
indent_size = 2
tab_width = 2
insert_final_newline = true

[*.dcl]
# ij_declarative_keep_indents_on_empty_lines = false

Expand Down
95 changes: 94 additions & 1 deletion .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ on:
env:
JAVA_VERSION: 21

# If a build is running in the current branch, and the branch is updated, we cancel the previous build and start
# a new one with the updated changes.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read
code-quality: write


jobs:
formatting:
Expand All @@ -26,6 +36,89 @@ jobs:
- name: Build with Gradle
run: ./gradlew --parallel --continue spotlessCheck

test_on_branch:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ] #, macos-latest, windows-latest ]
jdk: [ 21 ]

env:
OS: ubuntu-latest
JDK: 21

runs-on: ubuntu-latest

steps:
- name: Checkout latest code
uses: actions/checkout@v7.0.0
with:
fetch-depth: "0"
ref: ${{ github.event.pull_request.head.sha || github.sha }}

## Setup the specified version of Java (includes maven/gradle).
- &setupjava
name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v5
with:
distribution: 'zulu' # v2 requires explicitly stating the distribution - `zulu` and `adopt` supported at time of writing
java-version: ${{ matrix.jdk }} # Use matrix to select which JDK level to use
java-package: jdk # optional (jdk or jre) - defaults to jdk
cache: 'gradle'

- name: Setup SMT solvers
uses: keyproject/setup-smt@v0

- name: z3 version
run: z3 --version

- name: cvc5 version
run: cvc5 --version

- &checkjava
name: Echo exact java version being used
run: java -version

- name: Test with Gradle and generate coverage
run: ./gradlew --continue --parallel test aggregateCoverageReport aggregateTestReport

- run: python scripts/cover2cover.py build/reports/jacoco/aggregateCoverageReport/aggregateCoverageReport.xml **/src/main/{java,kotlin} > cov-report.xml
if: success() || failure()

- name: Upload coverage report
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
uses: actions/upload-code-coverage@v1
with:
file: cov-report.xml
language: Java
label: code-coverage/jacoco

- name: Upload Test Report
if: success() || failure()
uses: actions/upload-artifact@v7
with:
name: aggregated-results
path: build/reports/tests/test/aggregated-results
compression-level: '9'
retention-days: 7

- name: Upload Coverage Report
if: success() || failure()
uses: actions/upload-artifact@v7
with:
name: aggregated-coverage
path: build/reports/jacoco/aggregateCoverageReport/html/
compression-level: '9'
retention-days: 7

- name: Test reporting
uses: dorny/test-reporter@v3
if: success() || failure()
with:
name: Test Report
path: "*/build/test-results/test/*.xml"
reporter: java-junit

unit-tests:
strategy:
fail-fast: false
Expand Down Expand Up @@ -68,4 +161,4 @@ jobs:
path: |
**/build/test-results/*/*.xml
**/build/reports/
!**/jacocoTestReport.xml
!**/jacocoTestReport.xml
82 changes: 82 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: "CodeQL Advanced"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '43 14 * * 4'

jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: 'ubuntu-latest'
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
- language: actions
build-mode: none
- language: java-kotlin
build-mode: autobuild
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v7

- name: Set up JDK 21
if: matrix.language == 'java-kotlin'
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: 21
java-package: jdk
cache: 'gradle'

- name: Echo exact java version being used
run: java -version

- run: ./gradlew --parallel testClasses
if: matrix.language == 'java-kotlin'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"
39 changes: 33 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier

plugins { id("org.jetbrains.dokka") }
plugins {
id("org.jetbrains.dokka")
jacoco
id("jacoco-report-aggregation")
id("test-report-aggregation")
}

repositories {
mavenCentral()
maven { url = uri("https://central.sonatype.com/repository/maven-snapshots/") }
}

repositories { mavenCentral() }

dependencies {
dokka(project(":keyext.api"))
dokka(project(":keyext.api.doc"))
dokka(project(":keyext.api.app"))
dokka(project(":keyext.api.client"))
subprojects.forEach {
if(it.name != "tools") {
dokka(it)
jacocoAggregation(it)
testReportAggregation(it)
}
}
}

reporting {
reports {
create<AggregateTestReport>("aggregateTestReport") {
testSuiteName = "test"
}
create<JacocoCoverageReport>("aggregateCoverageReport") {
testSuiteName = "test"
}
}
}

dokka {
Expand All @@ -18,4 +41,8 @@ dokka {
suppressObviousFunctions.set(true)
offlineMode.set(false)
}
}

jacoco {
toolVersion = "0.8.15"
}
2 changes: 2 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ dependencies {
implementation(libs.kotlin.gradle.plugin)
implementation(libs.spotless)
implementation(libs.dokka)
implementation(libs.jacoco.cobertura)
implementation(libs.vanniktech.maven)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ plugins {
id("com.diffplug.spotless")
id("org.jetbrains.kotlin.jvm")
id("org.jetbrains.dokka")

id("test-report-aggregation")
id("jacoco-report-aggregation")
`jvm-test-suite`
jacoco
}

repositories {
Expand All @@ -24,6 +29,32 @@ java {
}
}

testing {
suites {
getByName<JvmTestSuite>("test") {
useJUnitJupiter()
targets {
all {
testTask.configure {
// maxHeapSize = "8g"
// jvmArgs("-Xmx2g")
// finalizedBy(tasks.jacocoTestReport)
}
}
}
}
}
}

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.compilerArgs.add("-parameters")

// See: https://docs.oracle.com/en/java/javase/12/tools/javac.html
options.compilerArgs.add("-Xlint:all")
// "-Werror", // Terminates compilation when warnings occur.
}

tasks.named<Test>("test") {
useJUnitPlatform()
}
Expand Down Expand Up @@ -62,7 +93,7 @@ dokka {
skipEmptyPackages.set(true)
skipDeprecated.set(false)
suppressGeneratedFiles.set(true)
//samples.from("samples/Basic.kt", "samples/Advanced.kt")
// samples.from("samples/Basic.kt", "samples/Advanced.kt")

sourceLink {
remoteUrl("https://github.com/keyproject/key-rpc/tree/main/")
Expand Down Expand Up @@ -97,7 +128,7 @@ dokka {
}

dokkaPublications.html {
//moduleName.set()
// moduleName.set()
val exists = layout.projectDirectory.file("README.md").asFile
if (exists.exists()) {
includes.from("README.md")
Expand All @@ -119,4 +150,18 @@ val dokkaJavadocJar by tasks.registering(Jar::class) {
from(tasks.dokkaGeneratePublicationJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}
*/
*/

jacoco {
toolVersion = "0.8.15"
}

tasks.jacocoTestReport {
dependsOn(tasks.test)

reports {
xml.required.set(true)
html.required.set(true)
csv.required.set(false)
}
}
Loading
Loading