From cd1e8a78c3509bd061e46278ba9128a20435e1d9 Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Fri, 19 Aug 2022 16:21:55 +0200 Subject: [PATCH 01/11] sets up Detekt --- .github/workflows/build-backend.yml | 4 + README.md | 36 +- build.gradle.kts | 5 + config/detekt/detekt.yml | 656 ++++++++++++++++++++++++++++ 4 files changed, 698 insertions(+), 3 deletions(-) create mode 100644 config/detekt/detekt.yml diff --git a/.github/workflows/build-backend.yml b/.github/workflows/build-backend.yml index 7038b38..e41354d 100644 --- a/.github/workflows/build-backend.yml +++ b/.github/workflows/build-backend.yml @@ -25,3 +25,7 @@ jobs: uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 with: arguments: build + - name: Upload coverage reports + uses: codecov/codecov-action@v2 + with: + files: build/reports/kover/report.xml \ No newline at end of file diff --git a/README.md b/README.md index 1a89eef..1e54b17 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,35 @@ # Pluckr -``` -./gradlew run -``` \ No newline at end of file +Pluckr is a (currently non-functional) project aiming at helping folks find available trees, plants and spices to pluck from. + +## About the project + +This project is build with [Ktor](https://ktor.io/) for the backend, backed by a PostgreSQL database and using [Exposed](https://github.com/JetBrains/Exposed) to interact with the database. +The frontend is buildt with [Open-WC](https://open-wc.org/), [Lit](http://lit.dev/) and [Leaflet](https://leafletjs.com/examples/quick-start/) in Javascript. + +## Running the project locally + +The project is in 3 separate pieces. You need to : + +* Fire up a PostgreSQL database, I use a local Docker image for the moment + +* Fire the backend. You do this using `./gradlew run`. +* Fire the frontend. It is located in `src/js/pluckr-app`. Run `npm install` and then `npm start` + + +## TODOs + +* Adds tests and install [Kover](https://lengrand.fr/kover-code-coverage-plugin-for-kotlin/) +* Look into Qonada and Detekt +* Automated deployment +* Setup local and remote db +* Build the freaking project + +## License + +This is a personal project, you may do anything with it without my permission 😊. +All rights reserved. + +## Author + +[Julien Lengrand-Lambert](https://twitter.com/jlengrand) \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index d425fb5..2f0a823 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,6 +9,11 @@ plugins { application kotlin("jvm") version "1.7.0" kotlin("plugin.serialization") version "1.6.21" + + // Clean project +// id("org.jetbrains.kotlinx.kover") version "0.4.2" + id("io.gitlab.arturbosch.detekt").version("1.21.0") + } diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml new file mode 100644 index 0000000..6b70b8d --- /dev/null +++ b/config/detekt/detekt.yml @@ -0,0 +1,656 @@ +build: + maxIssues: 0 + excludeCorrectable: false + weights: + # complexity: 2 + # LongParameterList: 1 + # style: 1 + # comments: 1 + +config: + validation: true + warningsAsErrors: false + # when writing own rules with new properties, exclude the property path e.g.: 'my_rule_set,.*>.*>[my_property]' + excludes: '' + +console-reports: + active: true + exclude: + - 'ProjectStatisticsReport' + - 'ComplexityReport' + - 'NotificationReport' + - 'FindingsReport' + - 'FileBasedFindingsReport' + # - 'LiteFindingsReport' + +output-reports: + active: true + exclude: + # - 'TxtOutputReport' + # - 'XmlOutputReport' +# - 'HtmlOutputReport' + # - 'MdOutputReport' + +complexity: + active: true + ComplexCondition: + active: true + threshold: 4 + ComplexInterface: + active: false + threshold: 10 + includeStaticDeclarations: false + includePrivateDeclarations: false + ComplexMethod: + active: true + threshold: 15 + ignoreSingleWhenExpression: false + ignoreSimpleWhenEntries: false + ignoreNestingFunctions: false + nestingFunctions: + - 'also' + - 'apply' + - 'forEach' + - 'isNotNull' + - 'ifNull' + - 'let' + - 'run' + - 'use' + - 'with' + LabeledExpression: + active: false + ignoredLabels: [] + LargeClass: + active: true + threshold: 600 + LongMethod: + active: true + threshold: 60 + LongParameterList: + active: true + functionThreshold: 6 + constructorThreshold: 7 + ignoreDefaultParameters: false + ignoreDataClasses: true + ignoreAnnotatedParameter: [] + MethodOverloading: + active: false + threshold: 6 + NamedArguments: + active: false + threshold: 3 + ignoreArgumentsMatchingNames: false + NestedBlockDepth: + active: true + threshold: 4 + NestedScopeFunctions: + active: false + threshold: 1 + functions: + - 'kotlin.apply' + - 'kotlin.run' + - 'kotlin.with' + - 'kotlin.let' + - 'kotlin.also' + ReplaceSafeCallChainWithRun: + active: false + StringLiteralDuplication: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + threshold: 3 + ignoreAnnotation: true + excludeStringsWithLessThan5Characters: true + ignoreStringsRegex: '$^' + TooManyFunctions: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + thresholdInFiles: 11 + thresholdInClasses: 11 + thresholdInInterfaces: 11 + thresholdInObjects: 11 + thresholdInEnums: 11 + ignoreDeprecated: false + ignorePrivate: false + ignoreOverridden: false + +coroutines: + active: true + GlobalCoroutineUsage: + active: false + InjectDispatcher: + active: true + dispatcherNames: + - 'IO' + - 'Default' + - 'Unconfined' + RedundantSuspendModifier: + active: true + SleepInsteadOfDelay: + active: true + SuspendFunWithCoroutineScopeReceiver: + active: false + SuspendFunWithFlowReturnType: + active: true + +empty-blocks: + active: true + EmptyCatchBlock: + active: true + allowedExceptionNameRegex: '_|(ignore|expected).*' + EmptyClassBlock: + active: true + EmptyDefaultConstructor: + active: true + EmptyDoWhileBlock: + active: true + EmptyElseBlock: + active: true + EmptyFinallyBlock: + active: true + EmptyForBlock: + active: true + EmptyFunctionBlock: + active: true + ignoreOverridden: false + EmptyIfBlock: + active: true + EmptyInitBlock: + active: true + EmptyKtFile: + active: true + EmptySecondaryConstructor: + active: true + EmptyTryBlock: + active: true + EmptyWhenBlock: + active: true + EmptyWhileBlock: + active: true + +exceptions: + active: true + ExceptionRaisedInUnexpectedLocation: + active: true + methodNames: + - 'equals' + - 'finalize' + - 'hashCode' + - 'toString' + InstanceOfCheckForException: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + NotImplementedDeclaration: + active: false + ObjectExtendsThrowable: + active: false + PrintStackTrace: + active: true + RethrowCaughtException: + active: true + ReturnFromFinally: + active: true + ignoreLabeled: false + SwallowedException: + active: true + ignoredExceptionTypes: + - 'InterruptedException' + - 'MalformedURLException' + - 'NumberFormatException' + - 'ParseException' + allowedExceptionNameRegex: '_|(ignore|expected).*' + ThrowingExceptionFromFinally: + active: true + ThrowingExceptionInMain: + active: false + ThrowingExceptionsWithoutMessageOrCause: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + exceptions: + - 'ArrayIndexOutOfBoundsException' + - 'Exception' + - 'IllegalArgumentException' + - 'IllegalMonitorStateException' + - 'IllegalStateException' + - 'IndexOutOfBoundsException' + - 'NullPointerException' + - 'RuntimeException' + - 'Throwable' + ThrowingNewInstanceOfSameException: + active: true + TooGenericExceptionCaught: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + exceptionNames: + - 'ArrayIndexOutOfBoundsException' + - 'Error' + - 'Exception' + - 'IllegalMonitorStateException' + - 'IndexOutOfBoundsException' + - 'NullPointerException' + - 'RuntimeException' + - 'Throwable' + allowedExceptionNameRegex: '_|(ignore|expected).*' + TooGenericExceptionThrown: + active: true + exceptionNames: + - 'Error' + - 'Exception' + - 'RuntimeException' + - 'Throwable' + +naming: + active: true + BooleanPropertyNaming: + active: false + allowedPattern: '^(is|has|are)' + ignoreOverridden: true + ClassNaming: + active: true + classPattern: '[A-Z][a-zA-Z0-9]*' + ConstructorParameterNaming: + active: true + parameterPattern: '[a-z][A-Za-z0-9]*' + privateParameterPattern: '[a-z][A-Za-z0-9]*' + excludeClassPattern: '$^' + ignoreOverridden: true + EnumNaming: + active: true + enumEntryPattern: '[A-Z][_a-zA-Z0-9]*' + ForbiddenClassName: + active: false + forbiddenName: [] + FunctionMaxLength: + active: false + maximumFunctionNameLength: 30 + FunctionMinLength: + active: false + minimumFunctionNameLength: 3 + FunctionNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + functionPattern: '[a-z][a-zA-Z0-9]*' + excludeClassPattern: '$^' + ignoreOverridden: true + FunctionParameterNaming: + active: true + parameterPattern: '[a-z][A-Za-z0-9]*' + excludeClassPattern: '$^' + ignoreOverridden: true + InvalidPackageDeclaration: + active: true + rootPackage: '' + requireRootInDeclaration: false + LambdaParameterNaming: + active: false + parameterPattern: '[a-z][A-Za-z0-9]*|_' + MatchingDeclarationName: + active: true + mustBeFirst: true + MemberNameEqualsClassName: + active: true + ignoreOverridden: true + NoNameShadowing: + active: true + NonBooleanPropertyPrefixedWithIs: + active: false + ObjectPropertyNaming: + active: true + constantPattern: '[A-Za-z][_A-Za-z0-9]*' + propertyPattern: '[A-Za-z][_A-Za-z0-9]*' + privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*' + PackageNaming: + active: true + packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*' + TopLevelPropertyNaming: + active: true + constantPattern: '[A-Z][_A-Z0-9]*' + propertyPattern: '[A-Za-z][_A-Za-z0-9]*' + privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*' + VariableMaxLength: + active: false + maximumVariableNameLength: 64 + VariableMinLength: + active: false + minimumVariableNameLength: 1 + VariableNaming: + active: true + variablePattern: '[a-z][A-Za-z0-9]*' + privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' + excludeClassPattern: '$^' + ignoreOverridden: true + +performance: + active: true + ArrayPrimitive: + active: true + CouldBeSequence: + active: false + threshold: 3 + ForEachOnRange: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + SpreadOperator: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + UnnecessaryTemporaryInstantiation: + active: true + +potential-bugs: + active: true + AvoidReferentialEquality: + active: true + forbiddenTypePatterns: + - 'kotlin.String' + CastToNullableType: + active: false + Deprecation: + active: false + DontDowncastCollectionTypes: + active: false + DoubleMutabilityForCollection: + active: true + mutableTypes: + - 'kotlin.collections.MutableList' + - 'kotlin.collections.MutableMap' + - 'kotlin.collections.MutableSet' + - 'java.util.ArrayList' + - 'java.util.LinkedHashSet' + - 'java.util.HashSet' + - 'java.util.LinkedHashMap' + - 'java.util.HashMap' + DuplicateCaseInWhenExpression: + active: true + ElseCaseInsteadOfExhaustiveWhen: + active: false + EqualsAlwaysReturnsTrueOrFalse: + active: true + EqualsWithHashCodeExist: + active: true + ExitOutsideMain: + active: false + ExplicitGarbageCollectionCall: + active: true + HasPlatformType: + active: true + IgnoredReturnValue: + active: true + restrictToAnnotatedMethods: true + returnValueAnnotations: + - '*.CheckResult' + - '*.CheckReturnValue' + ignoreReturnValueAnnotations: + - '*.CanIgnoreReturnValue' + ignoreFunctionCall: [] + ImplicitDefaultLocale: + active: true + ImplicitUnitReturnType: + active: false + allowExplicitReturnType: true + InvalidRange: + active: true + IteratorHasNextCallsNextMethod: + active: true + IteratorNotThrowingNoSuchElementException: + active: true + LateinitUsage: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + ignoreOnClassesPattern: '' + MapGetWithNotNullAssertionOperator: + active: true + MissingPackageDeclaration: + active: false + excludes: ['**/*.kts'] + MissingWhenCase: + active: true + allowElseExpression: true + NullCheckOnMutableProperty: + active: false + NullableToStringCall: + active: false + RedundantElseInWhen: + active: true + UnconditionalJumpStatementInLoop: + active: false + UnnecessaryNotNullOperator: + active: true + UnnecessarySafeCall: + active: true + UnreachableCatchBlock: + active: true + UnreachableCode: + active: true + UnsafeCallOnNullableType: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + UnsafeCast: + active: true + UnusedUnaryOperator: + active: true + UselessPostfixExpression: + active: true + WrongEqualsTypeParameter: + active: true + +style: + active: true + CanBeNonNullable: + active: false + CascadingCallWrapping: + active: false + includeElvis: true + ClassOrdering: + active: false + CollapsibleIfStatements: + active: false + DataClassContainsFunctions: + active: false + conversionFunctionPrefix: 'to' + DataClassShouldBeImmutable: + active: false + DestructuringDeclarationWithTooManyEntries: + active: true + maxDestructuringEntries: 3 + EqualsNullCall: + active: true + EqualsOnSignatureLine: + active: false + ExplicitCollectionElementAccessMethod: + active: false + ExplicitItLambdaParameter: + active: true + ExpressionBodySyntax: + active: false + includeLineWrapping: false + ForbiddenComment: + active: true + values: + - 'FIXME:' + - 'STOPSHIP:' + - 'TODO:' + allowedPatterns: '' + customMessage: '' + ForbiddenImport: + active: false + imports: [] + forbiddenPatterns: '' + ForbiddenMethodCall: + active: false + methods: + - 'kotlin.io.print' + - 'kotlin.io.println' + ForbiddenPublicDataClass: + active: true + excludes: ['**'] + ignorePackages: + - '*.internal' + - '*.internal.*' + ForbiddenSuppress: + active: false + rules: [] + ForbiddenVoid: + active: true + ignoreOverridden: false + ignoreUsageInGenerics: false + FunctionOnlyReturningConstant: + active: true + ignoreOverridableFunction: true + ignoreActualFunction: true + excludedFunctions: '' + LibraryCodeMustSpecifyReturnType: + active: true + excludes: ['**'] + LibraryEntitiesShouldNotBePublic: + active: true + excludes: ['**'] + LoopWithTooManyJumpStatements: + active: true + maxJumpCount: 1 + MagicNumber: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**', '**/*.kts'] + ignoreNumbers: + - '-1' + - '0' + - '1' + - '2' + ignoreHashCodeFunction: true + ignorePropertyDeclaration: false + ignoreLocalVariableDeclaration: false + ignoreConstantDeclaration: true + ignoreCompanionObjectPropertyDeclaration: true + ignoreAnnotation: false + ignoreNamedArgument: true + ignoreEnums: false + ignoreRanges: false + ignoreExtensionFunctions: true + MandatoryBracesIfStatements: + active: false + MandatoryBracesLoops: + active: false + MaxChainedCallsOnSameLine: + active: false + maxChainedCalls: 5 + MaxLineLength: + active: true + maxLineLength: 120 + excludePackageStatements: true + excludeImportStatements: true + excludeCommentStatements: false + MayBeConst: + active: true + ModifierOrder: + active: true + MultilineLambdaItParameter: + active: false + NestedClassesVisibility: + active: true + NoTabs: + active: false + NullableBooleanCheck: + active: false + ObjectLiteralToLambda: + active: true + OptionalAbstractKeyword: + active: true + OptionalUnit: + active: false + OptionalWhenBraces: + active: false + PreferToOverPairSyntax: + active: false + ProtectedMemberInFinalClass: + active: true + RedundantExplicitType: + active: false + RedundantHigherOrderMapUsage: + active: true + RedundantVisibilityModifierRule: + active: false + ReturnCount: + active: true + max: 2 + excludedFunctions: 'equals' + excludeLabeled: false + excludeReturnFromLambda: true + excludeGuardClauses: false + SafeCast: + active: true + SerialVersionUIDInSerializableClass: + active: true + SpacingBetweenPackageAndImports: + active: false + ThrowsCount: + active: true + max: 2 + excludeGuardClauses: false + TrailingWhitespace: + active: false + UnderscoresInNumericLiterals: + active: false + acceptableLength: 4 + allowNonStandardGrouping: false + UnnecessaryAbstractClass: + active: true + UnnecessaryAnnotationUseSiteTarget: + active: false + UnnecessaryApply: + active: true + UnnecessaryBackticks: + active: false + UnnecessaryFilter: + active: true + UnnecessaryInheritance: + active: true + UnnecessaryInnerClass: + active: false + UnnecessaryLet: + active: false + UnnecessaryParentheses: + active: false + UntilInsteadOfRangeTo: + active: false + UnusedImports: + active: false + UnusedPrivateClass: + active: true + UnusedPrivateMember: + active: true + allowedNames: '(_|ignored|expected|serialVersionUID)' + UseAnyOrNoneInsteadOfFind: + active: true + UseArrayLiteralsInAnnotations: + active: true + UseCheckNotNull: + active: true + UseCheckOrError: + active: true + UseDataClass: + active: false + allowVars: false + UseEmptyCounterpart: + active: false + UseIfEmptyOrIfBlank: + active: false + UseIfInsteadOfWhen: + active: false + UseIsNullOrEmpty: + active: true + UseOrEmpty: + active: true + UseRequire: + active: true + UseRequireNotNull: + active: true + UselessCallOnNotNull: + active: true + UtilityClassWithPublicConstructor: + active: true + VarCouldBeVal: + active: true + ignoreLateinitVar: false + WildcardImport: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludeImports: + - 'java.util.*' From 1c27d1d835df9eac25e349c070206fd5826c4694 Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Fri, 19 Aug 2022 16:36:51 +0200 Subject: [PATCH 02/11] Fixing some issues --- README.md | 2 +- config/detekt/detekt.yml | 6 +++--- src/main/kotlin/nl/lengrand/pluckr/TreeController.kt | 8 +++++++- src/main/kotlin/nl/lengrand/pluckr/plugins/Routing.kt | 4 +++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1e54b17..976bd43 100644 --- a/README.md +++ b/README.md @@ -32,4 +32,4 @@ All rights reserved. ## Author -[Julien Lengrand-Lambert](https://twitter.com/jlengrand) \ No newline at end of file +[Julien Lengrand-Lambert](https://twitter.com/jlengrand) diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index 6b70b8d..ca57bb7 100644 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -1,5 +1,5 @@ build: - maxIssues: 0 + maxIssues: 10 excludeCorrectable: false weights: # complexity: 2 @@ -507,7 +507,7 @@ style: active: true maxJumpCount: 1 MagicNumber: - active: true + active: false excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**', '**/*.kts'] ignoreNumbers: - '-1' @@ -650,7 +650,7 @@ style: active: true ignoreLateinitVar: false WildcardImport: - active: true + active: false excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] excludeImports: - 'java.util.*' diff --git a/src/main/kotlin/nl/lengrand/pluckr/TreeController.kt b/src/main/kotlin/nl/lengrand/pluckr/TreeController.kt index d44e9a3..7cf4079 100644 --- a/src/main/kotlin/nl/lengrand/pluckr/TreeController.kt +++ b/src/main/kotlin/nl/lengrand/pluckr/TreeController.kt @@ -58,7 +58,13 @@ private fun ResultRow.toTree(): Tree { } private fun ResultRow.toUser(): User { - return User(this[Users.id], this[Users.username], this[Users.password], this[Users.createdAt].toKotlinLocalDateTime(), this[Users.updatedAt].toKotlinLocalDateTime()) + return User( + this[Users.id], + this[Users.username], + this[Users.password], + this[Users.createdAt].toKotlinLocalDateTime(), + this[Users.updatedAt].toKotlinLocalDateTime() + ) } class UserController(private val database: Database){ diff --git a/src/main/kotlin/nl/lengrand/pluckr/plugins/Routing.kt b/src/main/kotlin/nl/lengrand/pluckr/plugins/Routing.kt index c87cc9d..c0e20f9 100644 --- a/src/main/kotlin/nl/lengrand/pluckr/plugins/Routing.kt +++ b/src/main/kotlin/nl/lengrand/pluckr/plugins/Routing.kt @@ -31,7 +31,9 @@ fun Application.configureRouting(database: Database) { val formParameters = call.receiveParameters() try{ - val user = userController.getUser(formParameters["username"].toString(), formParameters["password"].toString()) + val user = userController.getUser( + formParameters["username"].toString(), + formParameters["password"].toString()) call.sessions.set(UserSession(user.username)) call.respondRedirect("/") } From aca80220c9b274e024545ef65cbd180cf04fd913 Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Sat, 20 Aug 2022 15:28:57 +0200 Subject: [PATCH 03/11] Adds frontend build --- .github/workflows/build-frontend.yml | 30 ++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 31 insertions(+) create mode 100644 .github/workflows/build-frontend.yml diff --git a/.github/workflows/build-frontend.yml b/.github/workflows/build-frontend.yml new file mode 100644 index 0000000..35455b7 --- /dev/null +++ b/.github/workflows/build-frontend.yml @@ -0,0 +1,30 @@ +name: Build frontend + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [17.x] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + working-directory: ./src/main/js/pluckr-app + - run: npm run build --if-present + working-directory: ./src/main/js/pluckr-app + - run: npm test + working-directory: ./src/main/js/pluckr-app diff --git a/README.md b/README.md index 976bd43..5ff8cc6 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ The project is in 3 separate pieces. You need to : * Automated deployment * Setup local and remote db * Build the freaking project +* How to see trends with Detekt? ## License From c944afa28e5dbf194571148ed3a5630dade9e545 Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Sat, 20 Aug 2022 15:33:54 +0200 Subject: [PATCH 04/11] package-lock not in main directory --- .github/workflows/build-frontend.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-frontend.yml b/.github/workflows/build-frontend.yml index 35455b7..d309750 100644 --- a/.github/workflows/build-frontend.yml +++ b/.github/workflows/build-frontend.yml @@ -22,6 +22,7 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' + cache-dependency-path: '**/package-lock.json' - run: npm ci working-directory: ./src/main/js/pluckr-app - run: npm run build --if-present From aa569c754f0d2905c4abc41612d9c536b15a8d79 Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Sat, 20 Aug 2022 15:40:14 +0200 Subject: [PATCH 05/11] No tests right now --- .github/workflows/build-frontend.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-frontend.yml b/.github/workflows/build-frontend.yml index d309750..5d5587d 100644 --- a/.github/workflows/build-frontend.yml +++ b/.github/workflows/build-frontend.yml @@ -27,5 +27,3 @@ jobs: working-directory: ./src/main/js/pluckr-app - run: npm run build --if-present working-directory: ./src/main/js/pluckr-app - - run: npm test - working-directory: ./src/main/js/pluckr-app From ba594b0b3b8541d05d547dc130deee33a0b652df Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Wed, 24 Aug 2022 22:06:29 +0200 Subject: [PATCH 06/11] First dummy unit test working --- build.gradle.kts | 4 +++- gradle.properties | 2 +- .../kotlin/nl/lengrand/pluckr/Application.kt | 19 ++++++++------- .../nl/lengrand/pluckr/TreeController.kt | 20 ++++++++-------- .../nl/lengrand/pluckr/plugins/Routing.kt | 23 +++++++++---------- .../nl/lengrand/pluckr/ApplicationTest.kt | 12 ++++++++++ 6 files changed, 48 insertions(+), 32 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2f0a823..228835f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -39,7 +39,6 @@ dependencies { implementation("io.ktor:ktor-server-call-logging:$ktor_version") implementation("io.ktor:ktor-server-metrics-micrometer:$ktor_version") implementation("io.ktor:ktor-server-cors:$ktor_version") - implementation("io.ktor:ktor-server-sessions:$ktor_version") implementation("io.ktor:ktor-server-auth:$ktor_version") implementation("org.mindrot:jbcrypt:0.4") @@ -52,7 +51,10 @@ dependencies { implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor_version") implementation("org.postgresql:postgresql:$postgresqlVersion") implementation("net.postgis:postgis-jdbc:$postgisVersion") + implementation("io.ktor:ktor-server-sessions-jvm:2.1.0") testImplementation("io.ktor:ktor-server-tests-jvm:$ktor_version") testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version") + testImplementation("org.jetbrains.kotlin:kotlin-test:$kotlin_version") + testImplementation("io.ktor:ktor-server-test-host-jvm:2.1.0") } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index dbedbb0..55f25a0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -ktor_version=2.0.3 +ktor_version=2.1.0 kotlin_version=1.7.0 logback_version=1.2.11 kotlin.code.style=official diff --git a/src/main/kotlin/nl/lengrand/pluckr/Application.kt b/src/main/kotlin/nl/lengrand/pluckr/Application.kt index c6ba48c..f7974cd 100644 --- a/src/main/kotlin/nl/lengrand/pluckr/Application.kt +++ b/src/main/kotlin/nl/lengrand/pluckr/Application.kt @@ -18,7 +18,7 @@ import org.jetbrains.exposed.sql.StdOutSqlLogger import org.jetbrains.exposed.sql.addLogger import org.jetbrains.exposed.sql.transactions.transaction -fun Application.myapp(){ +fun Application.module() { val database = initDb() @@ -33,9 +33,8 @@ fun Application.myapp(){ session("user_session") { println("validating session!") - validate { session -> - if(session.name.isNotEmpty()) { + if (session.name.isNotEmpty()) { println("Valid!") println(session) session @@ -53,7 +52,7 @@ fun Application.myapp(){ } // install(CORS) - install(ContentNegotiation){ + install(ContentNegotiation) { json(Json { prettyPrint = true isLenient = true @@ -65,8 +64,10 @@ fun Application.myapp(){ } fun initDb(): Database { - val database = Database.connect("jdbc:postgresql://localhost:5432/pluckr", driver = "org.postgresql.Driver", - user = "pluckr", password = System.getenv("PLUCKR_PASSWORD")) + val database = Database.connect( + "jdbc:postgresql://localhost:5432/pluckr", driver = "org.postgresql.Driver", + user = "pluckr", password = System.getenv("PLUCKR_PASSWORD") + ) transaction { addLogger(StdOutSqlLogger) @@ -78,8 +79,10 @@ fun initDb(): Database { fun main() { embeddedServer( Netty, - module = Application::myapp, port = 9090, - host = "0.0.0.0") + host = "0.0.0.0" + ){ + module() + } .start(wait = true) } diff --git a/src/main/kotlin/nl/lengrand/pluckr/TreeController.kt b/src/main/kotlin/nl/lengrand/pluckr/TreeController.kt index 7cf4079..6c8cfe7 100644 --- a/src/main/kotlin/nl/lengrand/pluckr/TreeController.kt +++ b/src/main/kotlin/nl/lengrand/pluckr/TreeController.kt @@ -32,7 +32,7 @@ data class Tree( val name: String, val description: String?, @Serializable(with = PointSerializer::class) - val location : Point + val location: Point ) @Serializable @@ -67,11 +67,11 @@ private fun ResultRow.toUser(): User { ) } -class UserController(private val database: Database){ +class UserController(private val database: Database) { fun createUser(email: String, zepassword: String) { val salt = gensalt() transaction(database) { - Users.insert { + Users.insert { it[username] = email it[password] = hashpw(zepassword, salt); } @@ -82,8 +82,8 @@ class UserController(private val database: Database){ Will throw NoSuchElementException if there are no results, or IllegalArgumentException if there are more than one */ private fun getUser(email: String): User { - val user = transaction(database) { - Users.select{ Users.username eq email}.single().toUser() + val user = transaction(database) { + Users.select { Users.username eq email }.single().toUser() } return user } @@ -96,17 +96,17 @@ class UserController(private val database: Database){ } class TreeController(private val database: Database) { - fun getTrees() : ArrayList { - val trees : ArrayList = arrayListOf() - transaction(database){ + fun getTrees(): ArrayList { + val trees: ArrayList = arrayListOf() + transaction(database) { Trees.selectAll().map { trees.add(it.toTree()) } } return trees } - fun getTrees(bbox: List?) : ArrayList { + fun getTrees(bbox: List?): ArrayList { return getTrees() } } -class AuthenticationException(message:String): Exception(message) +class AuthenticationException(message: String) : Exception(message) diff --git a/src/main/kotlin/nl/lengrand/pluckr/plugins/Routing.kt b/src/main/kotlin/nl/lengrand/pluckr/plugins/Routing.kt index c0e20f9..c17f11a 100644 --- a/src/main/kotlin/nl/lengrand/pluckr/plugins/Routing.kt +++ b/src/main/kotlin/nl/lengrand/pluckr/plugins/Routing.kt @@ -22,7 +22,7 @@ fun Application.configureRouting(database: Database) { routing { authenticate("user_session") { - get("/api/authenticated"){ + get("/api/authenticated") { call.respondText("Hello, ${call.principal()?.name}!") } } @@ -30,14 +30,14 @@ fun Application.configureRouting(database: Database) { post("/api/login") { val formParameters = call.receiveParameters() - try{ + try { val user = userController.getUser( formParameters["username"].toString(), - formParameters["password"].toString()) + formParameters["password"].toString() + ) call.sessions.set(UserSession(user.username)) call.respondRedirect("/") - } - catch(e: ExposedSQLException){ + } catch (e: ExposedSQLException) { call.response.status(HttpStatusCode(500, e.message!!)) } } @@ -47,16 +47,16 @@ fun Application.configureRouting(database: Database) { call.respondRedirect("/") } - post("/api/signup"){ + post("/api/signup") { val formParameters = call.receiveParameters() - try{ + try { userController.createUser(formParameters["username"].toString(), formParameters["password"].toString()) call.response.status(HttpStatusCode.OK) - } - catch(e: ExposedSQLException){ // TODO: Should I leak exceptions here? + } catch (e: ExposedSQLException) { // TODO: Should I leak exceptions here? val message = when (e.sqlState) { "23505" -> "User already exists" + else -> "Unknown error, please retry later" } @@ -65,11 +65,10 @@ fun Application.configureRouting(database: Database) { } get("/api/trees") { - if(call.request.queryParameters["bbox"] != null){ + if (call.request.queryParameters["bbox"] != null) { val bbox = call.request.queryParameters["bbox"]?.split(",")?.map { it.toDouble() } call.respond(treeController.getTrees(bbox)) - } - else{ + } else { call.respond(treeController.getTrees()) } } diff --git a/src/test/kotlin/nl/lengrand/pluckr/ApplicationTest.kt b/src/test/kotlin/nl/lengrand/pluckr/ApplicationTest.kt index 0821dd3..de5f699 100644 --- a/src/test/kotlin/nl/lengrand/pluckr/ApplicationTest.kt +++ b/src/test/kotlin/nl/lengrand/pluckr/ApplicationTest.kt @@ -1,5 +1,8 @@ package nl.lengrand.pluckr +import io.ktor.client.call.body +import io.ktor.client.request.* +import io.ktor.client.statement.* import io.ktor.server.routing.* import io.ktor.http.* import io.ktor.server.application.* @@ -10,4 +13,13 @@ import io.ktor.server.testing.* import nl.lengrand.pluckr.plugins.* class ApplicationTest { + @Test + fun testRoot() = testApplication { + application { + module() + } + val response = client.get("/api/hello") + assertEquals(HttpStatusCode.OK, response.status) + assertEquals("Hello the World!", response.bodyAsText()) + } } \ No newline at end of file From 1e1faee62ed2c39358a2cdc1a490521fed6bda8e Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Fri, 26 Aug 2022 16:19:25 +0200 Subject: [PATCH 07/11] Adds various confs for testing --- build.gradle.kts | 4 +- .../kotlin/nl/lengrand/pluckr/Application.kt | 47 ++++++++++++------- src/main/resources/application.conf | 16 +++++++ src/main/resources/application.dev.conf | 16 +++++++ src/main/resources/application.test.conf | 17 +++++++ 5 files changed, 82 insertions(+), 18 deletions(-) create mode 100644 src/main/resources/application.conf create mode 100644 src/main/resources/application.dev.conf create mode 100644 src/main/resources/application.test.conf diff --git a/build.gradle.kts b/build.gradle.kts index 228835f..792518e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -40,6 +40,7 @@ dependencies { implementation("io.ktor:ktor-server-metrics-micrometer:$ktor_version") implementation("io.ktor:ktor-server-cors:$ktor_version") implementation("io.ktor:ktor-server-auth:$ktor_version") + implementation("io.ktor:ktor-server-sessions-jvm:2.1.0") implementation("org.mindrot:jbcrypt:0.4") @@ -51,7 +52,8 @@ dependencies { implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor_version") implementation("org.postgresql:postgresql:$postgresqlVersion") implementation("net.postgis:postgis-jdbc:$postgisVersion") - implementation("io.ktor:ktor-server-sessions-jvm:2.1.0") + implementation("com.h2database:h2:2.1.214") + testImplementation("io.ktor:ktor-server-tests-jvm:$ktor_version") testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version") diff --git a/src/main/kotlin/nl/lengrand/pluckr/Application.kt b/src/main/kotlin/nl/lengrand/pluckr/Application.kt index f7974cd..7d73926 100644 --- a/src/main/kotlin/nl/lengrand/pluckr/Application.kt +++ b/src/main/kotlin/nl/lengrand/pluckr/Application.kt @@ -9,6 +9,7 @@ import io.ktor.server.netty.* import io.ktor.server.plugins.callloging.* import io.ktor.server.plugins.contentnegotiation.* import io.ktor.server.response.* +import io.ktor.server.routing.* import io.ktor.server.sessions.* import kotlinx.serialization.json.Json import nl.lengrand.pluckr.plugins.configureRouting @@ -19,8 +20,21 @@ import org.jetbrains.exposed.sql.addLogger import org.jetbrains.exposed.sql.transactions.transaction fun Application.module() { + val env = environment.config.propertyOrNull("ktor.environment")?.getString() + println("Running in the $env environment") - val database = initDb() + routing { + get("/api/environment") { + call.respondText(env?: "null") + } + } + + val database = initDb( + environment.config.property("ktor.database.url").getString(), + environment.config.property("ktor.database.driver").getString(), + environment.config.property("ktor.database.user").getString(), + environment.config.property("ktor.database.password").getString(), + ) install(Sessions) { cookie("user_session", SessionStorageMemory()) { @@ -63,26 +77,25 @@ fun Application.module() { configureRouting(database) } -fun initDb(): Database { - val database = Database.connect( - "jdbc:postgresql://localhost:5432/pluckr", driver = "org.postgresql.Driver", - user = "pluckr", password = System.getenv("PLUCKR_PASSWORD") - ) +fun initDb(url: String, driver: String, user: String, password: String): Database { + val database = Database.connect(url, driver, user , password ) - transaction { + transaction(database) { addLogger(StdOutSqlLogger) SchemaUtils.create(Trees, Users) } return database } -fun main() { - embeddedServer( - Netty, - port = 9090, - host = "0.0.0.0" - ){ - module() - } - .start(wait = true) -} +//fun main() { +// embeddedServer( +// Netty, +// port = 9090, +// host = "0.0.0.0" +// ){ +// module() +// } +// .start(wait = true) +//} + +fun main(args: Array): Unit = io.ktor.server.netty.EngineMain.main(args) diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf new file mode 100644 index 0000000..543f9fc --- /dev/null +++ b/src/main/resources/application.conf @@ -0,0 +1,16 @@ +ktor { + environment = test + + deployment { + port = 8080 + } + application { + modules = [ nl.lengrand.pluckr.ApplicationKt.module ] + } + database { + url = "jdbc:h2:mem:test" + driver = "org.h2.Driver" + user = "pluckr" + password = ${PLUCKR_PASSWORD} + } +} \ No newline at end of file diff --git a/src/main/resources/application.dev.conf b/src/main/resources/application.dev.conf new file mode 100644 index 0000000..e9a9a24 --- /dev/null +++ b/src/main/resources/application.dev.conf @@ -0,0 +1,16 @@ +ktor { + environment = dev + + deployment { + port = 8080 + } + application { + modules = [ nl.lengrand.pluckr.ApplicationKt.module ] + } + database{ + url = "jdbc:postgresql://localhost:5432/pluckr" + driver = "org.postgresql.Driver" + user = "pluckr" + password = ${PLUCKR_PASSWORD} + } +} \ No newline at end of file diff --git a/src/main/resources/application.test.conf b/src/main/resources/application.test.conf new file mode 100644 index 0000000..e8ae3e6 --- /dev/null +++ b/src/main/resources/application.test.conf @@ -0,0 +1,17 @@ +ktor { + environment = test + + deployment { + port = 8080 + } + application { + modules = [ nl.lengrand.pluckr.ApplicationKt.module ] + } + + database{ + url = "jdbc:h2:mem:test" + driver = "org.h2.Driver" + user = "pluckr" + password = ${PLUCKR_PASSWORD} + } +} \ No newline at end of file From 095d055785200b44fbba78956389ccbe74c0ab52 Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Mon, 29 Aug 2022 21:39:42 +0200 Subject: [PATCH 08/11] Adds kover --- build.gradle.kts | 2 +- .../js/pluckr-app/web-dev-server.config.mjs | 2 +- .../kotlin/nl/lengrand/pluckr/Application.kt | 23 ++++--------------- .../nl/lengrand/pluckr/ApplicationTest.kt | 13 +++-------- 4 files changed, 10 insertions(+), 30 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 792518e..797b31b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,8 +11,8 @@ plugins { kotlin("plugin.serialization") version "1.6.21" // Clean project -// id("org.jetbrains.kotlinx.kover") version "0.4.2" id("io.gitlab.arturbosch.detekt").version("1.21.0") + id("org.jetbrains.kotlinx.kover") version "0.4.2" } diff --git a/src/main/js/pluckr-app/web-dev-server.config.mjs b/src/main/js/pluckr-app/web-dev-server.config.mjs index 959af9c..d9d3efb 100644 --- a/src/main/js/pluckr-app/web-dev-server.config.mjs +++ b/src/main/js/pluckr-app/web-dev-server.config.mjs @@ -7,7 +7,7 @@ const hmr = process.argv.includes('--hmr'); export default /** @type {import('@web/dev-server').DevServerConfig} */ ({ middleware: [ proxy('/api', { - target: 'http://localhost:9090', + target: 'http://localhost:8080', }), ], diff --git a/src/main/kotlin/nl/lengrand/pluckr/Application.kt b/src/main/kotlin/nl/lengrand/pluckr/Application.kt index 7d73926..531a485 100644 --- a/src/main/kotlin/nl/lengrand/pluckr/Application.kt +++ b/src/main/kotlin/nl/lengrand/pluckr/Application.kt @@ -4,8 +4,6 @@ import UserSession import io.ktor.serialization.kotlinx.json.* import io.ktor.server.application.* import io.ktor.server.auth.* -import io.ktor.server.engine.* -import io.ktor.server.netty.* import io.ktor.server.plugins.callloging.* import io.ktor.server.plugins.contentnegotiation.* import io.ktor.server.response.* @@ -23,11 +21,11 @@ fun Application.module() { val env = environment.config.propertyOrNull("ktor.environment")?.getString() println("Running in the $env environment") - routing { - get("/api/environment") { - call.respondText(env?: "null") - } - } +// routing { +// get("/api/environment") { +// call.respondText(env?: "null") +// } +// } val database = initDb( environment.config.property("ktor.database.url").getString(), @@ -87,15 +85,4 @@ fun initDb(url: String, driver: String, user: String, password: String): Databas return database } -//fun main() { -// embeddedServer( -// Netty, -// port = 9090, -// host = "0.0.0.0" -// ){ -// module() -// } -// .start(wait = true) -//} - fun main(args: Array): Unit = io.ktor.server.netty.EngineMain.main(args) diff --git a/src/test/kotlin/nl/lengrand/pluckr/ApplicationTest.kt b/src/test/kotlin/nl/lengrand/pluckr/ApplicationTest.kt index de5f699..09da23a 100644 --- a/src/test/kotlin/nl/lengrand/pluckr/ApplicationTest.kt +++ b/src/test/kotlin/nl/lengrand/pluckr/ApplicationTest.kt @@ -1,23 +1,16 @@ package nl.lengrand.pluckr -import io.ktor.client.call.body import io.ktor.client.request.* import io.ktor.client.statement.* -import io.ktor.server.routing.* import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* -import io.ktor.server.request.* -import kotlin.test.* import io.ktor.server.testing.* -import nl.lengrand.pluckr.plugins.* +import kotlin.test.Test +import kotlin.test.assertEquals class ApplicationTest { @Test fun testRoot() = testApplication { - application { - module() - } + application {} val response = client.get("/api/hello") assertEquals(HttpStatusCode.OK, response.status) assertEquals("Hello the World!", response.bodyAsText()) From 6333ee8c587ed968f9a235d177a91c00a0e7061c Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Mon, 29 Aug 2022 21:50:16 +0200 Subject: [PATCH 09/11] WTF Bro --- .github/workflows/build-backend.yml | 2 +- src/main/kotlin/nl/lengrand/pluckr/Application.kt | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-backend.yml b/.github/workflows/build-backend.yml index e41354d..890fb68 100644 --- a/.github/workflows/build-backend.yml +++ b/.github/workflows/build-backend.yml @@ -26,6 +26,6 @@ jobs: with: arguments: build - name: Upload coverage reports - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: files: build/reports/kover/report.xml \ No newline at end of file diff --git a/src/main/kotlin/nl/lengrand/pluckr/Application.kt b/src/main/kotlin/nl/lengrand/pluckr/Application.kt index 531a485..436392f 100644 --- a/src/main/kotlin/nl/lengrand/pluckr/Application.kt +++ b/src/main/kotlin/nl/lengrand/pluckr/Application.kt @@ -21,11 +21,11 @@ fun Application.module() { val env = environment.config.propertyOrNull("ktor.environment")?.getString() println("Running in the $env environment") -// routing { -// get("/api/environment") { -// call.respondText(env?: "null") -// } -// } + routing { + get("/api/environment") { + call.respondText(env?: "null") + } + } val database = initDb( environment.config.property("ktor.database.url").getString(), From dcb6ed7bf4de59915f62ae141a3487e256d817a1 Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Mon, 29 Aug 2022 22:04:50 +0200 Subject: [PATCH 10/11] Creates environment --- .github/workflows/build-backend.yml | 1 + .github/workflows/build-frontend.yml | 1 + README.md | 6 +++--- src/main/resources/application.test.conf | 1 - 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-backend.yml b/.github/workflows/build-backend.yml index 890fb68..9742b1c 100644 --- a/.github/workflows/build-backend.yml +++ b/.github/workflows/build-backend.yml @@ -13,6 +13,7 @@ jobs: build: runs-on: ubuntu-latest + environment: test steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/build-frontend.yml b/.github/workflows/build-frontend.yml index 5d5587d..a2fcc05 100644 --- a/.github/workflows/build-frontend.yml +++ b/.github/workflows/build-frontend.yml @@ -10,6 +10,7 @@ jobs: build: runs-on: ubuntu-latest + environment: test strategy: matrix: diff --git a/README.md b/README.md index 5ff8cc6..ba7aa4c 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,11 @@ The frontend is buildt with [Open-WC](https://open-wc.org/), [Lit](http://lit.de The project is in 3 separate pieces. You need to : * Fire up a PostgreSQL database, I use a local Docker image for the moment - * Fire the backend. You do this using `./gradlew run`. + * By default, the app will run with a H2 in memory database. Change the config file to run another configuration + * ( ex: `$./gradlew run --args="-config=src/main/resources/application.test.conf`) * Fire the frontend. It is located in `src/js/pluckr-app`. Run `npm install` and then `npm start` - ## TODOs * Adds tests and install [Kover](https://lengrand.fr/kover-code-coverage-plugin-for-kotlin/) @@ -28,7 +28,7 @@ The project is in 3 separate pieces. You need to : ## License -This is a personal project, you may do anything with it without my permission 😊. +This is a personal project, you may not do anything with it without my permission 😊. All rights reserved. ## Author diff --git a/src/main/resources/application.test.conf b/src/main/resources/application.test.conf index e8ae3e6..d9707bb 100644 --- a/src/main/resources/application.test.conf +++ b/src/main/resources/application.test.conf @@ -7,7 +7,6 @@ ktor { application { modules = [ nl.lengrand.pluckr.ApplicationKt.module ] } - database{ url = "jdbc:h2:mem:test" driver = "org.h2.Driver" From 44d8c37367da952f9312b247d5fc3a2a85437920 Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Mon, 29 Aug 2022 22:13:06 +0200 Subject: [PATCH 11/11] TESTEWFAWERGWRTHSDRTBSBDRSTHBSGF --- .github/workflows/build-backend.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-backend.yml b/.github/workflows/build-backend.yml index 9742b1c..a698b57 100644 --- a/.github/workflows/build-backend.yml +++ b/.github/workflows/build-backend.yml @@ -26,6 +26,8 @@ jobs: uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 with: arguments: build + env: + PLUCKR_PASSWORD: ${{ secrets.PLUCKR_PASSWORD }} - name: Upload coverage reports uses: codecov/codecov-action@v3 with: