-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (51 loc) · 1.61 KB
/
typescript-packages-unit-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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