mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 12:05:41 +03:00
d4aa7031c8
Closes #395
121 lines
2.8 KiB
YAML
121 lines
2.8 KiB
YAML
version: 2.1
|
|
|
|
parameters:
|
|
pull_request:
|
|
type: boolean
|
|
default: false
|
|
|
|
commands:
|
|
setup:
|
|
steps:
|
|
- run:
|
|
name: Install yarn
|
|
command: |
|
|
COREPACK_PATH=$HOME/.local/bin
|
|
|
|
mkdir -p $COREPACK_PATH
|
|
eval "$(echo PATH=$COREPACK_PATH:\$PATH | tee -a $BASH_ENV)"
|
|
|
|
corepack enable --install-directory $COREPACK_PATH
|
|
yarn install
|
|
|
|
jobs:
|
|
lint:
|
|
docker:
|
|
- image: cimg/node:20.12
|
|
steps:
|
|
- checkout
|
|
- setup
|
|
- run:
|
|
name: ESLint
|
|
shell: bash -e
|
|
command: |
|
|
changed_files=$(git diff --name-only --diff-filter=ACMRUXB origin/main)
|
|
|
|
if echo "$changed_files" | grep -q "^eslint.config.mjs$"; then
|
|
yarn lint
|
|
else
|
|
echo "$changed_files" | grep -E "(.js$|.ts$)" | xargs -r yarn lint
|
|
fi
|
|
- run:
|
|
name: Prettier
|
|
command: |
|
|
changed_files=$(git diff --name-only --diff-filter=ACMRUXB origin/main)
|
|
|
|
if echo "$changed_files" | grep -q -E "^\.prettierrc$|^\.prettierignore$"; then
|
|
yarn prettier -c .
|
|
else
|
|
|
|
echo "$changed_files" | xargs -r yarn prettier -c --ignore-unknown
|
|
fi
|
|
typecheck:
|
|
docker:
|
|
- image: cimg/node:20.12
|
|
steps:
|
|
- checkout
|
|
- setup
|
|
- run:
|
|
name: Typecheck
|
|
command: yarn tsc --noEmit
|
|
pre-pack:
|
|
docker:
|
|
- image: cimg/node:20.12
|
|
steps:
|
|
- checkout
|
|
- setup
|
|
- run:
|
|
name: Build
|
|
command: yarn pack --out package.tgz
|
|
- run:
|
|
name: Check Dist
|
|
command: node --test .scripts/check-dist.mjs
|
|
- run:
|
|
name: Check Package Types
|
|
command: yarn attw package.tgz
|
|
check-peer:
|
|
docker:
|
|
- image: cimg/node:20.12
|
|
steps:
|
|
- checkout
|
|
- setup
|
|
- run:
|
|
name: Check Peer Dependency
|
|
command: ./.scripts/check-peer.sh || (echo "Peer Dependency 오류가 발생했습니다."; exit -1)
|
|
test:
|
|
docker:
|
|
- image: cimg/node:18.20.4
|
|
steps:
|
|
- checkout
|
|
- setup
|
|
- run:
|
|
name: vitest
|
|
command: yarn vitest --reporter=junit > ./.junit
|
|
- store_test_results:
|
|
path: ./.junit
|
|
- store_artifacts:
|
|
path: ./.junit
|
|
|
|
workflows:
|
|
main:
|
|
jobs:
|
|
- test:
|
|
filters:
|
|
branches:
|
|
ignore: main
|
|
- lint:
|
|
filters:
|
|
branches:
|
|
ignore: main
|
|
- typecheck:
|
|
filters:
|
|
branches:
|
|
ignore: main
|
|
- pre-pack:
|
|
filters:
|
|
branches:
|
|
ignore: main
|
|
- check-peer:
|
|
filters:
|
|
branches:
|
|
ignore: main
|