Skip to content

Commit

Permalink
#62 [ENV] Github action CI 환경설정 (#66)
Browse files Browse the repository at this point in the history
## ☀️ 작업 사항
- ci_dev.yml 설정
- asciidoctor plugin이 deprecated되어 gradle 8.0 이상에서 빌드 안되는 에러 해결

## ☀️ 참고 사항
spring rest docs를 현재 사용중이지 않고 build 시 directory가 없어 에러가 발생하는데, 해결하는데 시간이
걸릴 것 같아 주석처리하였습니다. 주요 기능 개발이 끝난 후에 다시 개발하겠습니다.
  • Loading branch information
hye-on authored Oct 19, 2023
2 parents af51427 + 43c0ab6 commit 9c357a2
Show file tree
Hide file tree
Showing 4 changed files with 353 additions and 614 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: TogetUp-Server-Dev CI

on:
pull_request:
branches: [ "main" ]
push:
branches: [ "main", "env/CICD" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:

- name: checkout
uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'

- name: make application.properties
run: |
## create application.yml
mkdir -p ./src/main/resources
cd ./src/main/resources
touch ./application.yaml
echo "${{ secrets.TOGETUP_PROD_APPLICATION }}" >> ./application.yaml
cat ./application.yaml
shell: bash


- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build -x test
76 changes: 39 additions & 37 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ plugins {
id 'java'
id 'org.springframework.boot' version '2.7.10'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id "org.asciidoctor.jvm.convert" version "3.3.2"
// id("org.asciidoctor.jvm.convert") version "4.0.0-alpha.1"
// id "org.asciidoctor.jvm.convert" version "3.3.2"
}

group = 'com.jogijo'
Expand All @@ -11,12 +12,12 @@ sourceCompatibility = '11'

compileJava.options.encoding = 'UTF-8'

configurations {
asciidoctorExt
compileOnly {
extendsFrom annotationProcessor
}
}
//configurations {
// asciidoctorExt
// compileOnly {
// extendsFrom annotationProcessor
// }
//}

repositories {
mavenCentral()
Expand Down Expand Up @@ -45,6 +46,7 @@ dependencies {
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.4.Final'
testAnnotationProcessor("org.mapstruct:mapstruct-processor:1.5.3.Final")
implementation("org.projectlombok:lombok-mapstruct-binding:0.2.0")

// security
implementation('org.springframework.boot:spring-boot-starter-security')

Expand Down Expand Up @@ -76,9 +78,9 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'

// Spring Rest Docs
asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor'
// asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor'
// testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
// asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor'

//chat
implementation 'org.webjars:sockjs-client:1.1.2'
Expand Down Expand Up @@ -124,33 +126,33 @@ test {
useJUnitPlatform()
}

asciidoctor {
inputs.dir snippetsDir
configurations 'asciidoctorExt'
dependsOn test
attributes 'encoding': 'UTF-8'
attributes 'source-highlighter': 'highlightjs' // 선택적으로 하이라이팅 스타일 지정
}

task copyDocument(type: Copy) {
dependsOn asciidoctor
doFirst{
delete file('src/main/resources/static/docs')
}
from file("build/docs/asciidoc")
into file("src/main/resources/static/docs")
}

build {
dependsOn copyDocument
}

bootJar {
dependsOn asciidoctor
from ("${asciidoctor.outputDir}/html5") {
into 'static/docs'
}
}
//asciidoctor {
// inputs.dir snippetsDir
// configurations 'asciidoctorExt'
// dependsOn test
// attributes 'encoding': 'UTF-8'
// attributes 'source-highlighter': 'highlightjs' // 선택적으로 하이라이팅 스타일 지정
//}
//
//task copyDocument(type: Copy) {
// dependsOn asciidoctor
// doFirst{
// delete file('src/main/resources/static/docs')
// }
// from file("build/docs/asciidoc")
// into file("src/main/resources/static/docs")
//}
//
//build {
// dependsOn copyDocument
//}
//
//bootJar {
// dependsOn asciidoctor
// from ("${asciidoctor.outputDir}/html5") {
// into 'static/docs'
// }
//}

gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
Expand Down
Loading

0 comments on commit 9c357a2

Please sign in to comment.