Skip to content

Commit

Permalink
Add generic contracts for object authenticity management
Browse files Browse the repository at this point in the history
  • Loading branch information
jnmt committed Jul 23, 2024
1 parent 4a817b7 commit 5fa573c
Show file tree
Hide file tree
Showing 14 changed files with 1,189 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on:
push:
branches:
- master
- "[0-9]+"
- "[0-9]+.[0-9]+"
workflow_dispatch:
pull_request:

jobs:
check-generic-contracts-and-functions:
name: Gradle check for generic contracts and functions
runs-on: ubuntu-latest

defaults:
run:
working-directory: generic-contracts-and-functions

steps:
- uses: actions/checkout@v4

- name: Set up JDK 1.8
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Check with Gradle
run: ./gradlew check

- name: Package artifacts
if: always()
run: |
mkdir -p /tmp/artifacts-generic-contracts-and-functions
cp -a build/reports/tests/test /tmp/artifacts-generic-contracts-and-functions/
cp -a build/reports/spotbugs /tmp/artifacts-generic-contracts-and-functions/
- uses: actions/upload-artifact@v4
if: always()
with:
name: artifacts-generic-contracts-and-functions
path: /tmp/artifacts-generic-contracts-and-functions
84 changes: 84 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
##############################
## Java
##############################
.mtj.tmp/
*.class
*.jar
*.war
*.ear
*.nar
hs_err_pid*

##############################
## Maven
##############################
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
pom.xml.bak
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar

##############################
## Gradle
##############################
bin/
build/
.gradle
.gradletasknamecache
gradle-app.setting
!gradle-wrapper.jar

##############################
## IntelliJ
##############################
out/
.idea/
.idea_modules/
*.iml
*.ipr
*.iws

##############################
## Eclipse
##############################
.settings/
bin/
tmp/
.metadata
.classpath
.project
*.tmp
*.bak
*.swp
*~.nib
local.properties
.loadpath
.factorypath

##############################
## NetBeans
##############################
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml

##############################
## Visual Studio Code
##############################
.vscode/
.code-workspace

##############################
## OS X
##############################
.DS_Store
80 changes: 80 additions & 0 deletions generic-contracts-and-functions/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
plugins {
id 'com.diffplug.spotless' version '6.13.0'
id 'com.github.spotbugs' version '5.2.5'
id 'net.ltgt.errorprone' version '3.1.0'
}

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'com.diffplug.spotless'

ext {
scalarDlVersion = '3.9.0'
scalarDbVersion = '3.13.0'
junitVersion = '5.10.3'
junitPlatformVersion = '1.10.3'
mockitoVersion = '4.11.0'
assertjVersion = '3.26.0'
errorproneVersion = '2.10.0'
errorproneJavacVersion = '9+181-r4173-1'
spotbugsVersion = '4.8.6'
}

repositories {
mavenCentral()
}

dependencies {
implementation group: 'com.scalar-labs', name: 'scalardl-java-client-sdk', version: "${scalarDlVersion}"
implementation group: 'com.scalar-labs', name: 'scalardb', version: "${scalarDbVersion}"
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: "${junitVersion}"
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: "${junitVersion}"
testImplementation group: 'org.junit.platform', name: 'junit-platform-console', version: "${junitPlatformVersion}"
testImplementation group: 'org.assertj', name: 'assertj-core', version: "${assertjVersion}"
testImplementation group: 'org.mockito', name: 'mockito-core', version: "${mockitoVersion}"
testImplementation group: 'org.mockito', name: 'mockito-inline', version: "${mockitoVersion}"

// for Error Prone
errorprone "com.google.errorprone:error_prone_core:${errorproneVersion}"
errorproneJavac "com.google.errorprone:javac:${errorproneJavacVersion}"

// for SpotBugs
spotbugs "com.github.spotbugs:spotbugs:${spotbugsVersion}"
compileOnly "com.github.spotbugs:spotbugs-annotations:${spotbugsVersion}"
testCompileOnly "com.github.spotbugs:spotbugs-annotations:${spotbugsVersion}"
}

test {
useJUnitPlatform()
}

spotless {
java {
target 'src/*/java/**/*.java'
importOrder()
removeUnusedImports()
googleJavaFormat('1.7')
}
}

spotbugs {
ignoreFailures = false
showStackTraces = true
showProgress = true
effort = 'default'
reportLevel = 'default'
maxHeapSize = '1g'
extraArgs = [ '-nested:false' ]
jvmArgs = [ '-Duser.language=en' ]
}

spotbugsMain.reports {
html.enabled = true
}

spotbugsTest.reports {
html.enabled = true
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 5fa573c

Please sign in to comment.