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

각 패키지에 대한 테스트 환경 설정 (issue #1) #2

Merged
merged 18 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 27 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,44 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Install pnpm
run: npm install -g pnpm

- name: Install dependencies
run: pnpm install

- name: Fetch main branch
run: git fetch origin main

- name: Get changed workspaces
id: changesets
run: |
echo "CHANGED_WORKSPACES=$(pnpm list --depth=-1 --json | jq -r '.[] | select(.dev !== true) | select(.updated === true) | .path' | tr '\n' ' ')" >> $GITHUB_ENV
CHANGED_WORKSPACES=$(git diff --name-only origin/main...HEAD -- packages/ | grep 'packages/' | cut -d '/' -f 2 | sort | uniq | tr '\n' ',')
echo "Changed workspaces: $CHANGED_WORKSPACES"
echo "CHANGED_WORKSPACES=$CHANGED_WORKSPACES" >> $GITHUB_ENV

- name: Add empty changeset if necessary
if: env.CHANGED_WORKSPACES != ''
run: |
if pnpm changeset status --since-ref main --verbose | grep -q 'Some packages have been changed'; then
pnpm changeset add --empty
fi

- name: Run tests for changed packages
run: pnpm -r --filter="${{ env.CHANGED_WORKSPACES }}" test
if: env.CHANGED_WORKSPACES != ''
run: |
IFS=',' read -r -a packages <<< "${CHANGED_WORKSPACES}"
for package in "${packages[@]}"; do
if [ -n "$package" ]; then
echo "Running tests for package: $package"
pnpm -r --filter "./packages/$package" test
fi
done
2 changes: 1 addition & 1 deletion packages/react-metronome/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "brgndy-react-metronome",
"version": "1.1.0",
"version": "1.1.1",
"description": "metronome library component for react",
"main": "dist/cjs/index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/react-wave-form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "brgndy-react-wave-form",
"version": "1.1.0",
"version": "1.1.1",
"description": "react audio waveform library like soundcloud",
"main": "dist/cjs/index.js",
"types": "dist/index.d.ts",
Expand Down