Skip to content

Commit

Permalink
Merge branch 'dev' into feat/#450_belljun3395
Browse files Browse the repository at this point in the history
  • Loading branch information
belljun3395 authored Dec 21, 2024
2 parents b108873 + 3a01e71 commit 67d503e
Show file tree
Hide file tree
Showing 30 changed files with 186 additions and 26 deletions.
56 changes: 31 additions & 25 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Publish Dokka Documentation
name: Build and Publish Allure Documentation

on:
pull_request:
Expand All @@ -8,40 +8,46 @@ on:
permissions: write-all

jobs:
dokka:
docs:
runs-on: ubuntu-latest
steps:
# 1. Checkout the code
- uses: actions/checkout@v4

# 2. Set up JDK
- name: Set up JDK
uses: actions/setup-java@v4
- name: Set up JDK 18
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17
java-version: '18'
distribution: 'temurin'

# 3. Run dokkaHtmlMultiModule
- name: Generate Dokka Documentation
run: ./gradlew dokkaHtmlMultiModule
- name: Grant execute permission for gradlew
run: chmod +x gradlew

# 4. Checkout gh-pages branch to publish documentation
- name: Checkout gh-pages
uses: actions/checkout@v4
- name: Jooq Code Generation
run: |
./gradlew jooqCodegenAll
- name: Generate Allure Results
run: ./gradlew api:test

- name: Load test report history
uses: actions/checkout@v3
if: always()
continue-on-error: true
with:
ref: gh-pages # Use the `gh-pages` branch
path: gh-pages # Specify the path where `gh-pages` branch will be checked out
ref: gh-pages
path: gh-pages

