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: TypeScript Packages - Unit Tests | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "packages/**" | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "packages/**" | |
jobs: | |
check_changes: | |
runs-on: ubuntu-latest | |
outputs: | |
sdk_only_changed: ${{ steps.check.outputs.sdk_only_changed }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check for SDK-only changes | |
id: check | |
run: | | |
git fetch origin ${{ github.base_ref }} | |
API_CHANGED=$(git diff --name-only origin/${{ github.base_ref }} HEAD | grep "^api/nameguard/" | wc -l) | |
SDK_CHANGED=$(git diff --name-only origin/${{ github.base_ref }} HEAD | grep "^packages/nameguard-sdk/" | wc -l) | |
if [ $API_CHANGED -eq 0 ] && [ $SDK_CHANGED -gt 0 ]; then | |
echo "sdk_only_changed=true" >> $GITHUB_OUTPUT | |
else | |
echo "sdk_only_changed=false" >> $GITHUB_OUTPUT | |
fi | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package: | |
- "ens-utils" | |
- "nameguard-js" | |
- "nameguard-react" | |
- "nameguard-sdk" | |
- "namekit-react" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Build ${{ matrix.package }} | |
run: pnpm --filter ./packages/${{ matrix.package }} build | |
- name: Test ${{ matrix.package }} | |
if: matrix.package != 'nameguard-sdk' || needs.check_changes.outputs.sdk_only_changed == 'true' | |
run: pnpm --filter ./packages/${{ matrix.package }} test |