Update project #27

Merged
flecomte merged 7 commits from update-project into master 2021-07-01 01:11:11 +02:00
12 changed files with 173 additions and 38 deletions

View File

@@ -1,23 +1,76 @@
name: CI
name: Tests
on:
push:
branches: [ action, master ]
branches:
- 'master'
pull_request:
branches: [ action, master ]
branches:
- 'master'
jobs:
build:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- uses: eskatos/gradle-command-action@v1
with:
gradle-version: 6.8
arguments: test
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build
uses: eskatos/gradle-command-action@v1
with:
gradle-version: '7.1'
arguments: build -x test -x ktlintKotlinScriptCheck -x ktlintTestSourceSetCheck -x ktlintMainSourceSetCheck
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
- name: Lint
uses: eskatos/gradle-command-action@v1
with:
gradle-version: '7.1'
arguments: ktlintCheck
- name: Test
uses: eskatos/gradle-command-action@v1
with:
gradle-version: '7.1'
arguments: test
- name: Coverage
uses: eskatos/gradle-command-action@v1
with:
gradle-version: '7.1'
arguments: jacocoTestReport
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Push analyse to sonarqube
uses: eskatos/gradle-command-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
gradle-version: '7.1'
arguments: sonarqube --info

53
.github/workflows/publish.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
name: Publish
on:
release:
types: [ published ]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build
uses: eskatos/gradle-command-action@v1
with:
gradle-version: '7.1'
arguments: build -x test -x ktlintKotlinScriptCheck -x ktlintTestSourceSetCheck -x ktlintMainSourceSetCheck
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
- name: Test
uses: eskatos/gradle-command-action@v1
with:
gradle-version: '7.1'
arguments: test
- name: Publish
uses: eskatos/gradle-command-action@v1
with:
gradle-version: '7.1'
arguments: publish
env:
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
.idea/.gitignore generated vendored
View File

@@ -5,6 +5,5 @@
/dataSources.local.xml
/compiler.xml
/uiDesigner.xml
/dataSources.xml
/sonarlint/
/jarRepositories.xml

View File

@@ -17,15 +17,7 @@
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CALL_PARAMETERS_WRAP" value="5" />
<option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>

12
.idea/dataSources.xml generated Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="json_test@localhost" uuid="1191ff9a-6823-4b18-af90-483ddf0e4b69">
<driver-ref>postgresql</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
<jdbc-url>jdbc:postgresql://localhost:5555/json_test</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component>
</project>

View File

@@ -4,15 +4,16 @@ plugins {
jacoco
id("maven-publish")
kotlin("jvm") version "1.4.30"
kotlin("jvm") version "1.5.10"
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
id("org.owasp.dependencycheck") version "6.1.1"
id("fr.coppernic.versioning") version "3.2.1"
id("com.avast.gradle.docker-compose") version "0.14.0"
id("org.sonarqube") version "+"
}
group = "com.github.flecomte"
group = "io.github.flecomte"
version = versioning.info.tag
repositories {
@@ -44,13 +45,24 @@ tasks.test {
finalizedBy(tasks.ktlintCheck)
}
tasks.jacocoTestReport {
dependsOn(tasks.test)
reports {
xml.required.set(true)
}
}
tasks.sonarqube.configure {
dependsOn(tasks.jacocoTestReport)
}
tasks.publishToMavenLocal {
dependsOn(tasks.test)
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.4.31")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.20")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.5.20")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-joda:2.12.1")
implementation("com.github.jasync-sql:jasync-postgresql:1.1.7")
@@ -61,7 +73,7 @@ dependencies {
testImplementation("ch.qos.logback:logback-core:1.2.3")
testImplementation("io.mockk:mockk:1.10.6")
testImplementation("org.junit.jupiter:junit-jupiter:5.7.1")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.4.30")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.5.20")
testImplementation("org.amshove.kluent:kluent:1.65")
}
@@ -97,3 +109,13 @@ publishing {
}
}
}
tasks.withType<PublishToMavenRepository>().configureEach {
onlyIf {
versioning.info.run {
!dirty && tag != null && tag.matches("""[0-9]+\.[0-9]+\.[0-9]+""".toRegex())
}
}
dependsOn(tasks.test)
}

View File

@@ -1,6 +1,6 @@
# To execute this docker-compose yml file use docker-compose -f <file_name> up
# Add the "-d" flag at the end for detached execution
version: '3.7'
version: '3.8'
services:
db:
container_name: postgres_json

View File

@@ -1,4 +1,4 @@
FROM postgres:11
FROM postgres:13
COPY postgresql.conf /tmp/postgresql.conf
COPY extension.sh /docker-entrypoint-initdb.d/000-extension.sh

View File

@@ -664,5 +664,3 @@ log_rotation_size = 100MB
#------------------------------------------------------------------------------
# Add settings for extensions here
zdb.default_elasticsearch_url = 'http://elasticsearch:9200/'

View File

@@ -1,2 +1,8 @@
kotlin.code.style=official
kotlin_version=1.3.31
kotlin_version=1.5.10
systemProp.sonar.host.url=https://sonarcloud.io
systemProp.sonar.projectKey=postgres-json
systemProp.sonar.projectName=PostgresJson
systemProp.sonar.organization=flecomte
systemProp.sonar.java.coveragePlugin=jacoco
systemProp.sonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml

View File

@@ -1,4 +1,4 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists

View File

@@ -80,9 +80,9 @@ class Requester(
constructor(
host: String = "localhost",
port: Int = 5432,
database: String = "dc-project",
username: String = "dc-project",
password: String = "dc-project",
database: String,
username: String,
password: String,
queriesDirectory: URI? = null,
functionsDirectory: URI? = null
) : this(