Skip to content

Commit

Permalink
Merge pull request #304 from woowacourse-teams/develop
Browse files Browse the repository at this point in the history
레벨3 결과물
  • Loading branch information
verus-j authored Aug 18, 2022
2 parents 26d6720 + 157486a commit 64f8490
Show file tree
Hide file tree
Showing 479 changed files with 22,771 additions and 9,847 deletions.
49 changes: 32 additions & 17 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,53 @@
name: backend
name: backend

on:
on:
push:
branches:
- main
pull_request:
paths:
- "backend/**"
branches:
- main
- develop
types: [opened, synchronize]

defaults:
run:
working-directory: backend
working-directory: backend

jobs:
build:
runs-on: ubuntu-latest
steps:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_PROJECT_KEY: moamoa
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
client-id: ${{ secrets.CLIENT_ID }}
client-secret: ${{ secrets.CLIENT_SECRET }}
jwt-secret-key: ${{ secrets.JWT_SECRET_KEY }}
jwt-expire-length: ${{ secrets.JWT_EXPIRE_LENGTH }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v3

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

- name: Build
run: ./gradlew build --exclude-task test --exclude-task asciidoctor

- name: Test
env:
client-id: ${{ secrets.CLIENT_ID }}
client-secret: ${{ secrets.CLIENT_SECRET }}
jwt-secret-key: ${{ secrets.JWT_SECRET_KEY }}
jwt-expire-length: ${{ secrets.JWT_EXPIRE_LENGTH }}
run: ./gradlew test -Doauth2.github.client-id=${{ env.client-id }} -Doauth2.github.client-secret=${{ env.client-secret }} -Dsecurity.jwt.token.secret-key=${{ env.jwt-secret-key }} -Dsecurity.jwt.token.expire-length=${{ env.jwt-expire-length }}
- name: Test
run: ./gradlew test -Dmoamoa.allow-origins='*' -Doauth2.github.client-id=${{ env.client-id }} -Doauth2.github.client-secret=${{ env.client-secret }} -Dsecurity.jwt.token.secret-key=${{ env.jwt-secret-key }} -Dsecurity.jwt.token.expire-length=${{ env.jwt-expire-length }}

- name: SonarQube
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: ./gradlew sonarqube --info
18 changes: 17 additions & 1 deletion .github/workflows/deploy-backend-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ name: Deploy Backend Dev
on:
push:
branches : develop
paths:
- 'backend/**'

defaults:
run:
Expand Down Expand Up @@ -37,7 +39,21 @@ jobs:
client-secret: ${{ secrets.CLIENT_SECRET }}
jwt-secret-key: ${{ secrets.JWT_SECRET_KEY }}
jwt-expire-length: ${{ secrets.JWT_EXPIRE_LENGTH }}
run: ./gradlew test -Doauth2.github.client-id=${{ env.client-id }} -Doauth2.github.client-secret=${{ env.client-secret }} -Dsecurity.jwt.token.secret-key=${{ env.jwt-secret-key }} -Dsecurity.jwt.token.expire-length=${{ env.jwt-expire-length }}
run: ./gradlew test -Dmoamoa.allow-origins='*' -Doauth2.github.client-id=${{ env.client-id }} -Doauth2.github.client-secret=${{ env.client-secret }} -Dsecurity.jwt.token.secret-key=${{ env.jwt-secret-key }} -Dsecurity.jwt.token.expire-length=${{ env.jwt-expire-length }}

- name: SonarQube
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: ./gradlew sonarqube --info

- name: SonarQube
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: ./gradlew sonarqube --info

- name : Deploy
run: |
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/deploy-frontend-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: Deploy Frontend Dev
on:
push:
branches: ["develop"]

paths:
- 'frontend/**'

defaults:
run:
working-directory: frontend
Expand Down Expand Up @@ -32,7 +34,8 @@ jobs:
- name: Build
run: npm run build-dev

- uses: cypress-io/github-action@v2
- name: Test
uses: cypress-io/github-action@v2
with:
start: npm run start
wait-on: "http://localhost:3000"
Expand Down
41 changes: 25 additions & 16 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,42 @@ name: frontend

on:
pull_request:
branches: [ "main", "develop" ]
branches: ["main", "develop"]
paths:
- 'frontend/**'

defaults:
run:
working-directory: frontend

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.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'
cache-dependency-path: "./frontend/package-lock.json"

- name: Install
run: npm install

- name: Build
run: npm run build
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "./frontend/package-lock.json"

- name: Install
run: npm install

- name: Build
run: npm run build

- name: Test
uses: cypress-io/github-action@v2
with:
start: npm run start
wait-on: "http://localhost:3000"
working-directory: frontend
config-file: cypress.config.ts
30 changes: 30 additions & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ plugins {
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'org.asciidoctor.jvm.convert' version "3.3.2"
id "org.sonarqube" version "3.4.0.2513"
id 'jacoco'
}

group = 'com.woowacourse'
Expand Down Expand Up @@ -39,6 +41,8 @@ dependencies {

asciidoctorExtensions 'org.springframework.restdocs:spring-restdocs-asciidoctor'
testImplementation 'org.springframework.restdocs:spring-restdocs-restassured'

implementation 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3'
}

ext {
Expand All @@ -50,6 +54,19 @@ tasks.named('test') {
useJUnitPlatform()
systemProperties = System.getProperties()
finalizedBy 'asciidoctor'
finalizedBy 'jacocoTestReport'
}

jacoco {
toolVersion = "0.8.7"
}

jacocoTestReport {
reports {
xml.enabled true
csv.enabled true
html.enabled true
}
}

asciidoctor.doFirst {
Expand Down Expand Up @@ -79,3 +96,16 @@ task moveDocument(type: Copy) {
bootJar {
dependsOn moveDocument
}

sonarqube {
properties {
property "sonar.projectKey", "woowacourse-teams_2022-moamoa_AYKvd_z4VbW_bWBvgn13"
property "sonar.sources", "src"
property "sonar.language", "java"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.profile", "moamoa"
property "sonar.java.binaries", "${buildDir}/classes"
property "sonar.test.inclusions", "**/*Test.java"
property "sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
}
}
45 changes: 45 additions & 0 deletions backend/src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
=== Github 로그인
operation::auth/login[snippets='http-request,request-parameters,http-response,response-fields']

=== 리프래시 토큰
operation::auth/refresh[snippets='http-request,http-response']

=== 로그아웃
operation::auth/logout[snippets='http-request,http-response']

[[Member]]
== 회원

Expand Down Expand Up @@ -45,6 +51,45 @@ operation::studies/details[snippets='http-request,http-response']
=== 참여한 스터디 목록 조회
operation::studies/myStudy[snippets='http-request,http-response']

=== 스터디 상세 정보 수정
operation::studies/update[snippets='http-request,http-response']

=== 스터디 탈퇴
operation::studies/leave[snippets='http-request,request-headers,http-response']

[[Comunity]]
== 커뮤니티

=== 커뮤니티 생성
operation::article/create[snippets='http-request,request-headers,request-fields,http-response']

=== 커뮤니티 단건 조회
operation::article/get[snippets='http-request,request-headers,http-response,response-fields']

=== 커뮤니티 전체 조회
operation::article/list[snippets='http-request,request-headers,http-response,response-fields']

=== 커뮤니티 수정
operation::article/update[snippets='http-request,request-headers,http-response']

=== 커뮤니티 삭제
operation::article/delete[snippets='http-request,request-headers,http-response']

[[Reference-Room]]
== 링크 공유

=== 링크 공유글 생성
operation::reference-room/create[snippets='http-request,request-headers,request-fields,http-response']

=== 링크 공유글 전체 조회
operation::reference-room/list[snippets='http-request,request-headers,http-response,response-fields']

=== 링크 공유글 수정
operation::reference-room/update[snippets='http-request,request-headers,http-response']

=== 링크 공유글 삭제
operation::reference-room/delete[snippets='http-request,request-headers,http-response']

[[Tag]]
== 태그

Expand Down
4 changes: 2 additions & 2 deletions backend/src/docs/asciidoc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ <h3 id="_github_로그인"><a class="link" href="#_github_로그인">Github 로
<h4 id="_github_로그인_http_request"><a class="link" href="#_github_로그인_http_request">HTTP request</a></h4>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/login/token?code=authorization-code HTTP/1.1
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/auth/login?code=authorization-code HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080</code></pre>
Expand Down Expand Up @@ -890,4 +890,4 @@ <h4 id="My-Role_response_fields"><a class="link" href="#My-Role_response_fields"
}
</script>
</body>
</html>
</html>
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.woowacourse.moamoa.auth.config;

import com.woowacourse.moamoa.auth.controller.AuthenticatedMemberResolver;
import com.woowacourse.moamoa.auth.controller.AuthenticatedRefreshArgumentResolver;
import com.woowacourse.moamoa.auth.controller.AuthenticationArgumentResolver;
import com.woowacourse.moamoa.auth.controller.AuthenticationInterceptor;

import java.util.List;

import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
Expand All @@ -13,21 +16,19 @@
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@RequiredArgsConstructor
public class AuthConfig implements WebMvcConfigurer {

private final AuthenticatedRefreshArgumentResolver authenticatedRefreshArgumentResolver;
private final AuthenticationInterceptor authenticationInterceptor;
private final AuthenticationArgumentResolver authenticationArgumentResolver;

public AuthConfig(
final AuthenticationInterceptor authenticationInterceptor,
final AuthenticationArgumentResolver authenticationArgumentResolver) {
this.authenticationInterceptor = authenticationInterceptor;
this.authenticationArgumentResolver = authenticationArgumentResolver;
}
private final AuthenticatedMemberResolver authenticatedMemberResolver;

@Override
public void addArgumentResolvers(final List<HandlerMethodArgumentResolver> resolvers) {
resolvers.add(authenticationArgumentResolver);
resolvers.add(authenticatedMemberResolver);
resolvers.add(authenticatedRefreshArgumentResolver);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.woowacourse.moamoa.auth.config;

import static org.springframework.http.HttpMethod.*;

import com.woowacourse.moamoa.auth.controller.matcher.AuthenticationRequestMatcher;
import com.woowacourse.moamoa.auth.controller.matcher.AuthenticationRequestMatcherBuilder;
import lombok.AllArgsConstructor;
Expand All @@ -14,10 +16,28 @@ public class AuthRequestMatchConfig {
@Bean
public AuthenticationRequestMatcher authenticationRequestMatcher() {
return new AuthenticationRequestMatcherBuilder()
.addUpAuthenticationPath(HttpMethod.POST, "/api/studies", "/api/studies/\\d+/reviews", "/api/studies/\\d+/reviews/\\d+")
.addUpAuthenticationPath(HttpMethod.GET, "/api/my/studies", "/api/members/me", "/api/members/me/role")
.addUpAuthenticationPath(HttpMethod.PUT, "/api/studies/\\d+/reviews/\\d+")
.addUpAuthenticationPath(HttpMethod.DELETE, "/api/studies/\\d+/reviews/\\d+")
.addUpAuthenticationPath(POST,
"/api/studies/\\d+/reviews",
"/api/studies/\\d+/reviews/\\d+",
"/api/studies/\\w+/\\w+/articles",
"/api/studies")
.addUpAuthenticationPath(GET,
"/api/my/studies",
"/api/auth/refresh",
"/api/members/me",
"/api/members/me/role",
"/api/studies/\\w+/community/articles/\\w+",
"/api/studies/\\w+/community/articles",
"/api/studies/\\d+/reference-room/links"
)
.addUpAuthenticationPath(HttpMethod.PUT,
"/api/studies/\\d+/reviews/\\d+",
"/api/studies/\\d+/reference-room/links/\\d+",
"/api/study/\\d+"
)
.addUpAuthenticationPath(HttpMethod.DELETE,
"/api/studies/\\d+/reviews/\\d+",
"/api/studies/\\w+/\\w+/articles/\\w+")
.build();
}
}
Loading

0 comments on commit 64f8490

Please sign in to comment.