-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
047cad0
commit 32d230d
Showing
12 changed files
with
412 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: "Code Scanning" | ||
|
||
on: [push, pull_request] | ||
|
||
env: | ||
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx6g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" | ||
|
||
jobs: | ||
build: | ||
runs-on: 'ubuntu-latest' | ||
|
||
env: | ||
JWT_SECRET: ${{ secrets.JWT_SECRET }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: 19 | ||
|
||
- name: Build | ||
uses: gradle/gradle-build-action@v3 | ||
with: | ||
arguments: build --full-stacktrace | ||
|
||
- name: Upload reports | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: 'reports-${{ matrix.os }}' | ||
path: '**/build/reports/**' | ||
|
||
- name: Upload Code Scanning code analysis report | ||
if: always() | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: 'build/reports/detekt/main.sarif' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: kotlin_lint | ||
name: "Kotlin Lint Checks" | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.api.routes | ||
|
||
import io.ktor.server.application.call | ||
import io.ktor.server.response.respondText | ||
import io.ktor.server.routing.Route | ||
import io.ktor.server.routing.get | ||
|
||
fun Route.ServerRoutes() { | ||
get("/") { | ||
call.respondText("Server is Running!") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
package com | ||
|
||
import com.plugins.configureRouting | ||
import com.api.routes.ServerRoutes | ||
import io.ktor.client.request.get | ||
import io.ktor.client.statement.bodyAsText | ||
import io.ktor.http.HttpStatusCode | ||
import io.ktor.server.config.MapApplicationConfig | ||
import io.ktor.server.testing.testApplication | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class ApplicationTest { | ||
@Test | ||
fun testRoot() = testApplication { | ||
application { | ||
configureRouting() | ||
routing { | ||
ServerRoutes() | ||
} | ||
environment { | ||
config = MapApplicationConfig("JWT_SECRET" to "TEST_SECRET_KEY") | ||
} | ||
client.get("/").apply { | ||
assertEquals(HttpStatusCode.OK, status) | ||
assertEquals("Hello World!", bodyAsText()) | ||
assertEquals("Server is Running!", bodyAsText()) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.api | ||
|
||
import com.plugins.configureSerialization | ||
import io.ktor.server.config.MapApplicationConfig | ||
import io.ktor.server.testing.ApplicationTestBuilder | ||
|
||
fun ApplicationTestBuilder.configureServer() { | ||
application { | ||
configureSerialization() | ||
} | ||
environment { | ||
config = MapApplicationConfig( | ||
"jwt.issuer" to "http://0.0.0.0:8080", | ||
"jwt.audience" to "users", | ||
"jwt.realm" to "ktor starter app", | ||
"JWT_SECRET" to "TEST_SECRET_KEY" | ||
) | ||
} | ||
} |
Oops, something went wrong.