Skip to content

Commit

Permalink
Merge pull request #91 from boostcampwm-2024/dev-be
Browse files Browse the repository at this point in the history
[CHORE] backend ci 설정
  • Loading branch information
i3kae authored Nov 12, 2024
2 parents 966a2c3 + 1317d87 commit 4d95e91
Show file tree
Hide file tree
Showing 54 changed files with 314 additions and 6,409 deletions.
60 changes: 33 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,45 @@ on:
branches:
- dev
- dev-fe
- dev-be
- dev-be

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
workspace: [frontend]
workspace: [frontend, backend]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install dependencies
run: yarn install

- name: Build ${{ matrix.workspace }}
run: |
cd ${{ matrix.workspace }}
yarn build
- name: Lint ${{ matrix.workspace }}
run: |
cd ${{ matrix.workspace }}
yarn lint || exit 1 # Lint 실패 시 종료
- name: TypeScript Check ${{ matrix.workspace }}
run: |
cd ${{ matrix.workspace }}
yarn tsc --noEmit || exit 1 # 빌드하지 않고 타입 오류만 체크
- name: Checkout repository
uses: actions/checkout@v3

- name: .env setting
run: |
touch ../.env
echo "GITHUB_REGISTRY_TOKEN:${{ secrets.REGISTRY_TOKEN }}" > ../.env
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install dependencies
run: yarn install

- name: Build ${{ matrix.workspace }}
run: |
cd ${{ matrix.workspace }}
yarn build
- name: Lint ${{ matrix.workspace }}
run: |
cd ${{ matrix.workspace }}
yarn lint || exit 1 # Lint 실패 시 종료
- name: TypeScript Check ${{ matrix.workspace }}
run: |
cd ${{ matrix.workspace }}
yarn tsc --noEmit || exit 1 # 빌드하지 않고 타입 오류만 체크
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
!.yarn/releases
!.yarn/sdks
!.yarn/versions
!.yarn/plugin-env-npm.js

.DS_Store
.idea

backend/.env
.env

# Swap the comments on the following lines if you wish to use zero-installs
# In that case, don't forget to run `yarn config set enableGlobalCache false`!
# Documentation here: https://yarnpkg.com/features/caching#zero-installs
Expand Down
33 changes: 33 additions & 0 deletions .yarn/plugin-env-npm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = {
name: 'plugin-env-npm',
factory: require => ({
hooks: {
async getNpmAuthenticationHeader(currentHeader, registry, {ident}){
// only trigger for specific scope
if (!ident || ident.scope !== 'hoeeeeeh') {
return currentHeader
}

// try getting token from process.env
let bufEnv = process.env.BUF_REGISTRY_TOKEN
// alternatively, try to find it in .env
if (!bufEnv) {
const fs = require('fs/promises')
const fileContent = await fs.readFile('../.env', 'utf8')
const rows = fileContent.split(/\r?\n/)
for (const row of rows) {
const [key, value] = row.split(':', 2)
if (key.trim() === 'GITHUB_REGISTRY_TOKEN') {
bufEnv = value.trim()
}
}
}

if (bufEnv) {
return `${bufEnv}`
}
return currentHeader
},
},
}),
}
10 changes: 9 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
yarnPath: .yarn/releases/yarn-4.5.1.cjs
nodeLinker: pnp

npmScopes:
hoeeeeeh:
npmRegistryServer: 'https://npm.pkg.github.com/'

plugins:
- ./.yarn/plugin-env-npm.js

yarnPath: .yarn/releases/yarn-4.5.1.cjs

packageExtensions:
'@typescript-eslint/utils@*':
peerDependencies:
Expand Down
5 changes: 0 additions & 5 deletions backend/.env

This file was deleted.

6 changes: 4 additions & 2 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
node_modules
ffmpeg
nodeMediaServer/media/*

rtmpServer/nodeMediaServer/media/*
media
.env

.dist
19 changes: 19 additions & 0 deletions backend/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: "3.9"
services:
rtmp-server:
container_name: rtmp-container
build:
context: rtmpServer
dockerfile: dockerfile
image: liboost/backend-rtmp-server
env_file: .env
ports:
- 8000:8000
- 1935:1935
networks:
- backend-bridge

networks:
backend-bridge:
driver: bridge
name: media-server
24 changes: 24 additions & 0 deletions backend/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import js from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';

export default tseslint.config({ ignores: ['**/.*'] }, js.configs.recommended, ...tseslint.configs.recommended, {
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: {
...globals.browser
},
parser: tseslint.parser
},
plugins: {
'@typescript-eslint': tseslint.plugin
},
rules: {
eqeqeq: ['error', 'always'],
indent: ['error', 2],
quotes: ['error', 'single'],
semi: ['error', 'always'],
'@typescript-eslint/no-unused-vars': ['error']
}
});
1 change: 0 additions & 1 deletion backend/nodeMediaServer/README.md

This file was deleted.

36 changes: 0 additions & 36 deletions backend/nodeMediaServer/package.json

This file was deleted.

Loading

0 comments on commit 4d95e91

Please sign in to comment.