-
Notifications
You must be signed in to change notification settings - Fork 26
146 lines (127 loc) · 4.33 KB
/
build-test.yml
File metadata and controls
146 lines (127 loc) · 4.33 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: CI
on:
push:
branches:
- main
- dev
- 'release/**'
pull_request:
branches:
- main
- dev
- 'release/**'
jobs:
build:
name: Lint, Build & Unit, E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
packages: read
env:
INTERNAL_EVENT: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm lint
- name: Type check
run: pnpm typecheck
- name: Test
run: pnpm test
- name: Build
run: pnpm build
- name: Release a nightly build
if: env.INTERNAL_EVENT == 'true'
run: pnpx pkg-pr-new publish ./packages/sdk
- name: Checkout lattice-simulator
if: env.INTERNAL_EVENT == 'true'
uses: actions/checkout@v6
with:
repository: GridPlus/lattice-simulator
path: lattice-simulator
token: ${{ secrets.GRIDPLUS_SIM_PAT }}
- name: Install simulator dependencies
if: env.INTERNAL_EVENT == 'true'
working-directory: lattice-simulator
run: pnpm install --ignore-workspace
- name: Start simulator in background
if: env.INTERNAL_EVENT == 'true'
working-directory: lattice-simulator
env:
CI: '1'
DEBUG_SIGNING: '1'
DEBUG: 'lattice*'
LATTICE_MNEMONIC: 'test test test test test test test test test test test junk'
PORT: '3000'
DEVICE_ID: 'SD0001'
PASSWORD: '12345678'
PAIRING_SECRET: '12345678'
ENC_PW: '12345678'
run: |
pnpm run dev > simulator.log 2>&1 &
echo $! > simulator.pid
echo "Simulator PID: $(cat simulator.pid)"
# Wait for simulator to be ready
echo "Waiting for simulator to start..."
for i in {1..30}; do
if curl -s http://localhost:3000 > /dev/null 2>&1; then
echo "Simulator is ready!"
break
fi
if [ $i -eq 30 ]; then
echo "Simulator failed to start within 30 seconds"
cat simulator.log
exit 1
fi
sleep 1
done
- name: Run SDK e2e tests with simulator
if: env.INTERNAL_EVENT == 'true'
working-directory: ${{ github.workspace }}
env:
CI: '1'
DEBUG_SIGNING: '1'
baseUrl: 'http://127.0.0.1:3000'
DEVICE_ID: 'SD0001'
PASSWORD: '12345678'
PAIRING_SECRET: '12345678'
ENC_PW: '12345678'
APP_NAME: 'lattice-manager'
run: pnpm run e2e -- --reporter=basic
- name: Run CLI smoke tests with simulator
if: env.INTERNAL_EVENT == 'true'
working-directory: ${{ github.workspace }}
run: |
# CLI tests run after e2e tests to avoid pairing conflicts
# (simulator only supports one pairing at a time)
./packages/cli/dist/bin/gridplus.js simulator setup
./packages/cli/dist/bin/gridplus.js address
./packages/cli/dist/bin/gridplus.js address --count 3
./packages/cli/dist/bin/gridplus.js address --type btc-segwit
./packages/cli/dist/bin/gridplus.js address --type solana
./packages/cli/dist/bin/gridplus.js pubkey
./packages/cli/dist/bin/gridplus.js address --json
echo "CLI tests passed!"
- name: Show simulator logs on failure
if: failure() && env.INTERNAL_EVENT == 'true'
run: |
if [ -d lattice-simulator ]; then
echo "=== Simulator logs ==="
cat lattice-simulator/simulator.log || echo "No simulator logs found"
else
echo "Simulator directory not found, skipping logs"
fi
- name: Stop simulator
if: always() && env.INTERNAL_EVENT == 'true'
run: |
if [ -f lattice-simulator/simulator.pid ]; then
kill $(cat lattice-simulator/simulator.pid) || true
fi