# 5. Copy generated documentation to gh-pages directory
- name: Copy Dokka Documentation
run: |
rm -rf gh-pages/* # Clear existing files
cp -R build/dokka/htmlMultiModule/* gh-pages/ # Copy the newly generated documentation
- name: Build test report
uses: simple-elf/[email protected]
if: always()
with:
gh_pages: gh-pages
allure_history: allure-history
allure_results: api/build/allure-results

# 6. Publish documentation to GitHub Pages
- name: Publish Documentation
uses: peaceiris/actions-gh-pages@v4
- name: Publish test report
uses: peaceiris/actions-gh-pages@v3
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: gh-pages
publish_dir: allure-history
9 changes: 9 additions & 0 deletions api/src/test/kotlin/com/few/api/config/AllureKoTestConfig.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.few.api.config

import io.kotest.core.config.AbstractProjectConfig
import io.kotest.core.extensions.Extension
import io.kotest.extensions.allure.AllureTestReporter

class AllureKoTestConfig : AbstractProjectConfig() {
override fun extensions(): List<Extension> = listOf(AllureTestReporter())
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.few.api.domain.workbook.article.usecase.ReadWorkBookArticleUseCase
import com.few.api.domain.workbook.controller.WorkBookController
import com.few.api.domain.workbook.usecase.BrowseWorkbooksUseCase
import com.few.api.domain.workbook.usecase.ReadWorkbookUseCase
import io.qameta.allure.Epic
import org.junit.jupiter.api.extension.ExtendWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs
Expand All @@ -41,6 +42,7 @@ import security.TokenResolver
import security.config.SecurityConfig
import web.config.WebConfig

@Epic("V1.0 API")
@ActiveProfiles(value = ["test", "new"])
@AutoConfigureRestDocs
@AutoConfigureMockMvc(addFilters = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import com.few.api.config.web.controller.ApiControllerTestSpec
import com.few.api.domain.admin.controller.request.*
import com.few.api.domain.admin.usecase.dto.*
import com.few.api.domain.common.vo.CategoryType
import io.qameta.allure.Feature
import io.qameta.allure.Story
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import org.mockito.Mockito.doNothing
Expand All @@ -23,6 +25,7 @@ import web.helper.*
import java.net.URL
import java.util.stream.IntStream

@Feature("Admin API")
class AdminApiControllerTest : ApiControllerTestSpec() {
companion object {
private const val BASE_URL = "/api/v1/admin"
Expand All @@ -31,6 +34,7 @@ class AdminApiControllerTest : ApiControllerTestSpec() {

@Test
@DisplayName("[POST] /api/v1/admin/workbooks")
@Story("[POST] /api/v1/admin/workbooks")
fun addWorkbook() {
// given
val api = "AddWorkbook"
Expand Down Expand Up @@ -85,6 +89,7 @@ class AdminApiControllerTest : ApiControllerTestSpec() {

@Test
@DisplayName("[POST] /api/v1/admin/articles")
@Story("[POST] /api/v1/admin/articles")
fun addArticle() {
// given
val api = "AddArticle"
Expand Down Expand Up @@ -182,6 +187,7 @@ class AdminApiControllerTest : ApiControllerTestSpec() {

@Test
@DisplayName("[POST] /api/v1/admin/relations/articles")
@Story("[POST] /api/v1/admin/relations/articles")
fun mapArticle() {
// given
val api = "MapArticle"
Expand Down Expand Up @@ -230,6 +236,7 @@ class AdminApiControllerTest : ApiControllerTestSpec() {

@Test
@DisplayName("[POST] /api/v1/admin/utilities/conversion/content")
@Story("[POST] /api/v1/admin/utilities/conversion/content")
fun convertContent() {
// given
val api = "ConvertContent"
Expand Down Expand Up @@ -281,6 +288,7 @@ class AdminApiControllerTest : ApiControllerTestSpec() {

@Test
@DisplayName("[POST] /api/v1/utilities/conversion/image")
@Story("[POST] /api/v1/utilities/conversion/image")
fun putImage() {
// given
val api = "PutImage"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import com.epages.restdocs.apispec.Schema
import com.few.api.config.web.controller.ApiControllerTestSpec
import com.few.api.domain.article.usecase.dto.*
import com.few.api.domain.common.vo.CategoryType
import io.qameta.allure.Feature
import io.qameta.allure.Story
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
Expand All @@ -21,6 +23,7 @@ import java.net.URL
import java.time.LocalDateTime
import java.util.stream.IntStream

@Feature("Article API")
class ArticleApiControllerTest : ApiControllerTestSpec() {
companion object {
private const val BASE_URL = "/api/v1/articles"
Expand All @@ -32,6 +35,7 @@ class ArticleApiControllerTest : ApiControllerTestSpec() {
*/
@Test
@DisplayName("[GET] /api/v1/articles/{articleId}")
@Story("[GET] /api/v1/articles/{articleId}")
fun readArticle() {
// given
val api = "ReadArticle"
Expand Down Expand Up @@ -122,6 +126,7 @@ class ArticleApiControllerTest : ApiControllerTestSpec() {

@Test
@DisplayName("[GET] /api/v1/articles?prevArticleId={optional}?categoryCd={optional}")
@Story("[GET] /api/v1/articles?prevArticleId={optional}?categoryCd={optional}")
fun readArticles() {
// given
val api = "ReadArticles"
Expand Down Expand Up @@ -224,6 +229,7 @@ class ArticleApiControllerTest : ApiControllerTestSpec() {

@Test
@DisplayName("[GET] /api/v1/articles/categories")
@Story("[GET] /api/v1/articles/categories")
fun browseArticleCategories() {
// given
val api = "browseArticleCategories"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@ import io.kotest.assertions.throwables.shouldThrow
import io.kotest.core.spec.style.BehaviorSpec
import io.kotest.matchers.shouldBe
import io.mockk.*
import io.qameta.allure.Epic
import io.qameta.allure.Feature
import io.qameta.allure.Story
import org.springframework.context.ApplicationEventPublisher
import java.net.URL
import java.time.LocalDateTime

@Epic("V1.0 UseCase")
@Feature("Article")
@Story("ReadArticle")
class ReadArticleUseCaseTest :
BehaviorSpec({
val log = KotlinLogging.logger {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import com.epages.restdocs.apispec.Schema
import com.few.api.config.web.controller.ApiControllerTestSpec
import com.few.api.domain.log.controller.request.ApiLogRequest
import com.few.api.domain.log.dto.AddApiLogUseCaseIn
import io.qameta.allure.Feature
import io.qameta.allure.Story
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import org.mockito.Mockito
Expand All @@ -18,6 +20,7 @@ import web.helper.toIdentifier
import web.helper.toRequestSchema
import web.helper.toResponseSchema

@Feature("API Log API")
class ApiLogApiControllerTest : ApiControllerTestSpec() {
companion object {
private const val BASE_URL = "/api/v1/logs"
Expand All @@ -26,6 +29,7 @@ class ApiLogApiControllerTest : ApiControllerTestSpec() {

@Test
@DisplayName("[POST] /api/v1/logs")
@Story("[POST] /api/v1/logs")
fun addApiLog() {
// Given
val api = "addApiLog"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import com.few.api.domain.member.usecase.dto.SaveMemberUseCaseIn
import com.few.api.domain.member.usecase.dto.SaveMemberUseCaseOut
import com.few.api.domain.member.usecase.dto.TokenUseCaseIn
import com.few.api.domain.member.usecase.dto.TokenUseCaseOut
import io.qameta.allure.Feature
import io.qameta.allure.Story
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
Expand All @@ -23,6 +25,7 @@ import web.description.Description
import web.helper.*

@Suppress("ktlint:standard:property-naming", "ktlint:standard:max-line-length")
@Feature("Member API")
class MemberApiControllerTest : ApiControllerTestSpec() {
companion object {
private const val BASE_URL = "/api/v1/members"
Expand All @@ -31,6 +34,7 @@ class MemberApiControllerTest : ApiControllerTestSpec() {

@Test
@DisplayName("[POST] /api/v1/members")
@Story("[POST] /api/v1/members")
fun saveMember() {
// given
val api = "SaveMember"
Expand Down Expand Up @@ -80,6 +84,7 @@ class MemberApiControllerTest : ApiControllerTestSpec() {

@Test
@DisplayName("[POST] /api/v1/members/token")
@Story("[POST] /api/v1/members/token")
fun token() {
// given
val api = "Token"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ import io.kotest.matchers.shouldBe
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import io.qameta.allure.Epic
import io.qameta.allure.Feature
import io.qameta.allure.Story
import org.mockito.ArgumentMatchers.any
import security.encryptor.IdEncryptor

@Epic("V1.0 UseCase")
@Feature("Member")
@Story("SaveMember")
class SaveMemberUseCaseTest :
BehaviorSpec({
lateinit var memberDao: MemberDao
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@ import io.kotest.matchers.shouldBe
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import io.qameta.allure.Epic
import io.qameta.allure.Feature
import io.qameta.allure.Story
import security.AuthToken
import security.TokenGenerator
import security.TokenResolver
import security.encryptor.IdEncryptor

@Epic("V1.0 UseCase")
@Feature("Member")
@Story("Token")
class TokenUseCaseTest :
BehaviorSpec({
lateinit var tokenGenerator: TokenGenerator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import com.epages.restdocs.apispec.Schema
import com.few.api.config.web.controller.ApiControllerTestSpec
import com.few.api.domain.problem.controller.request.CheckProblemRequest
import com.few.api.domain.problem.usecase.dto.*
import io.qameta.allure.Feature
import io.qameta.allure.Story
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
Expand All @@ -20,6 +22,7 @@ import web.description.Description
import web.helper.*

@Suppress("ktlint:standard:max-line-length")
@Feature("Problem API")
class ProblemApiControllerTest : ApiControllerTestSpec() {
companion object {
private const val BASE_URL = "/api/v1/problems"
Expand All @@ -28,6 +31,7 @@ class ProblemApiControllerTest : ApiControllerTestSpec() {

@Test
@DisplayName("[GET] /api/v1/problems?articleId=")
@Story("[GET] /api/v1/problems?articleId=")
fun browseProblems() {
// given
val api = "BrowseProblems"
Expand Down Expand Up @@ -78,6 +82,7 @@ class ProblemApiControllerTest : ApiControllerTestSpec() {

@Test
@DisplayName("[GET] /api/v1/problems/{problemId}")
@Story("[GET] /api/v1/problems/{problemId}")
fun readProblem() {
// given
val api = "ReadProblem"
Expand Down Expand Up @@ -144,6 +149,7 @@ class ProblemApiControllerTest : ApiControllerTestSpec() {

@Test
@DisplayName("[POST] /api/v1/problems/{problemId}")
@Story("[POST] /api/v1/problems/{problemId}")
fun checkProblem() {
// given
val api = "CheckProblem"
Expand Down Expand Up @@ -203,6 +209,7 @@ class ProblemApiControllerTest : ApiControllerTestSpec() {

@Test
@DisplayName("[GET] /api/v1/problems/unsubmitted")
@Story("[GET] /api/v1/problems/unsubmitted")
fun browseUndoneProblems() {
// given
val api = "BrowseUndoneProblems"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ import io.kotest.matchers.shouldBe
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import io.qameta.allure.Epic
import io.qameta.allure.Feature
import io.qameta.allure.Story

@Epic("V1.0 UseCase")
@Feature("Problem")
@Story("BrowseProblems")
class BrowseProblemsUseCaseTest :
BehaviorSpec({

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ import io.kotest.core.spec.style.BehaviorSpec
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import io.qameta.allure.Epic
import io.qameta.allure.Feature
import io.qameta.allure.Story

@Epic("V1.0 UseCase")
@Feature("Problem")
@Story("BrowseUndoneProblems")
class BrowseUndoneProblemsUseCaseTest :
BehaviorSpec({
lateinit var problemDao: ProblemDao
Expand Down
Loading

0 comments on commit 67d503e

Please sign in to comment.