각 패키지에 대한 테스트 환경 설정 (issue #1) #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Package CI | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
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: Install changesets | |
run: pnpm install @changesets/cli -w | |
- name: Fetch main branch | |
run: git fetch origin main:main | |
- name: Get changed workspaces | |
id: changesets | |
run: | | |
# Check for changed workspaces | |
CHANGED_WORKSPACES=$(pnpm changeset status --since-ref main --verbose | grep '^-' | cut -d ' ' -f 2 | tr '\n' ' ') | |
echo "Changed workspaces: $CHANGED_WORKSPACES" | |
echo "CHANGED_WORKSPACES=$CHANGED_WORKSPACES" >> $GITHUB_ENV | |
- name: Run tests for changed packages | |
if: env.CHANGED_WORKSPACES != '' | |
run: pnpm -r --filter "${{ env.CHANGED_WORKSPACES }}" test |