Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI 스크립트 개선 (issue #108) #111

Merged
merged 23 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2dacb4b
refactor: 백엔드, 프론트엔드 ci 파일 분리 및 gradle 캐싱
lilychoibb Jul 23, 2024
acbe007
refactor: 백엔드, 프론트엔드 ci 파일 분리 및 gradle 캐싱
lilychoibb Jul 23, 2024
36f63a8
refactor: 성능 측정을 위한 gradle 캐싱 주석 처리
lilychoibb Jul 24, 2024
277e726
refactor: 성능 측정을 위한 gradle 캐싱 주석 해제
lilychoibb Jul 24, 2024
9cf6ef6
refactor: 성능 측정을 위한 백엔드 패키지 수정
lilychoibb Jul 24, 2024
f916ce9
refactor: ci path 수정
lilychoibb Jul 24, 2024
a38b1f3
refactor: 성능 측정을 위한 백엔드 패키지 수정
lilychoibb Jul 24, 2024
9442fdb
refactor: 테스트를 위한 주석 원복
lilychoibb Jul 24, 2024
bd4e2fd
refactor: gradle run 변경 및 불필요한 부분 제거
lilychoibb Jul 24, 2024
deae1b4
refactor: teamMember env 설정 테스트
lilychoibb Jul 24, 2024
9bb93da
refactor: ci 트리거를 위한 주석
lilychoibb Jul 24, 2024
96d5f4b
fix: gradle uses 수정
lilychoibb Jul 24, 2024
f194e7b
fix: pull request assignee 가져오는 부분 변경
lilychoibb Jul 24, 2024
6d2f94c
fix: pr assignees 할당 변경
lilychoibb Jul 24, 2024
55f741f
fix: pr assignee 할당 수정
lilychoibb Jul 24, 2024
7cf9a6b
fix: env 추가
lilychoibb Jul 24, 2024
55f60df
refactor: pr assignee 를 sender 로 변경
lilychoibb Jul 24, 2024
7bccc04
refactor: sender 를 assignee 로 변경 테스트
lilychoibb Jul 24, 2024
afdef5c
refactor: sender 로 변경
lilychoibb Jul 24, 2024
c7fe6ba
refactor: 불필요한 주석 삭제
lilychoibb Jul 24, 2024
aebdd23
Merge branch 'main' into refactor/#108
lilychoibb Jul 24, 2024
b0a1f9d
refactor: 불필요한 주석 제거
lilychoibb Jul 24, 2024
3304c99
Merge branch 'refactor/#108' of https://github.com/woowacourse-teams/…
lilychoibb Jul 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/backend_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: BACKEND_CI

on:
pull_request:
types: [ opened, reopened, synchronize ]
branches: [ 'main' ]
paths:
- backend/**

env:
lilychoibb: "U07AQJWU8S3"
robinjoon: "U07BU02FQFJ"
brgndyy: "U07B53DM02W"
chosim-dvlpr: "U07BHP5UTLH"
Minjoo522: "U07B4V80WLT"
alstn113: "U07AQK2KBLP"
le2sky: "U07B26581CM"
Parkhanyoung: "U07BTSGKCC8"

jobs:
BE_CI:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Test with Gradle
continue-on-error: true
id: gradle_test
run: |
cd backend
./gradlew test

BE_SLACK_MESSAGE:
runs-on: ubuntu-latest
needs: BE_CI
if: ${{needs.BE_CI.result != 'skipped'}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Get teamMember
id: teamMember
run: |
echo "SENDER_SLACK_ID=${{ env[github.event.sender.login] }}" >> $GITHUB_ENV

- name: Slack mention
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.ISSUE_CHANNEL }}
payload: |
{
"text": "pr 테스트 결과",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "pr 테스트 ${{ needs.BE_CI.result }} \n • 링크: <${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}> \n • pr 담당자: <@${{ env.SENDER_SLACK_ID }}>"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
82 changes: 4 additions & 78 deletions .github/workflows/ci.yml → .github/workflows/front_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,91 +5,17 @@
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle

name: CI
name: FRONT_CI

on:
workflow_dispatch:
pull_request:
types: [ opened, reopened, synchronize ]
branches: [ 'main' ]
paths:
- frontend/**

jobs:
BE_CI:
if: ${{ contains(github.event.pull_request.labels.*.name, '🚛 백엔드') }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
actions: write

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Setup Gradle
run: chmod +x ./backend/gradlew

- name: Build with Gradle
continue-on-error: true
id: gradle_build
run: |
cd backend
./gradlew build

BE_SLACK_MESSAGE:
runs-on: ubuntu-latest
needs: BE_CI
if: ${{needs.BE_CI.result != 'skipped'}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Get teamMember List
id: teamMembers
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const workers = JSON.parse(fs.readFileSync('.github/workflows/teamMember.json'));
const mention = context.payload.pull_request.assignees.map((user) => {
const login = user.login;
const mappedValue = workers[login];
return mappedValue ? `<@${mappedValue}>` : `No mapping found for ${login}`;
})
return mention.join(', ');

- name: Slack mention
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.ISSUE_CHANNEL }}
payload: |
{
"text": "pr 테스트 결과",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "pr 테스트 ${{ needs.BE_CI.result }} \n • 링크: <${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}> \n • pr 담당자: \${{ steps.teamMembers.outputs.result }}
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.BOT_TOKEN }}

FE_CI:
if: ${{ contains(github.event.pull_request.labels.*.name, '🎨 프론트엔드') }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -159,7 +85,7 @@ jobs:

FE_SLACK_MESSAGE:
runs-on: ubuntu-latest
needs: [FE_CI]
needs: FE_CI
if: ${{needs.FE_CI.result != 'skipped'}}
steps:
- name: Checkout repository
Expand Down
10 changes: 0 additions & 10 deletions .github/workflows/teamMember.json

This file was deleted.